phoenix_components v1.0.0 PhoenixComponents.View View Source

Link to this section Summary

Functions

Helper to render a component by name

Helper to render a component by name and a list of attributes

Helper to render a component by name and a list of attributes

Macro to generate helpers for components inside views

Link to this section Functions

Helper to render a component by name.

## Examples

<%= component :button %>

Helper to render a component by name and a list of attributes.

Note that attributes are available in the template as the map @attrs.

## Examples

<%= component :button, color: "red", size: "small", label: "Submit" %>
Link to this function component(name, attrs, list) View Source

Helper to render a component by name and a list of attributes.

Note that attributes are available in the template as the map @attrs.

## Examples

<%= component :button, color: "red", size: "small" do %>
  Submit
<% end %>
Link to this macro import_components(components) View Source (macro)

Macro to generate helpers for components inside views.

## Examples

import_components [:button, :jumbotron]

Then you can use the component directly

<%= button type: "submit" %>