SigmaKit.Components.Table (sigma_kit v0.0.31)
Summary
Functions
Attributes
id(:any) - Defaults tonil.page_number(:integer) - Defaults to1.total_pages(:integer) (required)page_size(:integer) (required)total_entries(:integer) (required)
Renders a table with generic styling.
Examples
<.table id="users" rows={@users}>
<:col :let={user} label="id">{user.id}</:col>
<:col :let={user} label="username">{user.username}</:col>
</.table>Attributes
id(:string) (required) - the unique id of the table.rows(:list) (required) - A list of row data to render.row_id(:any) - the function for generating the row id. Defaults tonil.row_click(:any) - the function for handling phx-click on each row. Defaults tonil.alternate(:boolean) - whether to alternate row colors. Defaults tofalse.paginate(:boolean) - whether to show pagination. Defaults tofalse.page_number(:integer) - the current page number.total_pages(:integer) - the total number of pages.page_size(:integer) - the number of rows per page.total_entries(:integer) - the total number of entries.row_item(:any) - the function for mapping each row before calling the :col and :action slots. Defaults to&Function.identity/1.
Slots
col(required) - A column to render for the table. Accepts attributes:label(:string) - The label for the column header.shrink(:boolean) - Whether to shrink the column to fit the content.expand(:boolean) - Whether to expand the column to fit the content.class(:any) - Additional CSS classes that can be added to column cells.
action- An action item to present in a dropdown menu. Accepts attributes:label(:string) - The label for the menu item.event(:any) - The phx-click event for the menu item.target(:string) - The phx-target for the menu item.icon(:string) - The icon for the menu item.divider(:boolean) - Whether to this item is a divider.danger(:boolean) - Styles the menu item as dangerous.