A complete data grid on TanStack Table: sortable headers, search, column visibility, row selection, pagination, a loading state and live result counts.
| Status | ||||
|---|---|---|---|---|
| INV-2045 | Lumen Health ops@lumen.example | Paid | $3,120.00 | |
| INV-2043 | Harbor & Co finance@harbor.example | Paid | $2,310.00 | |
| INV-2048 | Quartz Media billing@quartz.example | Overdue | $1,980.00 | |
| INV-2041 | Northwind Studio billing@northwind.example | Paid | $1,250.00 | |
| INV-2050 | Sable Design studio@sable.example | Pending | $1,105.00 |
1–5 of 10
The source is part of Ballmac UI Pro.
Log in with your licence key to read and copy it here, or install it through the shadcn CLI or the MCP server. You own the code once it is in your project.
$49 once regular price $99for this and every other Pro item. Tax included.Money back if it does not work.
Installation
Get a Pro licence key.
The source is part of Ballmac UI Pro.
Log in with your licence key to read and copy it here, or install it through the shadcn CLI or the MCP server. You own the code once it is in your project.
$49 once
regular price $99for this and every other Pro item. Tax included.Money back if it does not work.Once per project: add the Pro registry and your licence key.
components.json{ "registries": { "@ballmac": "https://ui.ballmac.com/r/{name}.json", "@ballmac-pro": { "url": "https://ui.ballmac.com/r/pro/{name}.json", "headers": { "Authorization": "Bearer ${BALLMAC_LICENSE_KEY}" } } } }.env.localBALLMAC_LICENSE_KEY=your-licence-keyAdd it.
$ pnpm dlx shadcn@latest add @ballmac-pro/data-table
Usage
import { DataTable, DataTableColumnHeader } from "@/components/ballmac/data-table"The full example is in the Code tab above.
Examples
Loading and empty
The source is part of Ballmac UI Pro.
Log in with your licence key to read and copy it here, or install it through the shadcn CLI or the MCP server. You own the code once it is in your project.
$49 once regular price $99for this and every other Pro item. Tax included.Money back if it does not work.
API reference
<DataTable>
| Prop | Type | Default |
|---|---|---|
columns*Column definitions from TanStack Table. Use `DataTableColumnHeader` in `header` for sortable columns, and `meta: { label: "Name" }` to name a column in the Columns menu. | ColumnDef<TData, TValue>[] | — |
data*Rows to display. | TData[] | — |
label*Accessible name of the table. Also names the scroll region. | string | — |
selectableAdd a leading checkbox column for selecting rows. | boolean | false |
onSelectionChangeCalled with the selected row objects whenever the selection changes. | (rows: TData[]) => void | — |
searchableShow a search field that filters across every column. | boolean | true |
searchPlaceholderPlaceholder of the search field. | string | — |
columnToggleShow a menu for hiding and showing columns. | boolean | true |
pageSizeRows per page. Set to 0 to disable pagination. | number | 8 |
loadingShow placeholder rows while data loads. | boolean | false |
emptyMessageMessage when there are no rows or no matches. | React.ReactNode | — |
initialSortingInitial sort, for example `[{ id: "amount", desc: true }]`. | SortingState | [] |
toolbarExtra content on the right of the toolbar, such as an export button. | React.ReactNode | — |
getRowIdGive every row a stable id. Defaults to the row index. | (row: TData, index: number) => string | — |
stickyHeaderKeep the header visible while the body scrolls. Combine with `maxHeightClassName`. | boolean | false |
maxHeightClassNameHeight limit for the scroll area, for example `max-h-96`. | string | — |
<DataTableColumnHeader>
| Prop | Type | Default |
|---|---|---|
column*The column from the header context: `header: ({ column }) => <DataTableColumnHeader column={column} title="Amount" />`. | Column<TData, TValue> | — |
title*Visible column title. | string | — |
numericRight-align the title for numeric columns. | boolean | — |
Also accepts the standard attributes of its root element.
Accessibility
| Key | Action |
|---|---|
| Tab / Enter | Sort buttons, checkboxes, pagination and the column menu are real controls |
| Screen readers | aria-sort on headers; the result count is a polite live region |
Quality scorecard
Every applicable check passes
Measured in Chromium 153.0.8010.12 on October 19, 2026, on version 1.0.0, across 2 examples.
Passed: Accessibility scan
No serious or critical issues in light and dark, on a phone and a desktop (axe-core 4.13.0, WCAG 2.1 AA and best-practice rules).
Passed: Small screens
No sideways scrolling at 360, 390 or 1280 px wide.
Passed: Reduced motion
Every endless animation stops when the visitor asks for less motion.
Passed: Right to left
Mirrors correctly in Arabic, Hebrew, Persian and Urdu layouts (0% of elements off the mirror, limit 15%).
Passed: Clean console
No console errors or React hydration errors while loading.
Passed: Keyboard
15 tab stops, each showing a visible change when it takes focus. 2 documented keys.
Not applicable: Loading, empty and error
Does not show data or take submissions.
Passed: Automated tests
Covered by data-table.test.tsx.
For information: Footprint
4.6 KB of source (gzip) in 1 file. Installs @tanstack/react-table, lucide-react.
Automated checks find a subset of problems and do not replace testing with a screen reader and a keyboard in your own app. What they miss.
Use with AI
Pass columns (TanStack ColumnDef) and data. Use DataTableColumnHeader for sortable headers. selectable adds checkboxes; pageSize sets rows per page. With the shadcn MCP server set up (guide), ask your agent:
Add the Ballmac UI Data Table (@ballmac-pro/data-table) to this project with the shadcn MCP, then use it where it fits.
Use it for
- Lists of records people search, sort and select
- Admin and billing screens
Not for
- A small static table; use table
- Server-side paging for huge datasets without adapting the parts
Registry JSON (needs your licence key): https://ui.ballmac.com/r/pro/data-table.json
Credits
Based on shadcn/ui Data Table, adapted by Ballmac. Covered by the Ballmac UI Pro license.
Pairs well with
Table
A semantic table in a focusable, named scroll region, with sticky header, striping, three densities, aria-sort headers and numeric columns.
Badge
A small pill label in four variants with an optional status dot and success, warning and error tones. Style links with badgeVariants().
Dropdown Menu
An action menu on a trigger with checkbox and radio items, submenus, shortcut hints and destructive rows, built on Radix for full keyboard and typeahead support.
Bar List
A ranked list of bars with the name and number on top of the bar, so both stay readable at any width. Rows can be links or buttons, a long list folds to its top few, and every value is real text.