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-1042Mooncard SASpending12 480,00 €
INV-1043Acme SASpaid980,50 €
INV-1044Globex Industrial Holdings and Logistics Internationaloverdue4 200,00 €
INV-1045Initechpaid15 600,00 €
INV-1046Umbrella Santépending320,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-1042Mooncard SASpending12 480,00 €
INV-1043Acme SASpaid980,50 €
INV-1044Globex Industrial Holdings and Logistics Internationaloverdue4 200,00 €
INV-1045Initechpaid15 600,00 €
INV-1046Umbrella Santépending320,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-1042Mooncard SASFrance12 480,00 €
INV-1043Acme SASFrance980,50 €
INV-1044Globex Industrial Holdings and Logistics InternationalBelgium4 200,00 €
INV-1045InitechIreland15 600,00 €
INV-1046Umbrella SantéFrance320,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-1042Mooncard SASJeanne Dupont
INV-1043Acme SASPaul Marchand
INV-1044Globex Industrial Holdings and Logistics InternationalSofia Meyer
INV-1045InitechLiam Byrne
INV-1046Umbrella 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-104212 480,00 €$12,480.00¥12,480
INV-1043980,50 €$980.50¥981
INV-10444 200,00 €$4,200.00¥4,200
INV-104515 600,00 €$15,600.00¥15,600
INV-1046320,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-104203/03/20263 March 2026Mar 12, 2026
INV-104319/02/202619 February 2026Mar 1, 2026
INV-104430/01/202630 January 2026Feb 14, 2026
INV-104501/03/20261 March 2026No due date
INV-104605/03/20265 March 2026Mar 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-1042Mooncard SAS12 480,00 €
INV-1043Acme SAS980,50 €
INV-1044Globex Industrial Holdings and Logistics International4 200,00 €
INV-1045Initech15 600,00 €
INV-1046Umbrella 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.

StatusActions
INV-1042
Mooncard SASFranceJeanne Dupontpending03/03/202612/03/202612 480,00 €
INV-1043
Acme SASFrancePaul Marchandpaid19/02/202601/03/2026980,50 €
INV-1044
Globex Industrial Holdings and Logistics InternationalBelgiumSofia Meyeroverdue30/01/202614/02/20264 200,00 €
INV-1045
InitechIrelandLiam Byrnepaid01/03/2026No due date15 600,00 €
INV-1046
Umbrella SantéFranceJeanne Dupontpending05/03/202620/03/2026320,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-1042Mooncard SASpending03/03/202612/03/202612 480,00 €
INV-1043Acme SASpaid19/02/202601/03/2026980,50 €
INV-1044Globex Industrial Holdings and Logistics Internationaloverdue30/01/202614/02/20264 200,00 €
INV-1045Initechpaid01/03/2026No due date15 600,00 €
INV-1046Umbrella Santépending05/03/202620/03/2026320,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-1042Mooncard SASJeanne Dupont
INV-1043Acme SASPaul Marchand
INV-1044Globex Industrial Holdings and Logistics InternationalSofia Meyer
INV-1045InitechLiam Byrne
INV-1046Umbrella 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-1042Mooncard SAS12 480,00 €
INV-1043Acme SAS980,50 €
INV-1044Globex Industrial Holdings and Logistics International4 200,00 €
INV-1045Initech15 600,00 €
INV-1046Umbrella 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.

Loading the next page
Loading the next page

API reference

DataTable

PropTypeDefaultDescription
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.
isLoadingboolean-
skeletonRowsnumber-Skeleton rows drawn while loading, so the layout does not jump.
loadMoreDataTableLoadMore-
onSortChange(sorting: SortingState) => void-
initialSortingSortingState-
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.
actionReactNode-Rendered above the table, for filters, a bulk action bar or a primary action.