Skip to content

Commit

Permalink
Explain how attributes are accesible from component's template
Browse files Browse the repository at this point in the history
  • Loading branch information
san650 committed Jun 11, 2017
1 parent 360058a commit fcc85ea
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,24 @@ Then you can use these helpers from your templates
<% end %>
```

### 5. Using attributes inside your components

When calling a component you can pass any attribute you like.

```eex
<%= button type: :submit do %>
Submit form!
<% end %>
```

Inside the component's template these attributes are going to be available in the `@attrs` map.

```eex
<button type="<%= @attrs.type %>>
<%= @content %>
</button>
```

## Configuration

You can configure where to put the components by editing your application
Expand Down

0 comments on commit fcc85ea

Please sign in to comment.