Data Table
Generic typed table: sortable columns with aria-sort, optional row selection with a mixed select-all, loading and empty states, and pagination through renderPagination. Sort, selection and page are controlled or not, and agents can sort, select and page it.
Example
| Apollo | eu-west | 12 | |
| Borealis | us-east | 31 | |
| Cygnus | ap-south | — | |
| Draco | eu-west | 7 | |
| Eridanus | us-east | 44 |
Page 1 of 2
data-table-demo.tsxCopy code
Installation
Copy code
Brings alongnarrowbuttoncheckboxemptyskeletontablepaginationrow-navigationvirtual-rowsaction-refusal
npm packages
class-variance-authority@0.7.1lucide-reactUsage
ImportCopy code
API reference
DataTableHeaderCell
| Prop | Type | Default |
|---|---|---|
columnrequired | DataTableColumn<Row> | – |
sortrequired | DataTableSort | null | – |
sortablerequired | boolean | – |
secondary | DataTableSecondarySort | – |
labelsrequired | Pick<DataTableLabels, "sortBy" | "sortRank"> | – |
onSortrequired | (event: MouseEvent) => void | – |
DataTableCheckbox
| Prop | Type | Default |
|---|---|---|
labelrequired | string | – |
checkedrequired | CheckedState | – |
disabled | boolean | – |
onChangerequired | (checked: boolean, event?: Event) => void | – |
tabIndex | number | – |
DataTablePagination
| Prop | Type | Default |
|---|---|---|
pagerequired | number | – |
pageCountrequired | number | – |
pageSizerequired | number | – |
totalrequired | number | – |
onPageChangerequired | (page: number, options?: DataTablePageOptions) => void | – |
labelsrequired | Pick<DataTableLabels, "previousPage" | "nextPage" | "pageStatus"> | – |
DataTableGapRow
| Prop | Type | Default |
|---|---|---|
columnsrequired | number | – |
sizerequired | number | – |
children | ReactNode | – |
DataTableEmptyRow
| Prop | Type | Default |
|---|---|---|
columnsrequired | number | – |
children | ReactNode | – |
DataTableLoadingRows
| Prop | Type | Default |
|---|---|---|
rowsrequired | number | – |
columnsrequired | number | – |
DataTable
Takes DataTableProps.
CellNavigationProvider
| Prop | Type | Default |
|---|---|---|
handlerequired | CellNavigationHandle | null | – |
childrenrequired | ReactNode | – |
NavigableCell
| Prop | Type | Default |
|---|---|---|
rowrequired | number | – |
colrequired | number | – |
renderrequired | ReactElement | – |
Other exports
clampPagecompareSortValuesnextSortpageCountOfpaginateselectionStatesortRowstoggleIdscreateDataTableControllerdataTabledataTableLabelsDataTableRowcellNavigationuseCellNavigationuseCellNavigationActivetype DataTablePagetype DataTableSorttype SelectionStatetype SortDirectiontype SortValuetype DataTableControllertype DataTableItemtype DataTableOptionstype DataTablePageChangeReasontype DataTableSelectionChangeReasontype DataTableSortChangeReasontype DataTableSecondarySorttype DataTableAligntype DataTableColumntype DataTableLabelstype DataTablePageOptionstype DataTablePaginationPropstype DataTablePropstype DataTableRowPropstype CellNavigationOptionstype CellNavigationHandleAccessibility
- Sortable columns with aria-sort, row selection by label, pagination and a loading state.
Agent actions
Agents sort, select rows by label and page through it.
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.