Table

Renders a simple table.

Read more Read less

Usage

<.table id="pets" rows={@pets}>
  <:col :let={p} label="name"><%= p.name %></:col>
  <:col :let={p} label="age"><%= p.age %></:col>
</.table>
nameage
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>
nameage
George 8 Edit
Mary 5 Edit
<.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>
List of pets filtered by species
nameage
George 8
Mary 5
<.table
  id="table-single-caption"
  rows={[%{id: 1, name: "George", age: 8}, %{id: 2, name: "Mary", age: 5}]}
  caption="List of pets filtered by species"
>
  <:col :let={p} label="name"><%= p.name %></:col>
  <:col :let={p} label="age"><%= p.age %></:col>
</.table>