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
| Character | Role | Organization | Status |
|---|---|---|---|
|
|
Delivery boy | Planet Express | Active |
|
|
Ship captain | Planet Express | Away |
|
|
Bending unit | Planet Express | Offline |
|
|
Engineering intern | Planet Express | Active |
|
|
Bureaucrat | Planet Express | Away |
|
|
Staff physician | Planet Express | Offline |
|
|
Scientist | Planet Express | Active |
|
|
Janitor | Planet Express | Away |
|
|
Ambassador | Planet Express | Offline |
|
|
Starship captain | DOOP | Active |
|
|
Lieutenant | DOOP | Away |
|
|
Chief executive | MomCorp | Offline |
|
|
Actor | Entertainment | Active |
|
|
News anchor | Entertainment | Away |
|
|
Chef | Entertainment | Offline |
|
|
Ruler | Omicron Persei 8 | Active |
|
|
Ruler | Omicron Persei 8 | Away |
|
|
Musician | Robot community | Offline |
|
|
Gift inspector | Robot community | Active |
|
|
Patron of the arts | Robot community | Away |
|
|
Bending unit | Robot community | Offline |
|
|
Bank robber | Robot community | Active |
|
|
Robot Mafia boss | Robot community | Away |
|
|
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
|
— |