Data Table
A full list screen on TanStack Table: frozen ID and action columns, sticky header, sort on every column, search and faceted filters, selection with bulk actions, paging, column choice, URL state and honest loading, empty and error states.
Click a row (or press Enter) to open it; the breadcrumb leads back. Sort, search, filters and page are written to the URL (?plots.sort=yield.desc), so a view can be shared.
| Actions | |||||||||
|---|---|---|---|---|---|---|---|---|---|
| P-015 | River plot 2 | Rice | Goat | Ripe | 2 tiles | 2026-11-15 | 718 | ||
| P-029 | Well plot 4 | Rice | Pig | Ripe | 2 tiles | 2026-11-01 | 716 | ||
| P-005 | Well plot 1 | Peanuts | Pig | Growing | 7 tiles | 2026-11-17 | 628 | ||
| P-019 | Pond plot 3 | Peanuts | Rooster | Growing | 7 tiles | 2026-11-03 | 626 | ||
| P-014 | Temple plot 2 | Luffa gourd | Dog | Wilted | 6 tiles | 2026-11-04 | 581 | ||
| P-028 | Bamboo plot 4 | Luffa gourd | Monkey | Wilted | 6 tiles | 2026-11-18 | 579 | ||
| P-009 | North plot 2 | Corn | Ox | Ripe | 5 tiles | 2026-11-05 | 536 | ||
| P-023 | River plot 3 | Corn | Goat | Ripe | 5 tiles | 2026-11-19 | 534 | ||
| P-004 | Bamboo plot 1 | Sweet potato | Monkey | Growing | 4 tiles | 2026-11-06 | 491 | ||
| P-018 | East plot 3 | Sweet potato | Rat | Growing | 4 tiles | 2026-11-20 | 489 |
Installation
Usage
Table rules this component follows: full width; ID or name frozen left and actions frozen right, only the middle scrolls (on narrow screens only the first left column stays frozen); sticky header; 12 px grey sentence-case headers with no band and no zebra rows; every column sorts, with the arrow on the active column only; search plus one faceted filter per fixed-value column, Reset and the row count; numbers and dates right-aligned; a row opens its detail screen, which has a breadcrumb back; sort and filters live in the URL; every action is an icon button with a tooltip and an accessible name; loading, empty and error states keep the frame.
Examples
States
Loading draws bars at the real cell sizes; empty and error keep the frame, say what happened and offer the next step.
API
Everything else is passed through to the underlying element or Radix primitive.
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | – | Accessible name of the table; also used in the search label. |
columns / data | ColumnDef<T>[] / T[] | – | TanStack Table v8 columns and rows. `meta: { title, align: "end", skeleton }` per column. |
pin | { left?: string[]; right?: string[] } | – | Columns frozen to the edges (ID/name left, actions right). The middle scrolls. |
facets | { column; title; options? }[] | – | One faceted filter per fixed-value column, with counts. Give the column `filterFn: facetFilter`. |
bulkActions | (rows, clear) => ReactNode | – | Turns on selection; shown in a bar inside the board when rows are selected. |
onRowClick | (row: T) => void | – | Opens the item. Clicks on controls inside the row are ignored; Enter works too. |
urlKey | string | – | Mirror search, sort, filters, page and size in the query string under this prefix. |
status | "ready" | "loading" | "error" | "ready" | With `errorText`, `lastGood` and `onRetry` for errors; `empty` replaces the empty message. |
pageSizes | number[] | [10, 20, 50] | Choices in Rows per page; the first is the default. |
maxHeight | number | string | 560 | Height of the scrolling body; the header sticks inside it. |