Content
- Write headers as short nouns in Title Case: Site, Last Reading.
- Put the unit in the header, so cells hold only the figure: Soil %.
- Give every value in a column the same decimal places.
Shows rows of readings, devices or records, with sorting, selection and three densities.
Change the density and the ground, then click a header to sort.
<TableRoot density="default">
<Table minWidth={520}>
<TableHeader>…</TableHeader>
<TableBody>
<TableRow>
<TableCell>Bore 12</TableCell>
<TableCell numeric tone="bad">−15.9</TableCell>
</TableRow>
</TableBody>
</Table>
</TableRoot>Set striped, bordered and interactive once on TableBody, so every row matches.
<TableRoot density="default">
<Table>
<TableColgroup><TableCol width="15%" /></TableColgroup>
<TableHeader>
<TableRow><TableHead numeric>Soil %</TableHead></TableRow>
</TableHeader>
<TableBody striped interactive>…</TableBody>
<TableFooter>…</TableFooter>
</Table>
</TableRoot>Click a header, then tick some rows.
No rows selected · 6 shown
Tone a cell when the number is the finding, such as the gap to target.
Pass an empty state to empty on TableRoot. The header stays.
A sortable header announces the order it will switch to. Name each row’s checkbox after the row, and announce the selected count.
| Key | What it does |
|---|---|
| Tab | Moves through sort headers, select-all and row checkboxes. |
| Enter / Space | Changes the sort, or ticks a row’s checkbox. |
| Prop | Type | Default | Description |
|---|---|---|---|
| TableRoot density | 'compact' | 'default' | 'comfortable' | 'default' | Row height: 32, 40 or 48px. |
| TableRoot maxHeight | number | — | Scrolls rows under a sticky header. |
| TableRoot empty | ReactNode | — | Shown under the header. |
| Table selectable | boolean | false | Sets aria-selected on rows. TableCheck announces the state. |
| Table minWidth | number | — | Scrolls sideways below this width. |
| TableCol width | number | string | — | Column width, in px or percent. |
| TableBody striped | boolean | false | Shades every second row. |
| TableBody bordered | boolean | false | Rules between rows and cells. |
| TableBody interactive | boolean | false | Hover ground for clickable rows. |
| TableRow selected | boolean | false | Blue tint and a 3px start bar. |
| TableRow onClick | () => void | — | Pointer shortcut. Pair with TableCheck. |
| TableHead sort | 'asc' | 'desc' | 'none' | — | Sets the caret and aria-sort. |
| TableHead onSort | () => void | — | Makes the whole header cell a sort button. |
| TableHead label | string | — | Sort button name when children aren’t text. |
| TableHead numeric | boolean | false | Right-aligns the label. |
| TableCell numeric | boolean | false | Right-aligns, with tabular figures. |
| TableCell tone | 'ok' | 'note' | 'act' | 'bad' | 'live' | 'idle' | — | Colours the value as a finding. |
| TableCell muted | boolean | false | Secondary ink. |
| TableCheck checked | boolean | — | The ticked state. |
| TableCheck onToggle | () => void | — | Runs on click, Enter or Space. |
| TableCheck label | string | — | Accessible name, such as “Select Bore 12”. |
| TableCheck indeterminate | boolean | false | Dash for a partial selection. |
| Token | Value | Where it lands |
|---|---|---|
| --spacing-8 / -10 / -12 | 32 / 40 / 48px | Row heights. |
| --spacing-3 | 12px | Cell padding, left and right. |
| --font-size-md | 13px | Cell values. |
| --font-size-sm | 12px | Column headers. |
| --font-weight-medium | 475 | Headers and numbers. |
| --color-grey-100 | #F5F5F5 | Striped rows, header hover. |
| --color-grey-200 | #F1F1F1 | Row hover. |
| --color-primary-light | #EBFAFF | Selected row. |
| --color-primary-active | #1877F2 | Selected bar, active caret, focus ring. |
| --global-neutral-grey-900 | #7F7D83 | Sort caret at rest. |
| --color-grey-300 | #ECECED | Cell rules when bordered. |
| --color-border-default | #E6E6E6 | Outer hairline and header rule. |
| --radius-lg | 8px | Outer corners. |