Table

Renders a table with generic styling.

Read more Read less

Examples

<.table id="users" rows={@users}>
  <:col :let={user} label="id"><%= user.id %></:col>
  <:col :let={user} label="username"><%= user.username %></:col>
</.table>
Id User name Actions
1 jose
2 chris
Attribute Type Documentation Default Value
Required id * :string
Required rows * :list
row_id :any the function for generating the row id
row_click :any the function for handling phx-click on each row
row_item :any the function for mapping each row before calling the :col and :action slots &Function.identity/1
Required col * :slot
<:col :let={user} label="Id">
  <%= user.id %>
</:col>
<:col :let={user} label="User name">
  <%= user.username %>
</:col>
action :slot the slot for showing user actions in the last table column
<:action><.button size="sm" variant="outline" class="mr-1">Edit</.button></:action>