Data table
shadcn/ui's data-table walkthrough on TanStack Table v9: the Table primitive plus the helpers in data-table.tsx. dataTableFeatures registers sorting, filtering, visibility, pagination and selection once; DataTableColumnHeader, DataTableViewOptions and DataTablePagination are the reusable pieces. A column with meta.currency renders Money and right-aligns itself. DataTableViewOptions takes an optional, controlled filters prop — labelled checkbox groups above "Toggle columns" — and a showColumns flag for a filters-only menu; DataTablePagination takes an optional total for a server row count and a custom pageSizeOptions list, including an "All" entry (#351). Page size 10; a queue with bulk actions and a phone layout is the Task queue composite.
const col = createColumnHelper<DataTableFeatures, Order>();
const columns = col.columns([ col.accessor("buyer", { header: ({ column }) => <DataTableColumnHeader column={column} title="Buyer" />, filterFn: "includesString" }), … ]);
const table = useTable({ features: dataTableFeatures, data, columns, getRowId: (r) => r.id });
<Table>…<TableHead aria-sort="ascending"><table.FlexRender header={header} /></TableHead>…<DataTableCell cell={cell} table={table} />…</Table>
<DataTablePagination table={table} />Orders
Filter by buyer, open a column head to sort or hide it. The View menu also holds a controlled Status filter (with per-option counts) above Toggle columns, and the pager offers an All page size.
| Nordic Retail AB | 2026-09-14 14:32 | €9.800,00 | |||
| Rhine Outlet GmbH | 2026-09-14 09:05 | €2.150,00 | |||
| Tilburg Trading BV | 2026-09-13 17:48 | €4.320,00 | |||
| Antwerp Stock NV | 2026-09-12 11:20 | €1.875,00 | |||
| Baltic Goods OÜ | 2026-09-11 08:57 | €12.640,00 | |||
| Iberia Surplus SL | 2026-09-10 16:03 | €6.410,00 | |||
| Rhine Outlet GmbH | 2026-09-09 13:41 | €3.290,00 | |||
| Nordic Retail AB | 2026-09-08 10:15 | €18.420,50 | |||
| Antwerp Stock NV | 2026-09-05 18:29 | €960,00 | |||
| Tilburg Trading BV | 2026-09-03 07:52 | €5.480,00 |
Showing 1–10 of 12
Toolbar
DataTableToolbar is a layout shell; DataTableFacetedFilter is controlled — the selection lives in the caller's state (a URL in the app, local state here). Reset shows only when something is filtered.
- Nordic Retail ABpending
- Rhine Outlet GmbHshipping
- Tilburg Trading BVdelivered
- Antwerp Stock NVdelivered
- Baltic Goods OÜshipping
- Iberia Surplus SLdelivered
- Rhine Outlet GmbHcancelled
- Nordic Retail ABpending
- Antwerp Stock NVcancelled
- Tilburg Trading BVdelivered
- Baltic Goods OÜpending
- Iberia Surplus SLdelivered
States
Loading keeps the row shape; empty says why and offers the next step; error names what failed and retries.
| Order | Buyer | Status | Total |
|---|---|---|---|
| Loading orders | |||