Table

Rows of records with the same fields, for reading across and comparing down. A rounded frame with lines between rows by default; a grid for data; plain inside a card.

Playground

Sort by a column, tick rows, scroll sideways past the pinned columns and down under the header.

Time Status
HF-1 08:12 48,27,8433,918,620,411,12 Published
HF-2 08:47 62,57,7134,028,480,380,98 Published
HF-3 09:20 31,08,0533,648,810,551,46 In review
Kvamsøy 09:58 120,47,3234,387,950,290,61 Published
Norheimsund 11:05 54,37,9033,888,550,471,21 In review
Tørvikbygd 12:16 76,17,5834,128,270,360,86 Published
Øystese 11:42 41,98,1133,598,900,621,58 Published
Ålvik 10:31 88,77,4834,218,120,330,77 Flagged
Variant
Size

2 of 8 selected

<Table variant="grid" stickyHeader class="max-h-64">
	<TableHeader>
		<TableRow>
			<TableHead shrink pin="start"><Checkbox … /></TableHead>
			<TableHead pin="start" sort="asc" onSort={…}>Waypoint</TableHead>
			<TableHead numeric>Depth (m)</TableHead>
			…
		</TableRow>
	</TableHeader>
	<TableBody>
		{#each casts as cast (cast.id)}
			<TableRow selected={…}>
				…
				<TableCell numeric>{cast.depth}</TableCell>
			</TableRow>
		{/each}
	</TableBody>
</Table>

Bordered

The default: a list where each row opens something. The row lights up on hover because it has an onclick.

Date Project Vessel Waypoints Status
3. mars Hardangerfjorden 2026 USV Bris 12 Completed
17. mars Hardangerfjorden 2026 USV Bris 12 Completed
2. april Starefoss ledning USV Kuling 6 Scheduled
9. april Starefoss ledning USV Kuling 6 Scheduled

Click a row.

<Table>
	<TableHeader>
		<TableRow>
			<TableHead>Date</TableHead>
			<TableHead>Project</TableHead>
			<TableHead numeric>Waypoints</TableHead>
		</TableRow>
	</TableHeader>
	<TableBody>
		{#each missions as mission (mission.id)}
			<TableRow onclick={() => open(mission)}>…</TableRow>
		{/each}
	</TableBody>
</Table>

Grid with totals

The data table: a line per column, numbers right-aligned in tabular figures. Totals go in a TableFooter.

Waypoint Depth (m) Temp. (°C) Salinity (PSU)
HF-1 48,2 7,84 33,91
HF-2 62,5 7,71 34,02
HF-3 31,0 8,05 33,64
Kvamsøy 120,4 7,32 34,38
Average 65,57,7333,99

Plain

Inside a card or a sheet: no frame of its own, the container is the frame.

Fuel

Date Litres
3. mars42
17. mars38
2. april45

Sticky header on the page

StickyTable: scroll the page and the header stays under the top bar; scroll sideways and both move together. The waypoint stays pinned.

Waypoint Time Depth (m)Temp. (°C)Salinity (PSU)Oxygen (mg/l)Turbidity (NTU)Chl a (µg/l) Status
HF-1 08:00 48,27,8433,918,620,411,12 Published
HF-2 08:09 63,07,7134,028,480,380,98 Published
HF-3 08:18 32,08,0533,648,810,551,46 In review
Kvamsøy 08:27 121,97,3234,387,950,290,61 Published
Ålvik 08:36 90,77,4834,218,120,330,77 Flagged
Norheimsund 08:45 54,37,9033,888,550,471,21 In review
Øystese 08:54 42,48,1133,598,900,621,58 Published
Tørvikbygd 09:03 77,17,5834,128,270,360,86 Published
HF-1 09:12 49,77,8433,918,620,411,12 Published
HF-2 09:21 64,57,7134,028,480,380,98 Published
HF-3 09:30 31,08,0533,648,810,551,46 In review
Kvamsøy 09:39 120,97,3234,387,950,290,61 Published
Ålvik 09:48 89,77,4834,218,120,330,77 Flagged
Norheimsund 09:57 55,87,9033,888,550,471,21 In review
Øystese 10:06 43,98,1133,598,900,621,58 Published
Tørvikbygd 10:15 76,17,5834,128,270,360,86 Published
HF-1 10:24 48,77,8433,918,620,411,12 Published
HF-2 10:33 63,57,7134,028,480,380,98 Published
HF-3 10:42 32,58,0533,648,810,551,46 In review
Kvamsøy 10:51 122,47,3234,387,950,290,61 Published
Ålvik 11:00 88,77,4834,218,120,330,77 Flagged
Norheimsund 11:09 54,87,9033,888,550,471,21 In review
Øystese 11:18 42,98,1133,598,900,621,58 Published
Tørvikbygd 11:27 77,67,5834,128,270,360,86 Published
HF-1 11:36 50,27,8433,918,620,411,12 Published
HF-2 11:45 62,57,7134,028,480,380,98 Published
HF-3 11:54 31,58,0533,648,810,551,46 In review
Kvamsøy 12:03 121,47,3234,387,950,290,61 Published
Ålvik 12:12 90,27,4834,218,120,330,77 Flagged
Norheimsund 12:21 56,37,9033,888,550,471,21 In review
Øystese 12:30 41,98,1133,598,900,621,58 Published
Tørvikbygd 12:39 76,67,5834,128,270,360,86 Published
HF-1 12:48 49,27,8433,918,620,411,12 Published
HF-2 12:57 64,07,7134,028,480,380,98 Published
HF-3 13:06 33,08,0533,648,810,551,46 In review
Kvamsøy 13:15 120,47,3234,387,950,290,61 Published
Ålvik 13:24 89,27,4834,218,120,330,77 Flagged
Norheimsund 13:33 55,37,9033,888,550,471,21 In review
Øystese 13:42 43,48,1133,598,900,621,58 Published
Tørvikbygd 13:51 78,17,5834,128,270,360,86 Published
<StickyTable variant="grid" columns={[140, 80, 130, …]}>
	{#snippet head()}
		<TableRow>
			<TableHead pin="start">Waypoint</TableHead>
			…
		</TableRow>
	{/snippet}
	{#snippet body()}
		{#each casts as cast (cast.id)}
			<TableRow><TableCell pin="start">{cast.waypoint}</TableCell>…</TableRow>
		{/each}
	{/snippet}
</StickyTable>

Which one

Bordered The default. A list of things that each open somewhere: missions, projects, members. A few columns that fit.
Grid The data table: measurements, logs, exports. Many columns of numbers read across and down, so every column gets a line. Dense by default.
Plain Inside a card, a sheet or a dialog, where the container is already the frame.
StickyTable A wide table on a long page, so the header follows you down while the columns scroll sideways. Column widths are fixed up front.
Not a table One record, or items with no shared fields to compare: a list of cards or rows. Editing many cells like a spreadsheet: the data grid (AG Grid).

Sticky headers

In its own box <Table stickyHeader class="max-h-96">. A panel or a dialog with a capped height. Scrolls both ways; pinned columns work.
On the page <Table stickyHeader="page">. A long table that fits the width. It can't scroll sideways, so only for columns that fit.
Wide, on the page StickyTable. Both at once, at the cost of fixed column widths.
Under a bar Pass stickyTop="top-14" (or the bar's height) when something is already pinned above.

Rules

  • Headers are short nouns with the unit in brackets: "Depth (m)", not "Depth in metres". Sentence case, never uppercase, in every variant.
  • Numbers are right-aligned in tabular figures (numeric), with the same number of decimals down a column, so they compare at a glance. Text and dates are left-aligned.
  • The first column says which record the row is: a name, a waypoint, a date. Give it font-medium. Secondary values, like a time or an owner, can be muted.
  • A missing value says so in the muted colour: "Not measured", "Unknown". Never a blank cell, "N/A" or a literal "null".
  • Put a row's own actions at the end, in a shrink column: one icon button, or a more menu for several. Actions on many rows at once go in a bar above the table, shown once rows are ticked.
  • A row that opens something gets an onclick and lights up on hover. Keep a real link in its first cell too, so it works with the keyboard and opens in a new tab.
  • Pin the column that names the row when the table scrolls sideways, and the checkbox column with it. Pin the end column for status or actions. One or two per side, never most of the table.
  • Sort when there are more rows than fit on a screen. Show the sorted column's arrow; start with the order people expect (newest first for dates).
  • While loading, draw the table it will be with TablePlaceholder state="loading", not a spinner in the middle, then give the arriving rows an enterIndex. Empty, lay an EmptyState over TablePlaceholder state="empty", saying why with a way forward. See Skeleton and Empty state.
  • Tick rows with RowSelection: Shift-click ticks the run from the last row clicked, in the order shown, and Escape clears. The header checkbox ticks the rows shown, not the ones a filter hides.
  • Name the table for screen readers with aria-label when no heading right above it says what it is.
  • Over a few hundred rows: give StickyTable items, a row snippet and virtual, so only the rows in view are rendered (see the CTD data example). Rows must be one line tall, and find in page only sees what's on screen. Editing cells in place, grouping or pivoting: that's the data grid, not this.