Renders a simple table.
<.table id="pets" rows={@pets}>
<:col :let={p} label="name"><%= p.name %></:col>
<:col :let={p} label="age"><%= p.age %></:col>
</.table>
name | age |
---|---|
George | 8 |
Mary | 5 |
<.table id="table-single-basic" rows={[%{id: 1, name: "George", age: 8}, %{id: 2, name: "Mary", age: 5}]}> <:col :let={p} label="name"><%= p.name %></:col> <:col :let={p} label="age"><%= p.age %></:col> </.table>
<.table id="table-single-actions" rows={[%{id: 1, name: "George", age: 8}, %{id: 2, name: "Mary", age: 5}]}> <:col :let={p} label="name"><%= p.name %></:col> <:col :let={p} label="age"><%= p.age %></:col> <:action> <.link>Edit</.link> </:action> </.table>
name | age |
---|---|
George | 8 |
Mary | 5 |
Avg age | 7.5 |
<.table id="table-single-foot" rows={[%{id: 1, name: "George", age: 8}, %{id: 2, name: "Mary", age: 5}]}> <:col :let={p} label="name"><%= p.name %></:col> <:col :let={p} label="age"><%= p.age %></:col> <:foot> <tr> <td>Avg age</td> <td>7.5</td> </tr> </:foot> </.table>