PetalComponents.Table (petal_components v3.0.1)
View SourceSummary
Functions
Renders a table with generic styling.
Attributes
class(:any) - CSS class. Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["colspan", "headers", "rowspan"].
Slots
inner_block
Attributes
class(:any) - CSS class. Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["colspan", "rowspan"].
Slots
inner_block
Attributes
class(:any) - CSS class. Defaults tonil.- Global attributes are accepted.
Slots
inner_block
Attributes
class(:any) - CSS class. Defaults tonil.label(:string) - Adds a label your user, e.g name. Defaults tonil.sub_label(:string) - Adds a sub-label your to your user, e.g title. Defaults tonil.avatar_assigns(:map) - if using an avatar, this map will be passed to the avatar component as props. Defaults tonil.- Global attributes are accepted.
Functions
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>
<:empty_state>No data here yet</:empty_state>
</.table>Attributes
id(:string)class(:any) - CSS class. Defaults tonil.variant(:string) - Defaults to"basic".rows(:list) - the list of rows to render. Defaults to[].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.row_item(:any) - the function for mapping each row before calling the :col slot. Defaults to&Function.identity/1.- Global attributes are accepted. Supports all globals plus:
["colspan", "rowspan"].
Slots
col- Accepts attributes:label(:string)class(:any)row_class(:any)
empty_state- A message to show when the table is empty, to be used together with :col. Accepts attributes:row_class(:any)
Attributes
class(:any) - CSS class. Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["colspan", "headers", "rowspan"].
Slots
inner_block
Attributes
class(:any) - CSS class. Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["colspan", "rowspan"].
Slots
inner_block
Attributes
class(:any) - CSS class. Defaults tonil.- Global attributes are accepted.
Slots
inner_block
Attributes
class(:any) - CSS class. Defaults tonil.label(:string) - Adds a label your user, e.g name. Defaults tonil.sub_label(:string) - Adds a sub-label your to your user, e.g title. Defaults tonil.avatar_assigns(:map) - if using an avatar, this map will be passed to the avatar component as props. Defaults tonil.- Global attributes are accepted.