Display
Table
Semantic table for lists with several columns, such as invoices or DNS records. Statix tables sit inside a card, with 56px rows separated by hairlines.
import * as Table from '@statix/ui/table';Examples
Invoices in a card
Number, date, amount, a status badge and a download button. Card.Content gets px-3 so the cell padding lines up with the card title.
Download invoices and see your payments.
| Invoice | Date | Amount | Status | Download |
|---|---|---|---|---|
| RE-2026-0142 | 1 Nov 2026 | €24.90 | Open | |
| RE-2026-0128 | 1 Oct 2026 | €24.90 | Paid | |
| RE-2026-0113 | 1 Sep 2026 | €36.80 | Paid | |
| RE-2026-0097 | 1 Aug 2026 | €24.90 | Overdue |
<script lang="ts">
import * as Card from '@statix/ui/card';
import * as Table from '@statix/ui/table';
import { Badge } from '@statix/ui/badge';
import { Button } from '@statix/ui/button';
import DownloadIcon from '@lucide/svelte/icons/download';
const invoices = [
{ number: 'RE-2026-0142', date: '1 Nov 2026', amount: '€24.90', status: 'open' },
{ number: 'RE-2026-0128', date: '1 Oct 2026', amount: '€24.90', status: 'paid' },
{ number: 'RE-2026-0113', date: '1 Sep 2026', amount: '€36.80', status: 'paid' },
{ number: 'RE-2026-0097', date: '1 Aug 2026', amount: '€24.90', status: 'overdue' }
] as const;
const status = {
open: { label: 'Open', variant: 'accent' },
paid: { label: 'Paid', variant: 'success' },
overdue: { label: 'Overdue', variant: 'destructive' }
} as const;
</script>
<Card.Root class="w-full">
<Card.Header>
<Card.Title>Invoices</Card.Title>
<Card.Description>Download invoices and see your payments.</Card.Description>
</Card.Header>
<Card.Content class="px-3">
<Table.Root>
<Table.Caption class="sr-only">Invoices for yoga-berger.de</Table.Caption>
<Table.Header>
<Table.Row>
<Table.Head>Invoice</Table.Head>
<Table.Head>Date</Table.Head>
<Table.Head class="text-right">Amount</Table.Head>
<Table.Head>Status</Table.Head>
<Table.Head><span class="sr-only">Download</span></Table.Head>
</Table.Row>
</Table.Header>
<Table.Body>
{#each invoices as invoice (invoice.number)}
<Table.Row>
<Table.Cell class="font-medium">{invoice.number}</Table.Cell>
<Table.Cell class="text-ink-2">{invoice.date}</Table.Cell>
<Table.Cell class="text-right tabular-nums">{invoice.amount}</Table.Cell>
<Table.Cell>
<Badge size="sm" variant={status[invoice.status].variant} dot>
{status[invoice.status].label}
</Badge>
</Table.Cell>
<Table.Cell class="w-0 text-right">
<Button variant="ghost" size="icon-sm" aria-label="Download invoice {invoice.number}">
<DownloadIcon />
</Button>
</Table.Cell>
</Table.Row>
{/each}
</Table.Body>
</Table.Root>
</Card.Content>
</Card.Root>Basic
Header, body, caption and footer with a total.
| Domain | Renews on | Price |
|---|---|---|
| yoga-berger.de | 14 Jan 2027 | €12.00 |
| yoga-berger.com | 3 Mar 2027 | €18.00 |
| berger-yoga.de | 30 Nov 2026 | €12.00 |
| Total per year | €42.00 | |
<script lang="ts">
import * as Table from '@statix/ui/table';
</script>
<Table.Root class="max-w-xl">
<Table.Caption>Domains in your contract. Prices per year.</Table.Caption>
<Table.Header>
<Table.Row>
<Table.Head>Domain</Table.Head>
<Table.Head>Renews on</Table.Head>
<Table.Head class="text-right">Price</Table.Head>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>yoga-berger.de</Table.Cell>
<Table.Cell>14 Jan 2027</Table.Cell>
<Table.Cell class="text-right tabular-nums">€12.00</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>yoga-berger.com</Table.Cell>
<Table.Cell>3 Mar 2027</Table.Cell>
<Table.Cell class="text-right tabular-nums">€18.00</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>berger-yoga.de</Table.Cell>
<Table.Cell>30 Nov 2026</Table.Cell>
<Table.Cell class="text-right tabular-nums">€12.00</Table.Cell>
</Table.Row>
</Table.Body>
<Table.Footer>
<Table.Row>
<Table.Cell colspan={2}>Total per year</Table.Cell>
<Table.Cell class="text-right tabular-nums">€42.00</Table.Cell>
</Table.Row>
</Table.Footer>
</Table.Root>Selected rows
Set data-state="selected" on a row to tint it, here driven by a checkbox per row.
| Select | Type | Name | Value |
|---|---|---|---|
| A | @ | 194.126.80.12 | |
| CNAME | www | yoga-berger.de | |
| MX | @ | mx1.statix.de |
<script lang="ts">
import * as Table from '@statix/ui/table';
const records = [
{ id: 'a', type: 'A', name: '@', value: '194.126.80.12' },
{ id: 'www', type: 'CNAME', name: 'www', value: 'yoga-berger.de' },
{ id: 'mx', type: 'MX', name: '@', value: 'mx1.statix.de' }
];
let selected = $state<string[]>(['www']);
</script>
<Table.Root class="max-w-xl">
<Table.Caption>DNS records for yoga-berger.de</Table.Caption>
<Table.Header>
<Table.Row>
<Table.Head class="w-0"><span class="sr-only">Select</span></Table.Head>
<Table.Head>Type</Table.Head>
<Table.Head>Name</Table.Head>
<Table.Head>Value</Table.Head>
</Table.Row>
</Table.Header>
<Table.Body>
{#each records as record (record.id)}
<Table.Row data-state={selected.includes(record.id) ? 'selected' : undefined}>
<Table.Cell>
<input
type="checkbox"
class="size-4 accent-primary"
aria-label="Select {record.type} record {record.name}"
value={record.id}
bind:group={selected}
/>
</Table.Cell>
<Table.Cell class="font-medium">{record.type}</Table.Cell>
<Table.Cell class="font-mono text-label">{record.name}</Table.Cell>
<Table.Cell class="font-mono text-label">{record.value}</Table.Cell>
</Table.Row>
{/each}
</Table.Body>
</Table.Root>Guidelines
Do
- Right-align numbers and amounts, in both the header and the cells.
- Put actions in the last column and keep them to one icon button or a small button.
- Use a size="sm" Badge for status cells.
Don't
- Don’t use a table for one-column lists. Use Item rows.
- Don’t add zebra stripes or vertical lines. Hairlines between rows are enough.
Accessibility
- Renders a native <table>, so screen readers announce rows, columns and headers.
- Table.Head defaults to scope="col". Pass scope="row" for row headers in the body.
- Give the table a name with Table.Caption (use class="sr-only" to hide it) or aria-label.
- Icon buttons in cells need an aria-label that names the row: "Download invoice RE-2026-0142".
- The wrapper scrolls horizontally on narrow screens.
API reference
Table.Root
renders<table> and accepts its attributesWrapped in a div[data-slot="table-container"] that scrolls on overflow.
| Prop | Type | Default |
|---|---|---|
ref bind | HTMLTableElement | null The table element. | – |
class | ClassValue Merged with the base classes; yours win. | – |
| Data attribute | Meaning |
|---|---|
data-slot="table" | The table. |
data-slot="table-container" | The scroll wrapper. |
Table.Header
renders<thead> and accepts its attributesDraws a hairline under the header row.
| Data attribute | Meaning |
|---|---|
data-slot="table-header" | Always present. |
Table.Body
renders<tbody> and accepts its attributesThe last row has no bottom border.
| Data attribute | Meaning |
|---|---|
data-slot="table-body" | Always present. |
Table.Footer
renders<tfoot> and accepts its attributesMedium weight with a top hairline, for totals.
| Data attribute | Meaning |
|---|---|
data-slot="table-footer" | Always present. |
Table.Row
renders<tr> and accepts its attributesHairline below, faint hover fill.
| Data attribute | Meaning |
|---|---|
data-slot="table-row" | Always present. |
data-state="selected" | Set it yourself to tint the row. |
Table.Head
renders<th> and accepts its attributes44px high, text-label in muted.
| Prop | Type | Default |
|---|---|---|
scope | 'col' | 'row' | 'colgroup' | 'rowgroup' Which cells the header labels. | 'col' |
| Data attribute | Meaning |
|---|---|
data-slot="table-head" | Always present. |
Table.Cell
renders<td> and accepts its attributes56px high, 16px side padding, body text in ink.
| Data attribute | Meaning |
|---|---|
data-slot="table-cell" | Always present. |
Table.Caption
renders<caption> and accepts its attributesSmall muted text below the table.
| Data attribute | Meaning |
|---|---|
data-slot="table-caption" | Always present. |