Table
Displays structured data in rows and columns. Supports optional client-side sorting with
accessible aria-sort indicators.
Basic Ref⇅ Name⇅ Level⇅ Status 1.1.1 Non-text Content A pass 1.2.1 Audio-only and Video-only A todo 1.2.2 Captions (Prerecorded) A fail
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.
Ref⇅ Name⇅ Level⇅ Status 1.1.1 Non-text Content A pass 1.2.1 Audio-only and Video-only A todo 1.2.2 Captions (Prerecorded) A fail
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.