The demo renders with the docs site's own Radix-based parts. The same component with the UI SDK parts was run side by side with it in a browser and behaves the same.
label names the column in the View menu and on its filter button.
filterOptions adds a faceted filter to the toolbar. It is a Popover with a Command list, multi select, with a count next to each option.
className goes on the header and every cell, for example text-right for money.
icon puts a type icon before the header name and action puts a control at its right edge (grid variant).
format formats this column's footer calculation, for example as currency (grid variant). calculation: false leaves the column out of the footer, for an actions column.
The pieces are exported too, for a table you wire yourself: DataTableColumnHeader, DataTableToolbar, DataTablePagination, DataTableViewOptions and DataTableFacetedFilter. They take the table from useTable with dataTableFeatures.
variant="grid" is the dense table a CRM list uses: edge to edge, one 32px line per row at 13px, a hairline between columns, a type icon and an action slot in each header, the checkbox and first column pinned while the rest scroll sideways, and a footer with a row count under the first data column (grid keeps that column from being hidden) and an "Add calculation" menu per column (count, count unique, and sum, average, min and max on number columns). It shows every row on one page and renders them all without virtualization, so keep it to a few hundred rows or page the data yourself.
Name
Domain
Connection strength
Categories
Last contact
Value
FFraser Valley Dental3 comments
fvdental.ca
Very strong
HealthcareRetainer
Oct 29, 2026
$14,400
CCascade Roofing1 comment
cascaderoofing.ca
Good
Trades
Oct 21, 2026
$6,200
SSumas Mountain Farms
sumasfarms.ca
Weak
Agriculture
Sep 2, 2026
$2,400
HHarrison Hot Springs Spa2 comments
harrisonspa.ca
Strong
HospitalityWebsite
Oct 30, 2026
$9,800
CChilliwack Community Arts
chilliwackarts.ca
Good
Non-profit
No contact
$1,800
NNorthline Logistics1 comment
northline.ca
Very weak
Transport
Jul 14, 2026
$0
MMaple Ridge Physio
mrphysio.ca
Strong
Healthcare
Oct 27, 2026
$7,300
OOkanagan Cellars4 comments
okcellars.ca
Good
RetailStore
Oct 12, 2026
$11,250
RRosedale Veterinary
rosedalevet.ca
Weak
Healthcare
No contact
$3,100
TTidewater Coffee Co.2 comments
tidewatercoffee.ca
Very strong
Hospitality
Nov 1, 2026
$5,600
10 count
DataTableNameCell is the first-column cell, with a leading mark and a comment count at the right edge. DataTableStatusDot is a coloured dot and a word. Tag chips are Badge with fill="tag": 13px text, an 8px corner and a hairline border in the chip's own hue. A ghost variant with fill="tag" is the grey "No contact" placeholder. Other styles keep the soft badge, and the live demo on this page renders with the Nova primitives, so it shows that fallback. In a project on the Ledger style the tags render as the 13px chip, as in this capture.
The toolbar keeps every control on one row and scrolls sideways when it runs out of room. The table scrolls inside its own frame, so the page never scrolls sideways.
The rest of this page is the guide to building a data table from scratch with TanStack Table and the <Table /> component. Use it when the ready-made table does not fit.
Every data table or datagrid I've created has been unique. They all behave differently, have specific sorting and filtering requirements, and work with different data sources.
It doesn't make sense to combine all of these variations into a single component. If we do that, we'll lose the flexibility that headless UI provides.
So instead of a data-table component, I thought it would be more helpful to provide a guide on how to build your own.
We'll start with the basic <Table /> component and build a complex data table from scratch.
Tip: If you find yourself using the same table in multiple places in your app, you can always extract it into a reusable component.
TanStack Table v9 is feature-based: you opt into the behavior you want, sorting, filtering, pagination, and so on, by declaring it with tableFeatures(). Anything you don't list is tree-shaken out of your bundle. That includes the built-in filter and sort functions: register the ones your columns rely on under filterFns and sortFns (our email filter uses includesString, and string columns sort with text / alphanumeric).
app/payments/data-table-features.ts
import { columnFilteringFeature, columnVisibilityFeature, createFilteredRowModel, createPaginatedRowModel, createSortedRowModel, filterFn_includesString, rowPaginationFeature, rowSelectionFeature, rowSortingFeature, sortFn_alphanumeric, sortFn_text, tableFeatures,} from "@tanstack/react-table"// New in v9: declare the features this table uses, anything you don't// register is tree-shaken out of the bundle.export const features = tableFeatures({ columnFilteringFeature, columnVisibilityFeature, rowPaginationFeature, rowSelectionFeature, rowSortingFeature, filteredRowModel: createFilteredRowModel(), paginatedRowModel: createPaginatedRowModel(), sortedRowModel: createSortedRowModel(), filterFns: { includesString: filterFn_includesString }, sortFns: { alphanumeric: sortFn_alphanumeric, text: sortFn_text },})// Pass this as the first generic argument to `ColumnDef`, `Column`, `Table`,// and `Row` so each type knows which feature APIs are available.export type DataTableFeatures = typeof features
Note: The core row model is always included, so you never register it yourself. Row models for optional features are created with create*RowModel() and registered on the features object, there are no more get*RowModel table options.
"use client"import { createColumnHelper } from "@tanstack/react-table"import { type DataTableFeatures } from "./data-table-features"// This type is used to define the shape of our data.// You can use a Zod schema here if you want.export type Payment = { id: string amount: number status: "pending" | "processing" | "success" | "failed" email: string}// Use `accessor` for data columns and `display` for columns without one.const columnHelper = createColumnHelper<DataTableFeatures, Payment>()export const columns = columnHelper.columns([ columnHelper.accessor("status", { header: "Status", }), columnHelper.accessor("email", { header: "Email", }), columnHelper.accessor("amount", { header: "Amount", }),])
Note: Columns are where you define the core of what your table
will look like. They define the data that will be displayed, how it will be
formatted, sorted and filtered.
Tip: If you find yourself using <DataTable /> in multiple places, this is the component you could make reusable by extracting it to components/ui/data-table.tsx.
<DataTable columns={columns} data={data} />
<table.FlexRender /> vs flexRender: This guide uses v9's <table.FlexRender header={header} /> and <table.FlexRender cell={cell} /> component, available right on the table instance, no extra import needed. The classic flexRender(component, context) helper from v8 still works too, if you prefer the function form (or need to render outside the component that owns table, where you can also import the standalone <FlexRender />).
You can access the row data using row.original in the cell function. Use this to handle actions for your row eg. use the id to make a DELETE call to your API.
Because our features object includes rowPaginationFeature and createPaginatedRowModel(), the table automatically paginates rows into pages of 10, there's nothing to add to useTable. See the pagination docs for more information on customizing page size and implementing manual pagination.
Let's add a search input to filter emails in our table.
The columnFilteringFeature and filtered row model are already part of our features object, so we only need to wire up the filter state and render an input.
"use client"import * as React from "react"import { useTable, type ColumnDef, type ColumnFiltersState, type RowData, type SortingState,} from "@tanstack/react-table"import { Button } from "@/components/ui/button"import { Input } from "@/components/ui/input"export function DataTable<TData extends RowData>({ columns, data,}: DataTableProps<TData>) { const [sorting, setSorting] = React.useState<SortingState>([]) const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>( [] ) const table = useTable({ features, data, columns, onSortingChange: setSorting, onColumnFiltersChange: setColumnFilters, state: { sorting, columnFilters, }, }) return ( <div> <div className="flex items-center py-4"> <Input placeholder="Filter emails..." value={(table.getColumn("email")?.getFilterValue() as string) ?? ""} onChange={(event) => table.getColumn("email")?.setFilterValue(event.target.value) } className="max-w-sm" /> </div> <div className="overflow-hidden rounded-md border"> <Table>{ ... }</Table> </div> </div> )}
Filtering is now enabled for the email column. You can add filters to other columns as well. See the filtering docs for more information on customizing filters.
Here are some components you can use to build your data tables. The snippets below are the docs site's Radix-style source; they import the same parts, which on the UI SDK base come from your own components/ui. This is from the Tasks demo, which shares its features object (and the matching TasksTableFeatures type) across every component via a data-table-features.ts module, the same pattern we set up in Set up Table Features.