Renders a table.
This component is a pre-styled wrapper around Flop.Phoenix.table/1. A subset of attributes are available and others have been renamed to follow our terminology.
<.table id="users" rows={@users}> <:col :let={user} label="id"><%= user.id %></:col> <:col :let={user} label="username"><%= user.username %></:col> </.table>
#
To make a row sortable, include the field attribute on the col slot:
<.table id="users" rows={@users}> <:col :let={user} field={:name}> <%= user.name %> </:col> </.table>
You must also include a handle_params callback in your LiveView.
| Column headers with links are sortable Name | Column headers with links are sortable Company | Column headers with links are sortable Fruit | Column headers with links are sortable Rank |
|---|---|---|---|
| Leela | Planet Express | 🍏 | 2 |
| Fry | Planet Express | 🍌 | 4 |
| Bender | PlanEx | 🍇 | 3 |
| Mom | Mom Corp | 🍉 | 1 |
| Zoidberg | Planet Express | 🥥 | 6 |
| Farnsworth | Planet Express | 🫐 | 5 |
| Amy | Mars University | 🥭 | 7 |
| Hermes | Planet Express | 🍍 | 8 |
| Scruffy | Planet Express | 🥝 | 9 |
| Zapp | DOOP | 🍑 | 10 |
| Kif | DOOP | 🫒 | 11 |
| Lrrr | Omicron Persei 8 | 🌶️ | 12 |