Add this component

npx zentauri-ui add data-table

Accessibility notes

Keyboard accessible by default with semantic markup, visible focus treatment, and tokenized states. Add descriptive labels for icon-only or decorative usage.

Dependency notes

Check Installation for shared peers. This component keeps styling in Tailwind classes and the --zui-* token contract.

Data

DataTable for product dashboards

DataTable combines Zentauri table primitives with sorting, filtering, pagination, row selection, column visibility, loading states, and bulk actions for admin-grade React interfaces.

NameEmailRoleStatusScore
Ada Lovelaceada@example.comEngineerActive92
Grace Hoppergrace@example.comArchitectInvited98
Showing 2 of 14

No bulk action yet

Pro table workflow

Search records, sort columns, select rows for bulk actions, hide optional fields, and paginate processed results from one typed component.


NameEmailRoleStatusScore
Ada Lovelaceada@example.comEngineerActive92
Grace Hoppergrace@example.comArchitectInvited98
Showing 2 of 14

No bulk action yet

Appearance playground

Change the table appearance, size, sticky header, selection, and column visibility controls while the code snippet updates with the selected options.


NameEmailRoleStatusScore
Ada Lovelaceada@example.comEngineerActive92
Grace Hoppergrace@example.comArchitectInvited98
Katherine Johnsonkatherine@example.comAnalystActive95
Mary Jacksonmary@example.comManagerActive89
Dorothy Vaughandorothy@example.comOperations LeadActive91
Showing 5 of 14

Data Table API

Generated from the package prop types and variant definitions.

DataTable

DataTableProps

Behavior

PropTypeDefault
appearance'default' | 'ghost' | 'blue' | 'cyan' | 'green' | 'lime' | 'mint' | 'ocean' | 'sapphire' | 'lavender' | 'ruby' | 'red' | 'slate' | 'zinc' | 'stone' | 'royal' | 'electric' | 'forest' | 'sunset' | 'magenta' | 'crimson' | 'aqua' | 'plum' | 'sky' | 'rose' | 'purple' | 'pink' | 'orange' | 'yellow' | 'teal' | 'indigo' | 'emerald' | 'gray' | 'violet' | 'amber' | 'striped' | 'bordered' | null | undefinednone
bulkActionsreadonly DataTableBulkAction<TData>[] | undefinednone
captionReactNodenone
columns*readonly DataTableColumn<TData, TKey>[]none
data*readonly TData[]none
defaultSelectedRowIdsreadonly string[] | undefinednone
defaultSortDirectionTableSortDirection | undefinednone
defaultSortKeyTKey | undefinednone
defaultVisibleColumnIdsreadonly TKey[] | undefinednone
emptyContentReactNodenone
enableColumnVisibilityboolean | undefinednone
enableRowSelectionboolean | undefinednone
getRowId((row: TData, index: number) => string) | undefinednone
loadingboolean | undefinednone
loadingContentReactNodenone
onColumnVisibilityChange((visibleColumnIds: TKey[]) => void) | undefinednone
onRowSelectionChange((selectedRowIds: string[], selectedRows: TData[]) => void) | undefinednone
onSortChange((sort: { sortKey?: TKey; sortDirection: TableSortDirection; }) => void) | undefinednone
paginationboolean | DataTablePaginationOptions | undefinednone
refAllows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).Ref<HTMLElement> | undefinednone
searchboolean | DataTableSearchOptions<TKey> | undefinednone
selectedRowIdsreadonly string[] | undefinednone
showRowCountboolean | undefinednone
size'md' | 'sm' | 'lg' | null | undefinednone
sortDirectionTableSortDirection | undefinednone
sortKeyTKey | undefinednone
stickyHeaderboolean | null | undefinednone
tableClassNamestring | undefinednone
tableScrollAreaAriaLabelstring | undefinednone
textAlign'center' | 'left' | 'right' | undefinednone
virtualizationDataTableVirtualizationOptions | undefinednone
visibleColumnIdsreadonly TKey[] | undefinednone
Inherited HTML props
PropTypeDefault
classNamestring | undefinednone
idstring | undefinednone
onClickMouseEventHandler<HTMLElement> | undefinednone
styleCSSProperties | undefinednone
titlestring | undefinednone

What it does

DataTable handles common product-table workflows without forcing consumers to manually wire filtering, sorting, selection, pagination, visibility controls, loading states, or empty states.

It preserves semantic table markup through the lower-level Table primitive.

Composition and API

Define typed columns with accessors, optional custom cell renderers, sort values, filter values, and visibility behavior.

Use getRowId for stable row selection and bulk actions.

Common use cases

  • User management screens with bulk invite or archive actions.
  • Billing histories with sortable amounts and searchable customers.
  • Operations dashboards with optional columns per team role.
  • Paginated reports that need empty and loading states by default.

Accessibility

Sortable headers use the same keyboard and aria-sort behavior as Table. Selection controls are labeled per row and the toolbar reports selected counts in a polite live region.

Next.js integration notes

Use DataTable inside a client component when users interact with sorting, filtering, column visibility, selection, or pagination. Server components can still prepare the data and column definitions they pass down.

FAQ

Does DataTable replace the Table primitive?

No. DataTable is the composed, batteries-included layer. Use Table when you want full markup control and DataTable when you want typed columns plus common data interactions.

Can I control DataTable state from my app?

Yes. Sorting, search, pagination, selected row ids, and visible column ids expose controlled and uncontrolled APIs.

Does DataTable support bulk actions?

Yes. Enable row selection and pass bulkActions. Each action receives the selected row objects.