View Source Phoenix.WebComponent.Table (Phoenix.WebComponent v2.5.1)

Render table.

Link to this section Summary

Functions

Generates a table.

Link to this section Functions

Generates a table.

examples

Examples

<.wc_table rows={[
  %{
    name: "Shmi Skywalker",
    portrayal: "Pernilla August (Episodes I-II)

Voice: Pernilla August (The Clone Wars) "

  },
  %{
    name: "Luke Skywalker",
    portrayal: "Mark Hamill (Episodes IV-IX, The Mandalorian, The Book of Boba Fett), Aidan Barton (Episode III), Grant Feely (Obi-Wan Kenobi)

Body Doubles: Lukaz Leong (Episode IX), Max Lloyd-Jones (The Mandalorian), Graham Hamilton (The Book of Boba Fett)

Voice: Mark Hamill (Forces of Destiny) "}

  ]}>
  <:col let={r} label="Name">
    <%= r.name %>
  </:col>
  <:col let={r} label="Portrayal">
    <%= r.portrayal %>
  </:col>
</.wc_table>

attributes

Attributes

  • id - binary html attribute id

  • class - binary html attribute class

  • rows - list table data, data shape is a list of map

slots

Slots

  • col Each slot for render a column.

    attributes-1

    Attributes

    • label - binatry Render table column title line.

attributes-2

Attributes

  • id (:string) - html attribute id. Defaults to "".
  • class (:string) - html attribute class. Defaults to "".
  • rows (:list) - table data list. Defaults to [].

slots-1

Slots

  • col - render a column of table.

    Example

    <:col let={r} label="Name">
      <%= r.name %>
    </:col>