Data table
A table with the parts every list screen needs already decided: sorting, loading, the empty state, selection, pinning, column visibility and cursor paging. It is built on the table primitives rather than replacing them, and it owns none of your domain: a status badge or a masked account number stays a cell renderer in your app.
Reach for it
Sorting, selection, pinning, pagination or infinite scroll over rows.
Not for
A layout that happens to be grid-shaped. Reach for the Table primitives.
Columns and sorting
Columns are TanStack column definitions, so anything TanStack can do a column can do. The sort affordance is always visible rather than appearing on hover, because a control that appears on hover cannot be reached by keyboard or found by anyone scanning the header. A column that sets enableSorting false renders a plain header instead of a button that promises an action it will not perform.
| Status | |||
|---|---|---|---|
| INV-1042 | Mooncard SAS | pending | 12 480,00 € |
| INV-1043 | Acme SAS | paid | 980,50 € |
| INV-1044 | Globex Industrial Holdings and Logistics International | overdue | 4 200,00 € |
| INV-1045 | Initech | paid | 15 600,00 € |
| INV-1046 | Umbrella Santé | pending | 320,00 € |
Loading
Skeleton rows mirror the real columns, so nothing moves when the data lands. The table also reports aria-busy, which is what tells a screen reader to wait rather than read out a grid of empty cells.
| Status | |||
|---|---|---|---|
| INV-1042 | Mooncard SAS | pending | 12 480,00 € |
| INV-1043 | Acme SAS | paid | 980,50 € |
| INV-1044 | Globex Industrial Holdings and Logistics International | overdue | 4 200,00 € |
| INV-1045 | Initech | paid | 15 600,00 € |
| INV-1046 | Umbrella Santé | pending | 320,00 € |
Empty
The empty state is a required prop, so a table cannot ship without one. It appears only once loading has finished: an empty table mid-load tells the user there is nothing when nobody knows yet.
No invoices match these filters.
Column widths
Sizes are pixel numbers, and declaring any of them switches the table to a fixed layout. That is what makes them mean anything: under the browser default the widest cell wins whatever you asked for. A column that declares nothing takes 150, and below the total width the table scrolls rather than squeezing.
| INV-1042 | Mooncard SAS | France | 12 480,00 € |
| INV-1043 | Acme SAS | France | 980,50 € |
| INV-1044 | Globex Industrial Holdings and Logistics International | Belgium | 4 200,00 € |
| INV-1045 | Initech | Ireland | 15 600,00 € |
| INV-1046 | Umbrella Santé | France | 320,00 € |
Long text
A text column is one line with an ellipsis, and the full value stays on the cell as its title, because truncation that throws the value away is data loss. Title rather than a tooltip: a tooltip needs a focusable trigger, and one in every cell would add hundreds of tab stops to a table nobody wants to tab through.
| INV-1042 | Mooncard SAS | Jeanne Dupont |
| INV-1043 | Acme SAS | Paul Marchand |
| INV-1044 | Globex Industrial Holdings and Logistics International | Sofia Meyer |
| INV-1045 | Initech | Liam Byrne |
| INV-1046 | Umbrella Santé | Jeanne Dupont |
Amounts
Intl.NumberFormat, with the locale and the currency both required. Neither is defaulted, because a default would print some callers' numbers wrong and a wrong number is the kind of bug nobody reports. Right-aligned in lining figures, so a column of them lines up.
| INV-1042 | 12 480,00 € | $12,480.00 | ¥12,480 |
| INV-1043 | 980,50 € | $980.50 | ¥981 |
| INV-1044 | 4 200,00 € | $4,200.00 | ¥4,200 |
| INV-1045 | 15 600,00 € | $15,600.00 | ¥15,600 |
| INV-1046 | 320,00 € | $320.00 | ¥320 |
Dates
Intl.DateTimeFormat, from the locale you declare. The same instant is written three ways here, because 05/06/2023 is 5 June in Paris and 6 May in New York, and a format string would push that decision onto every call site. A missing date renders the label you passed rather than throwing.
| INV-1042 | 03/03/2026 | 3 March 2026 | Mar 12, 2026 |
| INV-1043 | 19/02/2026 | 19 February 2026 | Mar 1, 2026 |
| INV-1044 | 30/01/2026 | 30 January 2026 | Feb 14, 2026 |
| INV-1045 | 01/03/2026 | 1 March 2026 | No due date |
| INV-1046 | 05/03/2026 | 5 March 2026 | Mar 20, 2026 |
Selection
Selection reports records rather than row indices, so you never map back to your own data. The bulk bar appears only once something is selected: a row of permanently disabled buttons teaches nobody what enables them. A selected row says so with aria-selected, not only in colour.
Select a row to act on it
| INV-1042 | Mooncard SAS | 12 480,00 € | |
| INV-1043 | Acme SAS | 980,50 € | |
| INV-1044 | Globex Industrial Holdings and Logistics International | 4 200,00 € | |
| INV-1045 | Initech | 15 600,00 € | |
| INV-1046 | Umbrella Santé | 320,00 € |
Rows that lead somewhere
getRowHref puts a real anchor in the cells rather than a click handler on the row, so middle click, open in a new tab and copy link address all work. A row intent marks the state of a record, and it is an intent rather than a colour, so the theme decides what it looks like.
Pinned columns
Pinning is logical rather than physical: start is the left edge in a left-to-right layout and the right edge in a right-to-left one. Offsets come from the column sizes, so a second pinned column rests against the first instead of on top of it, and pinned cells take their colour from the row so a selected row keeps it underneath them.
Scroll sideways. The reference and the actions stay, and a toned or selected row keeps its colour underneath them.
| Status | Actions | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| INV-1042 | Mooncard SAS | France | Jeanne Dupont | pending | 03/03/2026 | 12/03/2026 | 12 480,00 € | ||
| INV-1043 | Acme SAS | France | Paul Marchand | paid | 19/02/2026 | 01/03/2026 | 980,50 € | ||
| INV-1044 | Globex Industrial Holdings and Logistics International | Belgium | Sofia Meyer | overdue | 30/01/2026 | 14/02/2026 | 4 200,00 € | ||
| INV-1045 | Initech | Ireland | Liam Byrne | paid | 01/03/2026 | No due date | 15 600,00 € | ||
| INV-1046 | Umbrella Santé | France | Jeanne Dupont | pending | 05/03/2026 | 20/03/2026 | 320,00 € |
Hiding columns
Optional, and its absence renders no button at all: a three-column table does not need one and a wide back-office table is unreadable without it. Columns can start hidden, which is the case that has to be discoverable, since a user who cannot see a column has no reason to believe the data is there. The checkbox column cannot be hidden, because that would strand whatever is already selected.
| Status | |||||
|---|---|---|---|---|---|
| INV-1042 | Mooncard SAS | pending | 03/03/2026 | 12/03/2026 | 12 480,00 € |
| INV-1043 | Acme SAS | paid | 19/02/2026 | 01/03/2026 | 980,50 € |
| INV-1044 | Globex Industrial Holdings and Logistics International | overdue | 30/01/2026 | 14/02/2026 | 4 200,00 € |
| INV-1045 | Initech | paid | 01/03/2026 | No due date | 15 600,00 € |
| INV-1046 | Umbrella Santé | pending | 05/03/2026 | 20/03/2026 | 320,00 € |
The toolbar
One slot above the table, not a filters prop and a search prop and a primary action prop. Filtering happens in your app, where the data is, which is also what stops this component growing a prop per screen.
| INV-1042 | Mooncard SAS | Jeanne Dupont |
| INV-1043 | Acme SAS | Paul Marchand |
| INV-1044 | Globex Industrial Holdings and Logistics International | Sofia Meyer |
| INV-1045 | Initech | Liam Byrne |
| INV-1046 | Umbrella Santé | Jeanne Dupont |
Row actions
A menu, not a select: these fire actions rather than holding a value. Name the trigger per row, because three dots with no accessible name is announced as button and nothing else.
| Actions | |||
|---|---|---|---|
| INV-1042 | Mooncard SAS | 12 480,00 € | |
| INV-1043 | Acme SAS | 980,50 € | |
| INV-1044 | Globex Industrial Holdings and Logistics International | 4 200,00 € | |
| INV-1045 | Initech | 15 600,00 € | |
| INV-1046 | Umbrella Santé | 320,00 € |
Cursor paging
Against a real API, where the next page is an opaque cursor the server hands back rather than a number the client computes. Load more runs in button mode here, because auto-fetching under someone who is reading is the wrong default for a table. A failed request says so instead of showing an empty table that pretends the API had nothing.
API reference
DataTable
| Prop | Type | Default | Description |
|---|---|---|---|
| columns* | DataTableColumn<Data>[] | - | |
| data* | Data[] | undefined | - | |
| label* | string | - | Names the table for assistive technology. |
| emptyState* | ReactNode | - | Shown when there is no data and nothing is loading. Always passed in. |
| loadingLabel* | string | - | Announced while busy. Passed in: the package ships no copy. |
| isLoading | boolean | - | |
| skeletonRows | number | - | Skeleton rows drawn while loading, so the layout does not jump. |
| loadMore | DataTableLoadMore | - | |
| onSortChange | (sorting: SortingState) => void | - | |
| initialSorting | SortingState | - | |
| onRowClick | (row: Data) => void | - | |
| getRowHref | (row: Data) => string | undefined | - | |
| getRowIntent | (row: Data) => 'default' | 'muted' | 'success' | 'warning' | 'danger' | - | A semantic intent per row. An intent, never a class. |
| selection | { selectedRows: Data[]; onSelectionChange: (rows: Data[]) => void; selectLabel: string; selectAllLabel: string } | - | Row selection. `getRowId` is required with it. |
| getRowId | (row: Data) => string | - | |
| columnVisibility | { label: string; initialHidden?: string[] } | - | A control for hiding columns. Optional, and its absence renders no button at all. A three-column table does not need one, and a wide back-office table is unreadable without it. |
| action | ReactNode | - | Rendered above the table, for filters, a bulk action bar or a primary action. |