Skip to content
Statix Design System

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.

Invoices

Download invoices and see your payments.

Invoices for yoga-berger.de
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.

Domains in your contract. Prices per year.
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.

DNS records for yoga-berger.de
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 attributes

Wrapped in a div[data-slot="table-container"] that scrolls on overflow.

PropTypeDefault
ref bindHTMLTableElement | null

The table element.

–
class ClassValue

Merged with the base classes; yours win.

–
Data attributeMeaning
data-slot="table"The table.
data-slot="table-container"The scroll wrapper.

Table.Header

renders <thead> and accepts its attributes

Draws a hairline under the header row.

Data attributeMeaning
data-slot="table-header"Always present.

Table.Body

renders <tbody> and accepts its attributes

The last row has no bottom border.

Data attributeMeaning
data-slot="table-body"Always present.

Table.Footer

renders <tfoot> and accepts its attributes

Medium weight with a top hairline, for totals.

Data attributeMeaning
data-slot="table-footer"Always present.

Table.Row

renders <tr> and accepts its attributes

Hairline below, faint hover fill.

Data attributeMeaning
data-slot="table-row"Always present.
data-state="selected"Set it yourself to tint the row.

Table.Head

renders <th> and accepts its attributes

44px high, text-label in muted.

PropTypeDefault
scope 'col' | 'row' | 'colgroup' | 'rowgroup'

Which cells the header labels.

'col'
Data attributeMeaning
data-slot="table-head"Always present.

Table.Cell

renders <td> and accepts its attributes

56px high, 16px side padding, body text in ink.

Data attributeMeaning
data-slot="table-cell"Always present.

Table.Caption

renders <caption> and accepts its attributes

Small muted text below the table.

Data attributeMeaning
data-slot="table-caption"Always present.