Table

Displays structured data in rows and columns. Supports optional client-side sorting with accessible aria-sort indicators.

Basic

Status
1.1.1Non-text ContentApass
1.2.1Audio-only and Video-onlyAtodo
1.2.2Captions (Prerecorded)Afail
const columns = [
  { key: 'ref', header: 'Ref', render: (r) => r.ref },
  { key: 'name', header: 'Name', render: (r) => r.name },
];

<Table columns={columns} rows={rows} getRowKey={(r) => r.id} />

Sortable

Add a sortValue function to a column to make it sortable. Clicking the column header cycles through ascending → descending → default. aria-sort is applied to the header for screen reader users.

Status
1.1.1Non-text ContentApass
1.2.1Audio-only and Video-onlyAtodo
1.2.2Captions (Prerecorded)Afail
const columns = [
  { key: 'ref', header: 'Ref', sortValue: (r) => r.ref, render: (r) => r.ref },
  { key: 'name', header: 'Name', sortValue: (r) => r.name, render: (r) => r.name },
  { key: 'status', header: 'Status', render: (r) => r.status }, // not sortable
];

<Table columns={columns} rows={rows} getRowKey={(r) => r.id} />

Props

Prop Type Description
columns Column<T>[] Column definitions. Each has key, header, render, and optional sortValue (enables sorting for that column).
rows T[] Data rows.
getRowKey (row: T) => string Returns a unique key for each row (used as React key).
caption string Optional visible <caption> for screen readers.