Skip to content

DataTable

Shared Components

Full-featured data table built on TanStack Table with column filtering, sorting, pagination, CSV export, and mobile responsive card view.

Search and sortFaceted filtersSelectionPagination and export
Open preview

Responsive viewport — resize the window to explore. Direction and density apply only to this preview. Theme applies to the docs too.

Usage

Define typed TanStack columns and pass a data array. The example supports search, sorting, status filters, selection, pagination, column controls, and export. Use server for backend-driven pagination; see the Data Grid and Export guides for advanced behavior.

Import
import {
  DataTable,
  DataTableColumnHeader,
} from "@dashboardpack/core/components/shared/data-table";

Available in the included @dashboardpack/core package. Copy the complete example from Source code for all imports and state. Add "use client" when using hooks or event handlers. See installation and theming for project setup.

API reference

Common props and defaults. Slot-specific props are named below; native elements also accept their standard HTML attributes. The component TypeScript definitions are the complete type reference.

DataTable props
PropType / DefaultDescription
columnsColumnDef<TData, TValue>[]

Default: required

Typed column definitions.
dataTData[]

Default: required

Rows to display.
enableRowSelectionboolean

Default: false

Enable row selection.
facetedFilters{ columnId; title; options? }[]

Default: —

Configure column filter menus.
serverServerPagination

Default: —

Backend-driven sorting, filtering, and paging.
onCellEdit(params: CellEditParams<TData>) => void | Promise<void>

Default: —

Commit edits declared by column meta.editable.
viewsKeystring

Default: —

Enable persisted and shareable table views.
enableColumnPinningboolean

Default: false

Enable start/end pinning.
exportFilenamestring

Default: export

Base filename for CSV and XLSX exports.

Build with these too

Continue with the Data Grid and Export guides.