Internal ID software / Data
Table
A data table with hairlines between the rows, numbers right aligned, and its own sideways scroll.
Not drawn in Figma: built only from the tokens, for internal ID software. In code: components/software/table.tsx. From the old system: Table in @id-identity-as/ui/commerce.
Example
| Ordre | Oprettet af | Status | Linjer |
|---|---|---|---|
| Eksempel 1001 | Medarbejder A | 12 | |
| Eksempel 1002 | Medarbejder B | I gang | 4 |
| Eksempel 1003 | Medarbejder C | Kladde | 1.240 |
| Ordre | Oprettet af | Status | Linjer |
|---|---|---|---|
| Eksempel 1001 | Medarbejder A | 12 | |
| Eksempel 1002 | Medarbejder B | I gang | 4 |
| Eksempel 1003 | Medarbejder C | Kladde | 1.240 |
import { Table } from '@/components/software/table';
<Table
caption="Ordrelinjer"
rowHeader="sku"
columns={[
{ key: 'sku', header: 'Varenr.' },
{ key: 'name', header: 'Produkt' },
{ key: 'quantity', header: 'Antal', align: 'end' },
]}
rows={lines}
/>Props
| Prop | Type | Default | What it does |
|---|---|---|---|
caption (required) | string | What the table holds. Shown above it and read aloud as its name. | |
captionHidden | boolean | false | Hides the caption from the eye when a heading right above already says it. |
columns (required) | TableColumn[] | { key, header, align? }. align: 'end' is for numbers. | |
rows (required) | TableRow[] | One object per row, with a cell for each column key. Numbers come in formatted. | |
rowHeader | string | The key of the column that names each row. Its cells become row headers. |
Do
- Right align numbers with align: 'end'. They are set in tabular figures.
- Name the row with rowHeader, such as the order number.
- Paginate a long list with Pagination.
Do not
- Do not draw a full grid or stripe the rows. Hairlines only.
- Do not use a table for layout.
- Do not leave an empty table. Show an EmptyState.
Accessibility
- A real table with a caption, column headers and, with rowHeader, row headers.
- The frame scrolls sideways and can take focus, so a keyboard reaches the columns off screen.
Tokens it uses
- color.border.default
- color.text.default
- type.body.sm
- type.heading.sm
- type.heading.md
- space.inline.2
- space.inline.3