Toggle Sidebar B
AppearanceLight & dark mode D

Data Table

Build a data table from the Table primitives and TanStack Table. Each section adds one capability on top of the previous one: formatting, row actions, pagination, sorting, filtering, column visibility, and row selection. For the batteries-included version, use TableData.

Basic Table

Column definitions plus useTable and FlexRender, rendered into the Table primitives.

Dark previewReplay preview
StatusEmailAmount
successken99@example.com316
successabe45@example.com242
processingmonserrat44@example.com837
successsilas22@example.com874
failedcarmella@example.com721
processingolivia@example.com129
successjackson@example.com458
failedisabella@example.com634

Cell Formatting

A cell function returns a render node, so a badge or a formatted amount can live in any cell.

Dark previewReplay preview
StatusEmail
Amount
success
ken99@example.com
$316.00
success
abe45@example.com
$242.00
processing
monserrat44@example.com
$837.00
success
silas22@example.com
$874.00
failed
carmella@example.com
$721.00
processing
olivia@example.com
$129.00
success
jackson@example.com
$458.00
failed
isabella@example.com
$634.00

Row Actions

Add a non-data column with an id and render a DropdownMenu of per-row actions.

Dark previewReplay preview
StatusEmailAmount
successken99@example.com$316.00
successabe45@example.com$242.00
processingmonserrat44@example.com$837.00
successsilas22@example.com$874.00
failedcarmella@example.com$721.00
processingolivia@example.com$129.00
successjackson@example.com$458.00
failedisabella@example.com$634.00

Pagination

Add getPaginationRowModel, then drive it with previous and next buttons.

Dark previewReplay preview
StatusEmailAmount
successken99@example.com$316.00
successabe45@example.com$242.00
processingmonserrat44@example.com$837.00
successsilas22@example.com$874.00

Sorting

Add getSortedRowModel, hold the sorting state in a ref, and make the header a toggle button.

Dark previewReplay preview
StatusAmount
successken99@example.com$316.00
successabe45@example.com$242.00
processingmonserrat44@example.com$837.00
successsilas22@example.com$874.00
failedcarmella@example.com$721.00
processingolivia@example.com$129.00
successjackson@example.com$458.00
failedisabella@example.com$634.00

Filtering

Add getFilteredRowModel, then bind an Input to a single column filter.

Dark previewReplay preview
StatusEmailAmount
successken99@example.com$316.00
successabe45@example.com$242.00
processingmonserrat44@example.com$837.00
successsilas22@example.com$874.00
failedcarmella@example.com$721.00
processingolivia@example.com$129.00
successjackson@example.com$458.00
failedisabella@example.com$634.00

Visibility

Hold columnVisibility state and let users toggle columns from a DropdownMenu.

Dark previewReplay preview
StatusEmailAmount
successken99@example.com$316.00
successabe45@example.com$242.00
processingmonserrat44@example.com$837.00
successsilas22@example.com$874.00
failedcarmella@example.com$721.00
processingolivia@example.com$129.00
successjackson@example.com$458.00
failedisabella@example.com$634.00

Row Selection

Add a select column of Checkboxes and read table.getSelectedRowModel() for the count.

Dark previewReplay preview
StatusEmailAmount
successken99@example.com$316.00
successabe45@example.com$242.00
processingmonserrat44@example.com$837.00
successsilas22@example.com$874.00
failedcarmella@example.com$721.00
processingolivia@example.com$129.00
successjackson@example.com$458.00
failedisabella@example.com$634.00

0 of 8 row(s) selected.

API Reference

useTable

PropTypeDefaultDescription
dataTData[]Row data. Keep the reference stable, or pass a getter.
columnsColumnDef[]Column definitions. accessorKey for data columns, id for custom ones.
featuresTableFeaturesRequired. Built with tableFeatures(); holds features, row models and filter/sort functions.
getPaginationRowModel() => RowModelAdd to enable client-side pagination.
getSortedRowModel() => RowModelAdd to enable client-side sorting.
getFilteredRowModel() => RowModelAdd to enable client-side filtering.
stateobjectControlled state: sorting, columnFilters, columnVisibility, rowSelection.

FlexRender

PropTypeDefaultDescription
renderColumnDefTemplateThe header or cell definition to render.
propsobjectThe context from header.getContext() or cell.getContext().

Accessibility

Keyboard shortcuts and ARIA behavior.

Shortcut Description
TabMoves through the interactive controls in the toolbar, headers, and rows.
EnterActivates the focused sort header, action, or pagination button.
SpaceToggles the focused row selection checkbox.
  • Renders a real table element, so screen readers announce row and column positions.
  • Sortable headers are buttons inside the th, keeping the header cell semantics intact.