Skip to Content

DataTable

Hybrid data table built on TanStack Table v9 and TanStack Virtual v3. Supports zero-boilerplate and composable APIs, sorting, faceted filtering, pagination, row selection, expandable rows, logical column pinning, column resizing, and 10k+ row virtualization.

Import

import {
  DataTable,
  DataTableColumnHeader,
  createDataTableColumnHelper,
  createSelectionColumn,
} from "@/components/ui/hacline/components/data-table";

Zero-Boilerplate Mode

Omit children to automatically assemble the toolbar, selection bar, table content, and pagination bar from high-level props. Use createDataTableColumnHelper<TData>() for feature-gated TanStack Table v9 column inference.

Status
Alice Chenalice@hacline.dev
Engineeringactive14,820
Bob Tanakabob@hacline.dev
Designactive8,420
Carol Wucarol@hacline.dev
Productinvited4,210
David Zhoudavid@hacline.dev
Engineeringsuspended1,290
Eva Lineva@hacline.dev
Engineeringactive21,350
Showing 1–5 of 12
Rows per page

Composable Layout & Faceted Filters

Pass explicit children (DataTableToolbar, DataTableSearch, DataTableFacetedFilter, DataTableViewOptions, DataTableSelectionBar, DataTableContent, DataTablePagination) for full layout control. Pair DataTableFacetedFilter with the built-in filterFn: "inArray".

Status
Alice Chenalice@hacline.dev
Engineeringactive14,820
Bob Tanakabob@hacline.dev
Designactive8,420
Carol Wucarol@hacline.dev
Productinvited4,210
David Zhoudavid@hacline.dev
Engineeringsuspended1,290
Eva Lineva@hacline.dev
Engineeringactive21,350
Showing 1–5 of 12
Rows per page

Row Actions Column

Use createActionsColumn() (or DataTableRowActions inside custom cells) for per-row actions. Set maxInline={0} for a compact ⋯ dropdown menu, or maxInline >= 1 to keep primary actions inline while automatically folding remaining items into the overflow menu. Per-row hidden / disabled predicates, destructive styling, and redundant separator cleanup are handled automatically.

Click an inline button or the ⋯ menu on any row
StatusActions
Alice Chenalice@hacline.dev
Engineeringactive14,820
Bob Tanakabob@hacline.dev
Designactive8,420
Carol Wucarol@hacline.dev
Productinvited4,210
David Zhoudavid@hacline.dev
Engineeringsuspended1,290
Eva Lineva@hacline.dev
Engineeringactive21,350

Expandable Rows & Tree Sub-Rows

Combine createExpandColumn() with getSubRows for indented hierarchical trees, or renderSubComponent for inline row detail panels.

UnitOwnerHeadcountAnnual Budget
Platform EngineeringAlice Chen14$820,000
UI FoundationsEva Lin8$460,000
Edge RuntimeIris Patel6$360,000
Product & DesignBob Tanaka9$540,000

Logical Column Pinning & Resizing

TanStack Table v9 uses logical start / end pinning regions (inset-inline-start / inset-inline-end) for automatic LTR and RTL support. Enable enableColumnResizing to drag column dividers or double-click a divider to reset width; use DataTableColumnHeader with mode="menu" to pin or hide columns interactively.

Alice Chenalice@hacline.devEngineeringAdminus-west-22m ago14,820active
Bob Tanakabob@hacline.devDesignEditorap-northeast-114m ago8,420active
Carol Wucarol@hacline.devProductEditorap-southeast-11h ago4,210invited
David Zhoudavid@hacline.devEngineeringViewereu-central-13d ago1,290suspended
Eva Lineva@hacline.devEngineeringAdminus-east-1Just now21,350active
Frank Parkfrank@hacline.devOperationsEditorap-northeast-24h ago6,780active

Virtualized Large Datasets

Set virtualized and maxHeight to render 10,000+ rows smoothly using @tanstack/react-virtual v3 (configured with useFlushSync: false for React 19 compatibility).

Rendering 10,000 rows with @tanstack/react-virtual v3.

IDEndpointStatusRegion
req-00001auth-api/v1/tokens20012 msus-east-1
req-00002edge-gateway/v1/orders20049 msus-west-2
req-00003billing-worker/v1/query20186 mseu-central-1
req-00004search-index/v1/webhooks429123 msap-northeast-1
req-00005auth-api/v1/tokens500160 msus-east-1
req-00006edge-gateway/v1/orders200197 msus-west-2
req-00007billing-worker/v1/query200234 mseu-central-1
req-00008search-index/v1/webhooks201271 msap-northeast-1
req-00009auth-api/v1/tokens42928 msus-east-1
req-00010edge-gateway/v1/orders50065 msus-west-2
req-00011billing-worker/v1/query200102 mseu-central-1
req-00012search-index/v1/webhooks200139 msap-northeast-1
req-00013auth-api/v1/tokens201176 msus-east-1
req-00014edge-gateway/v1/orders429213 msus-west-2
req-00015billing-worker/v1/query500250 mseu-central-1
req-00016search-index/v1/webhooks200287 msap-northeast-1
req-00017auth-api/v1/tokens20044 msus-east-1
req-00018edge-gateway/v1/orders20181 msus-west-2

Server-Side (Manual) Mode & Loading States

Enable manualSorting, manualFiltering, and manualPagination alongside controlled state props and rowCount. When loading is true, empty tables render aligned skeleton rows while populated tables display a non-blocking top progress bar.

Status
0 results
Rows per page

Props

Prop

Type

Data Attributes

AttributeDescription
data-slot="data-table"Root container element
data-slot="data-table-toolbar"Toolbar layout container
data-slot="data-table-selection-bar"Bulk selection action bar
data-slot="data-table-content"Scrollable table container (data-virtualized, data-loading)
data-slot="data-table-pagination"Pagination & page-size footer bar
data-slot="table"Semantic <table> primitive (data-density, data-striped, data-bordered, data-sticky-header)
data-pinned="start" | "end"Logical pinned column cells (data-last-pinned-start, data-first-pinned-end)
data-resizingPresent on a column header and resize handle during drag
data-selectedPresent on selected body rows
data-expandedPresent on expanded body rows and disclosure triggers