DataTable

Pro

DataTable pairs TanStack Table with the product Table primitives so sorting, selection, and paging arrive already wired.

Name
Email
Plan
Status
Aria Patelaria@acme.ioGrowthActive
Diego Ramosdiego@acme.ioScaleActive
Mei Linmei@acme.ioStarterTrial
Noah Beckernoah@acme.ioGrowthPast due
Priya Nairpriya@acme.ioScaleActive
Lucas Ferreiralucas@acme.ioStarterTrial
Hana Satohana@acme.ioGrowthActive
Owen Clarkeowen@acme.ioStarterActive
Freya Larsenfreya@acme.ioScalePast due
Malik Johnsonmalik@acme.ioGrowthActive

Installation

Add this component with the NateUI CLI.

npx @nateui/cli@latest add DataTable

Examples

Row Selection

Column Resizing

Pinned Columns

Expandable Rows

Drag And Drop

Empty State

API

DataTable wraps TanStack Table - columns, Row<T>, and the render prop's table instance all come directly from that library; see its own docs for the full column-def and table-instance API. Sorting and pagination stay manual: DataTable expects data to already be sorted and sliced to the current page, then calls back through onSort / onPaginationChange / onPageSizeChange so a parent can re-sort or re-fetch. Column resizing and sticky column pinning are built into the default renderer when columnResize or columnPinning is enabled. Pass children only when you need to replace the table structure entirely, as the Drag And Drop example does. With overflow enabled, the default renderer uses NateUI Scroll for horizontal table scrolling and applies overflowClass to its root; set overflow={false} to render without that viewport. Pagination stays outside the scroll region.

PropDescriptionTypeDefault
columnsColumn definitions for the table.ColumnDef<T>[][]
dataRows to render for the current page.T[][]
loadingShows skeleton rows while empty, or dims the table when rows are already present.booleanfalse
noDataRenders the built-in empty state instead of rows.booleanfalse
renderEmptyStateReplaces the default empty-state content.ReactNode-
selectableAdds a checkbox column for row and select-all selection.booleanfalse
onRowSelectCalled when a single row's checkbox changes.(checked: boolean, row: T) => void-
onAllRowSelectCalled when the header select-all checkbox changes.(checked: boolean, rows: Row<T>[]) => void-
checkboxCheckedOverrides a row's checked state instead of TanStack's internal selection.(row: T) => boolean-
indeterminateCheckboxCheckedOverrides the header checkbox's checked state.(rows: Row<T>[]) => boolean-
onSortCalled when the sorted column or direction changes.(sort: OnSortParam) => void-
columnPinningPins columns at the logical start or end by column id and renders them sticky in the default table.ColumnPinningState-
columnResizeAdds resize handles to header cells. Pass { mode: 'onChange' } for live resizing while dragging.boolean | ColumnResizeConfigfalse
pagingDataCurrent page, page size, and total row count.{ total: number; pageIndex: number; pageSize: number }{ total: 0, pageIndex: 1, pageSize: 10 }
onPaginationChangeCalled when the page changes.(page: number) => void-
pageSizesOptions shown in the page-size select.number[][10, 25, 50, 100]
onPageSizeChangeCalled when the page-size select changes.(size: number) => void-
skeletonAvatarColumnsColumn indexes that render an avatar-shaped skeleton while loading.number[]-
skeletonAvatarPropsProps for those skeleton avatars.SkeletonProps-
childrenRenders the table body yourself from the underlying TanStack instance, instead of DataTable's default rows.(props: { table: Table<T> }) => ReactNode-
refExposes resetSorting() and resetSelected().Ref<DataTableResetHandle>-
...tablePropsForwarded to the underlying Table, for example bordered, compact, or overflow.TableProps-

Types

type OnSortParam = { sortOrder: 'asc' | 'desc' | ''; sortKey: string | number };
type ColumnPinningState = { start: string[]; end: string[] };
type ColumnResizeConfig = { mode?: ColumnResizeMode };
type ColumnResizeMode = 'onChange' | 'onEnd';
type DataTableResetHandle = { resetSorting: () => void; resetSelected: () => void };