View Source ZoonkWeb.Components.Table (Zoonk v0.1.0-alpha)

Table components.

Link to this section Summary

Functions

Renders a table with generic styling.

Link to this section Functions

Renders a table with generic styling.

examples

Examples

<.table id="users" rows={@users}>
  <:col :let={user} label="id"><%= user.id %></:col>
  <:col :let={user} label="username"><%= user.username %></:col>
</.table>

attributes

Attributes

  • id (:string) (required) - the id of the table.
  • rows (:list) (required) - the rows to display in the table.
  • row_id (:any) - the function for generating the row id. Defaults to nil.
  • row_click (:any) - the function for handling phx-click on each row. Defaults to nil.
  • row_item (:any) - the function for mapping each row before calling the :col and :action slots. Defaults to &Function.identity/1.

slots

Slots

  • col (required) - Accepts attributes:
    • label (:string)
  • action - the slot for showing user actions in the last table column.