DataTable

A data table driven by column definitions with sorting, global search, pagination and row selection, plus loading skeletons and an empty state. Every layer is controllable or uncontrolled.

Props

PropTypeDefaultDescription
columnsDataTableColumn<T>[]—Column definitions
dataT[]—Row data
getRowId(row, index) => string—Row key; defaults to row.id, falling back to the original index
titleReactNode—Toolbar title
captionReactNode—Table caption
sortDataTableSortState | null—Controlled sort state, null when unsorted
defaultSortDataTableSortState | null—Uncontrolled initial sort state
onSortChange(sort) => void—Sort change handler
selectablebooleanfalseShow a selection column
selectedKeysstring[]—Controlled selected row keys
defaultSelectedKeysstring[]—Uncontrolled initial selected row keys
onSelectionChange(keys) => void—Selection change handler
searchablebooleanfalseShow a global search box in the toolbar
searchstring—Controlled search query
onSearchChange(value) => void—Search change handler
globalFilterFn(row, query) => boolean—Custom global search matcher
paginationbooleantrueEnable pagination, defaults to true
pagenumber—Controlled current page (1-based)
onPageChange(page) => void—Page change handler
pageSizenumber10Rows per page
pageSizeOptionsnumber[]—Page size options; renders a selector when provided
loadingbooleanfalseLoading state, renders skeleton rows
loadingRowsnumber—Skeleton row count, defaults to the current page size
emptyReactNode—Custom empty state
variant'outline' | 'plain''outline'Appearance: 'outline' | 'plain'
size'sm' | 'md' | 'lg''md'Padding and font size: 'sm' | 'md' | 'lg'
stripedbooleanfalseZebra stripes
hoverablebooleantrueHighlight on hover, defaults to true
stickyHeaderbooleanfalseSticky header (give the container a height or maxHeight)
toolbarReactNode—Extra toolbar content on the right
labelsPartial<DataTableLabels>—Override built-in labels (search, select-all, pagination, …)
...restHTMLAttributes—Remaining props are forwarded to the native div