Skip to content

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

Ordrer, eksempeldata
OrdreOprettet afStatusLinjer
Eksempel 1001Medarbejder AAfventer godkendelse12
Eksempel 1002Medarbejder BI gang4
Eksempel 1003Medarbejder CKladde1.240
Ordrer, eksempeldata
OrdreOprettet afStatusLinjer
Eksempel 1001Medarbejder AAfventer godkendelse12
Eksempel 1002Medarbejder BI gang4
Eksempel 1003Medarbejder CKladde1.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

PropTypeDefaultWhat it does
caption (required)stringWhat the table holds. Shown above it and read aloud as its name.
captionHiddenbooleanfalseHides 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.
rowHeaderstringThe 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