Skip to content

Content

Table

Data table with caption, column and row headers and optional sorting. Scrolls in its own region when too wide.

  • Ready
  • Keyboard tested
  • Screen reader not tested yet

Updated 2026-11-12

Playground

Change the props. The controls come from the documented props.
Radius scale
radius.sm4
radius.md8
radius.lg16
tsx
<Table
  caption="Radius scale"
  rowKey="token"
  columns={[
    { key: "token", header: "Token", sortable: true },
    { key: "pixels", header: "Pixels", numeric: true, sortable: true },
  ]}
  rows={[
    { token: "radius.sm", pixels: 4 },
    { token: "radius.md", pixels: 8 },
    { token: "radius.lg", pixels: 16 },
  ]}
/>

Usage

When to use

Use a table for data that people compare across rows and columns: lists of records, token values, test results.

When not to use

  • For layout.
  • For a few facts about one thing: use DescriptionList.
  • When there are no rows: use EmptyState instead of headers without content.

How it works

Every table has a caption, visible or for screen readers only. The first column names the row and is a row header. Numeric columns align right with tabular figures. Sortable columns get a button in the header, and the sort state is set as aria-sort. When the table is too wide, it scrolls in its own focusable region.

Content guidelines

The caption says what the table shows. Column headers are short nouns, with units in the header rather than in every cell.

Do and don’t

  • Client
    LVM Versicherung
    Role
    Lead designer
    DoA table for rows people compare; facts about one thing go in a DescriptionList.
    Case facts
    LabelValue
    ClientLVM Versicherung
    RoleLead designer
    Don’tA two-column table of label and value: there is nothing to compare.
Do
  • Mark number columns as numeric; they align right with tabular figures.
  • The first column names the row.
  • Link a row through its name (rowLink), so there is one clear target per row.
  • Use density="compact" for long lists people scan and compare (logs, many records); keep standard for short lists.
  • Offer selection only with at least one bulk action; name the action with what it does to how many (“Assign 3”).
Don’t
  • No tables for layout.
  • Don't make a column sortable when it holds JSX instead of text or numbers.
  • Don't make whole rows clickable; the name link is the target.
  • Don't use selection to pick one row for a detail view; link the row instead.
  • A destructive bulk action asks first and names the number of rows (Destructive confirmation).

Anatomy

The parts of the component and what each one does, as in the playground above.
  1. captionNames the table; visible or sr-only.
  2. header-cellth scope=col, optionally with a sort button.
  3. sort-buttonToggles ascending/descending; state on aria-sort.
  4. row-headerFirst cell of each row, th scope=row; a link with rowLink.
  5. groupOne tbody per group, opened by a th scope=rowgroup with the group name and count.
  6. scroll-regionNamed region that becomes focusable when it overflows.
  7. optionWith selectable: a checkbox before each row, named “Select <row name>”, and one for all shown rows (mixed when some are selected).
  8. actionsWith selectable: a bar above the table with “n of m selected” (live), the bulk actions and “Clear selection”.

Examples

Type-checked, and the same code goes into the AI manifest. Import: import { Table } from "@/ds";

Sortable with a number column

Spacing scale
Utility
spacing.2p-28
spacing.4p-416
spacing.8p-832
spacing.16p-1664

Caption for screen readers only

Type roles
RoleSize (token)Line height
text-headingfontSize.fluid.24-321.30
text-bodyfontSize.181.65
text-smallfontSize.141.60
Projects by decade
ProjectWork
2020s (3)
AyvensRebranding while running2025
LVM VersicherungDesign system & token architecture2021
OTTORelaunch of the OTTO app2020
2010s (3)
Deutsche BahnMobile UX & interaction design2017
JUKEStreaming app for movies & series2015
MediaMarktDesign system for two brands2014

Compact, with selection and a bulk action

Requests to assign
RequestClient
Request AClient C2026-11-12
Request BClient A2026-11-11
Request CClient F2026-11-10
Request DClient B2026-11-07

Props

Checked against the component's TypeScript type on every build.
Table props
NameTypeDefaultDescription
caption (required)string–Names the table and its scroll region.
captionHiddenbooleanfalseCaption for screen readers only.
columns (required)TableColumn<Row>[]–key, header, numeric, fractionDigits, sortable, firstDirection (descending first for dates and amounts).
rows (required)Row[]–Data rows; values are text, numbers or ReactNode.
rowKey (required)keyof Row–Column with a unique value per row.
groupBykeyof Row–Field that groups the rows; each group gets a header row with its count. Sorting happens within groups.
rowLinkkeyof Row–Field with each row's detail URL; the row header becomes a link.
density"standard" | "compact""standard"compact halves the vertical cell padding for long lists people scan; controls keep their size.
selectablebooleanfalseA checkbox per row and one for all shown rows, for actions on several rows at once.
selectedstring[]–Controlled selection (rowKey values as strings); use with onSelectedChange.
defaultSelectedstring[]–Selection at the start, when the table keeps it itself.
onSelectedChange(keys: string[]) => void–Called with the new selection.
bulkActionsReactNode | ((keys: string[]) => ReactNode)–Actions for the selected rows, in a bar above the table while something is selected; a function gets the selected keys (client components only).
defaultSort{ key: keyof Row; direction: "ascending" | "descending" }–Initial sort order.

Tokens used

Derived from the utility classes in the component's source. Copy a class with one click.
Tokens used by Table
TokenTierValueUtility
button.radiuscomponent9999px
choice.bordercomponent#8A8578
choice.checkedcomponent#0A0A0B
choice.markcomponent#FAFAF7
choice.radiuscomponent4px
choice.sizecomponent24px
input.bgcomponent#FAFAF7
input.radiuscomponent8px
table.bgcomponent#FFFFFF
table.bordercomponentrgba(10,10,11,0.08)
table.cellPaddingcomponent16px
table.cellPaddingCompactYcomponent8px
table.headerFgcomponent#555555
table.numeric.fontVariantNumericcomponenttabular-nums
table.radiuscomponent16px
table.rowSelectedBgcomponent#EFEDE6
focussemantic#C6492E
spacing.0semantic0px
spacing.1semantic4px
spacing.2semantic8px
spacing.3semantic12px
spacing.4semantic16px
surface.pagesemantic#FAFAF7
surface.subtlesemantic#E7E3DA
text.primarysemantic#0A0A0B
text.secondarysemantic#555555
type.small.sizesemantic14px
weight.mediumsemantic500
weight.regularsemantic400
weight.semiboldsemantic600

Accessibility

What is checked automatically on every build, and what a person has tested. Nothing is marked as tested unless it was.
Testing status by check
CheckHowStatus
axe-core rulesAutomated on every npm run check, at desktop and mobile widthRuns on every build
KeyboardAutomated Playwright test (scripts/keyboard.mjs)Tested
Screen readerManualNot tested yet

Keyboard

Table keyboard interactions
KeyAction
TabMoves to the next sort button, or to the scroll region when it overflows.
Enter / SpaceToggles the sort order of the focused column.
Arrow keysScroll the focused region.
SpaceWith selectable: checks or unchecks the focused row or all rows.

Semantics and focus

  • <caption> is required, visible or sr-only.
  • <th scope="col"> and scope="row" for the first column.
  • Sorting through a button in the header; the state is aria-sort on the <th>.
  • When too wide, the region becomes focusable and scrolls with the keyboard.
  • Groups are tbody elements opened by <th scope="rowgroup">, so screen readers announce the group with its rows.
  • Selection: native checkboxes named after the row; the all-rows box is mixed (indeterminate) when only some are selected. The count is a live status.
  • Selected rows get a quieter tone as support; the checkbox carries the state.

Contrast

Table contrast pairings
PairingRatio (x:1)MinimumStatus
text.primary on surface.page18.924.5Pass
text.primary on surface.card19.794.5Pass
text.secondary on surface.page7.134.5Pass
text.secondary on surface.card7.464.5Pass
text.onInverse on surface.inverse18.924.5Pass
border.control on surface.page3.523.0Pass
border.control on surface.card3.683.0Pass
focus on surface.page4.573.0Pass
focus on surface.card4.783.0Pass
text.primary on surface.subtle15.454.5Pass
text.primary on surface.sunken16.894.5Pass
text.secondary on surface.sunken6.364.5Pass
focus on surface.sunken4.083.0Pass
text.secondary on surface.subtle5.824.5Pass
surface.inverse on text.onInverse18.924.5Pass
surface.inverse on surface.subtle15.454.5Pass
border.control on surface.inverse5.383.0Pass