PhoenixPaper.TableCell (PhoenixPaper v0.1.0)

Copy Markdown View Source

A cell inside a PhoenixPaper.TableRow (pp_table_cell/1) — renders a <th> when variant="head", a <td> otherwise. See PhoenixPaper.Table's moduledoc for a full example.

sortable turns a head cell into MUI's TableSortLabel equivalent: a clickable button with a direction arrow, styled by sort_direction (nil — sortable but not the active column, "asc", or "desc"). Unlike MUI, this is presentation only — there's no click handling built in, wire your own phx-click/phx-value-* via the normal global attrs (e.g. phx-click="sort" phx-value-column="name"); the LiveView owns which column is active and in which direction, the same as it owns the actual sorted data. rest lands on the <button> when sortable, or on the <th>/<td> itself otherwise (e.g. for colspan/rowspan).

Summary

Functions

Renders a table cell. See the module doc.

Functions

pp_table_cell(assigns)

Renders a table cell. See the module doc.

Attributes

  • paperize (:boolean) - Defaults to true.
  • variant (:string) - Defaults to "body". Must be one of "head", or "body".
  • align (:string) - Defaults to "left". Must be one of "left", "center", or "right".
  • sortable (:boolean) - renders a clickable sort-direction arrow — only meaningful with variant="head". Defaults to false.
  • sort_direction (:string) - nil (sortable but inactive) | "asc" | "desc" — only meaningful with sortable. Defaults to nil.

  • class (:any) - Defaults to nil.
  • Global attributes are accepted. Supports all globals plus: ["colspan", "rowspan"].

Slots

  • inner_block (required)