Server Data Table
A DataTable over a PageSource: the server filters, sorts and pages; page numbers, previous and next, or load more follow what the source gives; DataState covers loading, error with retry and empty; a polite status says "Showing 21–40 of 312" after each load; filters, sort and page can live in the URL.
Example
| Status | ||||
|---|---|---|---|---|
Installation
Usage
Wrap your endpoint in a PageSource, declare the filters once, and the table pages, sorts, filters and keeps it in the URL.
API reference
ServerDataTable
| Prop | Type | Default |
|---|---|---|
labelrequiredNames the table, for screen readers and agents. | string | – |
sourcerequired | PageSource<T, FilterValues<S>> | – |
columnsrequiredGive a column `sortField` to sort it on the server. | readonly DataTableColumn<T>[] | – |
filters | S | – |
filterUiThe built-in filter UI: `"search"` (default when the schema has a text field), `"chips"` (search and `FilterChips`) or `"panel"` (search and a `FilterPanel` beside the table, a sheet on narrow screens). Ignored with `toolbar`. | "search" | "chips" | "panel" | "none" | – |
toolbarFilter UIs of your own, composed from the parts; they find the schema and controller from the table. | ReactNode | – |
defaultFilters | FilterValues<S> | – |
defaultSort | readonly SortSpec[] | noSort |
sortMode`"multi"`: Shift+click adds a column to the sort. Default `"single"`. | "single" | "multi" | "single" |
pageSize | number | 25 |
pageSizes | readonly number[] | defaultPageSizes |
navigationDefault `"auto"`: page numbers with an exact total, previous and next without, load more for a cursor. | NavigationMode | "auto" |
urlStateKeeps filters, sort and page in the URL: `hashUrlState()`, `historyUrlState()` or your router's adapter. | UrlStateAdapter | ServerTableUrlState | – |
refetchIntervalReloads the shown rows every so many ms while the document is visible, as the hooks' `refetchInterval`: the rows stay, unmarked, and the status announces nothing. Default false. | number | false | false |
refetchIntervalInBackgroundKeeps polling while the document is hidden, as the hooks' `refetchIntervalInBackground`. Default false. | boolean | false |
controllerA controller of your own, from `usePageController`, to drive the table from outside. | PageController<FilterValues<S>> | – |
labelsrequired | ServerDataTableLabels | – |
localeFormats the counts, dates and numbers it shows; the page's `<html lang>` by default (`useLocale`). | string | – |
className | string | – |
Also takes Pick< DataTableProps<T>, | "getRowLabel" | "selectable" | "selection" | "defaultSelection" | "onSelectionChange" | "onRowOpen" | "virtualize" | "estimateSize" | "loadingRows" | "tableClassName" >.
ServerTableNavigation
| Prop | Type | Default |
|---|---|---|
labelrequiredThe table's label, for the navigation's name. | string | – |
navigationrequired | Navigation | – |
pagerequired | number | – |
pageCountrequired | number | – |
onPageChangerequired | (page: number) => void | – |
hasMorerequired | boolean | – |
loadingMorerequired | boolean | – |
onLoadMorerequired | () => unknown | – |
labelsrequired | ResolvedLabels | – |
ServerTablePageSize
| Prop | Type | Default |
|---|---|---|
sizerequired | number | – |
sizesrequired | readonly number[] | – |
onSizeChangerequired | (size: number) => void | – |
labelrequired | string | – |
locale | string | – |
Other exports
serverDataTableLabelstype ServerDataTableFilterUitype ServerDataTableLabelstype ServerDataTablePropstype ServerTableUrlStatetype ResolvedLabelstype ServerTableNavigationPropstype ServerTablePageSizePropsAccessibility
- A polite status says what is shown after each load ("Showing 21–40 of 312"), and "Loading…" only once a load has taken 400 ms.
- Focus stays on the control you pressed; new rows never take it. Row navigation starts again at the first row without moving focus.
- While a page loads the table keeps its rows and is marked aria-busy; it never says empty while loading or after an error.
Agent actions
Agents sort and page through the table's own actions (sortBy, setPage) and filter through the filters group: filter("Status", ["Open"]), clearFilters(). Every control is a named UI SDK part.
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.