DataTable, Pagination
Fiddledocs.acme.devapi.acme.dev
1–2 of 12
Usage
The import, then a use to start from. Both copy as they are.
Import
import { DataTable } from "@/components/ui/data-table/data-table";Example
<DataTable columns={columns} data={sites} initialPageSize={10}> <DataTable.Toolbar> <h3 className="text-subheading">Docs sites</h3> </DataTable.Toolbar> <DataTable.Content> <DataTable.Header /> <DataTable.Body /> </DataTable.Content> <DataTable.Pagination /></DataTable>When to use
Use it for
- Records people sort, filter, select or page through. It's built on TanStack Table: pass
columnsanddata. - Client-side by default;
manualPagination,manualSortingandpageCountwhen the server pages the data. DataTable.Paginationpages the table; the standalonePagination(@/components/ui/pagination) is for lists that aren't tables.- Cell values people compare (domains, versions, dates) are set in mono, and a status cell is a
StatusBadge.
Avoid
- A table for a handful of settings: use rows in a
Card. - A card per record. Rows fit more on a screen.
Accessibility
Checks
- Row actions are named with their row (“Open docs.acme.dev”), not just “Open”.
- A clickable row keeps a real link or button inside it, so the keyboard can reach it.
API
Read from each component's stories, the same source as COMPONENTS.md, and kept in step by check:design-system.
DataTable
A composable data table built on top of TanStack Table. Supports client-side and server-side pagination, column filtering, global search, sortable headers, and loading states (skeleton rows on initial load, spinner overlay on subsequent fetches). Composed via sub-components — `DataTable.Toolbar`, `DataTable.Content`, `DataTable.Header`, `DataTable.Body`, `DataTable.Pagination`, and `DataTable.SearchBar` — so the layout is fully flexible.
Its stories don't declareargTypes, so no props are listed. The variants show its states.VariantsDefaultWithSearchSmallDatasetEmptyServerSidePaginationServerSideWithFetchingServerSideInitialLoadClientSideWithFetchingServerSideControlledSortingWithDividersWithRowClickWithRowClickLeavingModifiedClicksHoverableWithoutClickRowSelectionSelectionActionsFramed
Pagination
COMPONENTS.md.Keep going
- StatusBadgeSystem state: live, publishing, error… Dot carries the hue, the label carries the meaning.Fiddle
- Skeleton, ProgressLoading shapes and determinate progress.Frond
- CardThe framed surface (
surface-card) with standard padding.Fiddle
Patterns
How components come together into pages.