PhoenixDuskmoon.Component.Table (PhoenixDuskmoon v6.0.8)

View Source

Duskmoon UI Table Component

Summary

Functions

Generates a table.

Functions

dm_table(assigns)

Generates a table.

Examples

<.dm_table data={[
  %{
    name: "Shmi Skywalker",
    portrayal: "Pernilla August (Episodes I-II)"
  },
  %{
    name: "Luke Skywalker",
    portrayal: "Mark Hamill (Episodes IV-IX, The Mandalorian, The Book of Boba Fett)"}
  ]}
>
  <:caption>Skywalker House</:catption>
  <:col :let={r} label="Name" label_class="text-teal-600" class="text-teal-400">
    <%= r.name %>
  </:col>
  <:col :let={r} label="Portrayal">
    <%= r.portrayal %>
  </:col>
</.dm_table>

Attributes

  • id (:any) - html attribute id. Defaults to false.
  • class (:any) - html attribute class. Defaults to "".
  • border (:boolean) - show table border. Defaults to false.
  • data (:list) - table data list. Defaults to [].
  • stream (:boolean) - stream data. Defaults to false.

Slots

  • caption - render a caption of table.Example
    <:caption>
      Table information
    </:caption>
    Accepts attributes:
    • id (:any) - table caption id.
    • class (:any) - table caption class.
  • col - render a column of table.Example
    <:col :let={r} label="Name">
      <%= r.name %>
    </:col>
    Accepts attributes:
    • label (:string) - table column title.
    • label_class (:any) - table column title title.
    • class (:any) - table row column class.
  • expand - render a one column row after each row of table.Example
    <:expand :let={r} label="Name">
      <pre>
        <%= r.description %>
      </pre>
    </:expand>
    Accepts attributes:
    • id (:any) - table row expand id.
    • class (:any) - table row expand class.