Docs

Cinder UI

DataDisplay.table

Server-rendered

Table wrapper with overflow container.

Minimal

heex title="Minimal table" <.table> <.table_header> <.table_row> <.table_head>Name</.table_head> </.table_row> </.table_header> </.table>

Character directory

24 crew members and contacts.
Character Role Organization Status
Philip J. Fry
Philip J. Fry
Delivery boy Planet Express Active
Turanga Leela
Turanga Leela
Ship captain Planet Express Away
Bender Rodríguez
Bender Rodríguez
Bending unit Planet Express Offline
Amy Wong
Amy Wong
Engineering intern Planet Express Active
Hermes Conrad
Hermes Conrad
Bureaucrat Planet Express Away
Dr. John Zoidberg
Dr. John Zoidberg
Staff physician Planet Express Offline
Professor Farnsworth
Professor Farnsworth
Scientist Planet Express Active
Scruffy
Scruffy
Janitor Planet Express Away
Nibbler
Nibbler
Ambassador Planet Express Offline
Zapp Brannigan
Zapp Brannigan
Starship captain DOOP Active
Kif Kroker
Kif Kroker
Lieutenant DOOP Away
Mom
Mom
Chief executive MomCorp Offline
Calculon
Calculon
Actor Entertainment Active
Morbo
Morbo
News anchor Entertainment Away
Elzar
Elzar
Chef Entertainment Offline
Lrrr
Lrrr
Ruler Omicron Persei 8 Active
Ndnd
Ndnd
Ruler Omicron Persei 8 Away
Robot Devil
Robot Devil
Musician Robot community Offline
Robot Santa
Robot Santa
Gift inspector Robot community Active
Hedonismbot
Hedonismbot
Patron of the arts Robot community Away
Flexo
Flexo
Bending unit Robot community Offline
Roberto
Roberto
Bank robber Robot community Active
Donbot
Donbot
Robot Mafia boss Robot community Away
Clamps
Clamps
Robot Mafia enforcer Robot community Offline
  <div class="max-h-96 overflow-y-auto">
  <.table>
    <.table_caption>{length(@characters)} crew members and contacts.</.table_caption>
    <.table_header>
      <.table_row>
        <.table_head>Character</.table_head>
        <.table_head>Role</.table_head>
        <.table_head>Organization</.table_head>
        <.table_head>Status</.table_head>
      </.table_row>
    </.table_header>
    <.table_body>
      <.table_row :for={character <- @characters}>
        <.table_cell>
          <div class="flex items-center gap-2">
            <.avatar size={:sm} src={character.avatar} alt={character.label} />
            <span class="font-medium">{character.label}</span>
          </div>
        </.table_cell>
        <.table_cell>{character.description}</.table_cell>
        <.table_cell>{character.group}</.table_cell>
        <.table_cell>
          <.badge variant={:outline} color={if character.status == :active, do: :success, else: :secondary}>
            {Phoenix.Naming.humanize(character.status)}
          </.badge>
        </.table_cell>
      </.table_row>
    </.table_body>
  </.table>
</div>

Invoice summary table

Invoice State Amount
INV-001 Paid $120.00
INV-002 Pending $48.00
Total $168.00
  <.table>
  <.table_header>
    <.table_row>
      <.table_head>Invoice</.table_head>
      <.table_head>State</.table_head>
      <.table_head class="text-right">Amount</.table_head>
    </.table_row>
  </.table_header>
  <.table_body>
    <.table_row>
      <.table_cell>INV-001</.table_cell>
      <.table_cell>Paid</.table_cell>
      <.table_cell class="text-right">$120.00</.table_cell>
    </.table_row>
    <.table_row state="selected">
      <.table_cell>INV-002</.table_cell>
      <.table_cell>Pending</.table_cell>
      <.table_cell class="text-right">$48.00</.table_cell>
    </.table_row>
  </.table_body>
  <.table_footer>
    <.table_row>
      <.table_cell class="font-medium" colspan="2">Total</.table_cell>
      <.table_cell class="text-right font-medium">$168.00</.table_cell>
    </.table_row>
  </.table_footer>
</.table>

Minimal table

Name
  <.table>
  <.table_header>
    <.table_row>
      <.table_head>Name</.table_head>
    </.table_row>
  </.table_header>
</.table>

Attributes

Name Type Default Values Global Includes
class :string — — —
rest :global — — —

Slots

Slot Slot Attributes
inner_block Required —