LanternUI.Components.Table (LanternUI v0.8.2)

Copy Markdown View Source

Presentational table family — the styled substrate data_table composes. Mirrors Fluxon's table/table_head/table_body/table_row surface.

<.table>
  <.table_head>
    <:col>Name</:col>
    <:col class="text-right">Total</:col>
  </.table_head>
  <.table_body>
    <.table_row :for={o <- @orders} selected={o.id in @selected}>
      <:cell>{o.name}</:cell>
      <:cell class="lui-td-num">{o.total}</:cell>
    </.table_row>
  </.table_body>
</.table>

table_body/1 is the body wrapper in the anatomy above. It accepts table_row/1 children and keeps row rendering separate from the header.

Sort affordances, pagination, selection state, and Flop wiring live in data_table; this family is pure markup + tokens.

Summary

Functions

table(assigns)

Attributes

  • class (:any) - Extra classes merged onto the root element. Defaults to nil.
  • Global attributes are accepted. Arbitrary HTML/phx-* attributes passed through.

Slots

  • inner_block (required) - table_head and table_body children.

table_body(assigns)

Attributes

  • class (:any) - Extra classes merged onto the root element. Defaults to nil.
  • Global attributes are accepted. Arbitrary HTML/phx-* attributes passed through.

Slots

  • inner_block (required) - table_row children.

table_head(assigns)

Attributes

  • class (:any) - Extra classes merged onto the root element. Defaults to nil.
  • Global attributes are accepted. Arbitrary HTML/phx-* attributes passed through.

Slots

  • col - Header cell content for one column. Accepts attributes:
    • class (:any) - Extra classes on this header cell.
  • inner_block - Optional raw thead row content after :col cells.

table_row(assigns)

Attributes

  • selected (:boolean) - Highlight the row as selected. Defaults to false.
  • class (:any) - Extra classes merged onto the root element. Defaults to nil.
  • Global attributes are accepted. Arbitrary HTML/phx-* attributes passed through. Supports all globals plus: ["phx-click", "phx-value-id", "phx-target"].

Slots

  • cell - One body cell in column order. Accepts attributes:
    • class (:any) - Extra classes on this cell.
  • inner_block - Optional raw row content after :cell cells.