Table components for Pure Admin.
Provides table/1, table_responsive/1, table_container/1, and table_card/1.
Summary
Functions
Renders a data table with Pure Admin BEM classes.
Renders a card wrapper for tables with header, footer, and color variants.
Wraps a table in a bordered container with scroll support.
Wraps a table in a responsive scrolling container.
Functions
Renders a data table with Pure Admin BEM classes.
Accepts rows and column definitions via slots, following Phoenix conventions.
Examples
<.table rows={@users} is_striped is_hover>
<:col :let={user} label="Name"><%= user.name %></:col>
<:col :let={user} label="Email"><%= user.email %></:col>
<:action :let={user}>
<.button variant="primary" size="xs">Edit</.button>
</:action>
</.table>Attributes
id(:string) - Defaults tonil.rows(:list) (required) - List of row data.row_id(:any) - Function to generate row id from row data. Defaults tonil.row_click(:any) - JS command for row click. Defaults tonil.is_striped(:boolean) - Alternating row colors. Defaults tofalse.is_hover(:boolean) - Hover effect on rows. Defaults tofalse.is_bordered(:boolean) - Full cell borders on all sides. Defaults tofalse.is_borderless(:boolean) - Remove all cell borders. Defaults tofalse.is_compact(:boolean) - Compact table (reduced padding). Defaults tofalse.is_responsive(:boolean) - Wrap in responsive scrolling container. Defaults tofalse.is_responsive_grid(:boolean) - CSS Grid responsive collapse on mobile. Defaults tofalse.size(:string) - Defaults tonil.Must be one ofnil,"xs","sm","lg", or"xl".class(:string) - Defaults tonil.- Global attributes are accepted.
Slots
col(required) - Column definitions. Accepts attributes:label(:string) (required)class(:string)col_class(:string) - Class for th/td (e.g. col-auto).align(:string) - Text alignment (start, center, end).
action- Action column. Accepts attributes:label(:string)class(:string)
foot- Table footer rows (tfoot content).
Renders a card wrapper for tables with header, footer, and color variants.
Examples
<.table_card title_text="Recent Orders">
<.table rows={@orders}>
<:col :let={o} label="Order"><%= o.id %></:col>
<:col :let={o} label="Total"><%= o.total %></:col>
</.table>
</.table_card>
<.table_card title_text="Sales" variant="primary" is_scrollable>
<:actions><.button size="sm">Export</.button></:actions>
<.table rows={@data}>...</.table>
<:footer><.pager page={@page} total_pages={@total_pages} /></:footer>
</.table_card>Attributes
title_text(:string) - Card title. Defaults tonil.variant(:string) - Semantic color variant for header accent. Defaults tonil. Must be one ofnil,"primary","success","warning", or"danger".color(:string) - Theme color 1-9. Defaults tonil. Must be one ofnil,"1","2","3","4","5","6","7","8", or"9".is_scrollable(:boolean) - Horizontal scrolling for wide tables. Defaults tofalse.is_plain(:boolean) - Remove card styling (border, shadow, background). Defaults tofalse.class(:string) - Defaults tonil.- Global attributes are accepted.
Slots
header- Custom header content (overrides title_text).actions- Header action buttons.inner_block(required)footer- Footer content (e.g. pagination).
Wraps a table in a bordered container with scroll support.
Examples
<.table_container>
<.table rows={@data}>...</.table>
</.table_container>
<.table_container is_panel title_text="Users">
<:actions><.button size="sm">Export</.button></:actions>
<.table rows={@data}>...</.table>
</.table_container>Attributes
is_panel(:boolean) - Card-like panel styling with shadow. Defaults tofalse.title_text(:string) - Header title (panel mode only). Defaults tonil.class(:string) - Defaults tonil.- Global attributes are accepted.
Slots
header- Custom header content (overrides title_text).actions- Header action buttons (panel mode only).inner_block(required)
Wraps a table in a responsive scrolling container.
Examples
<.table_responsive>
<.table rows={@data}>...</.table>
</.table_responsive>Attributes
class(:string) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)