@tanstack/react-table
Headless, type-safe table and datagrid library for React — full control over markup and styles while the library handles sorting, filtering, pagination, and more.
@tanstack/react-table
ReactHeadless, type-safe table and datagrid library for React — full control over markup and styles while the library handles sorting, filtering, pagination, and more.
Fit
Bundle (gzip)
31.7 kB
120.9 kB raw
Install size includes transitive dependencies. Bundle size is gzipped browser payload.
Freshness
The Problem
Most table libraries ship with opinionated HTML and CSS, making it hard to match your design system. Building sorting, filtering, and pagination from scratch is tedious and bug-prone.
What It Does
TanStack Table is 100% headless — it provides hooks that compute the table state and exposes row/column models, leaving all rendering to you. This means it works with any UI framework, CSS strategy, or virtualization layer without fighting the library's DOM output.
Installation
npm install @tanstack/react-tableUsage Example
import { useReactTable, getCoreRowModel, flexRender } from '@tanstack/react-table';
const columns = [
{ accessorKey: 'name', header: 'Name' },
{ accessorKey: 'age', header: 'Age' },
];
export function Table({ data }: { data: { name: string; age: number }[] }) {
const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel() });
return (
<table>
<tbody>
{table.getRowModel().rows.map((row) => (
<tr key={row.id}>
{row.getVisibleCells().map((cell) => (
<td key={cell.id}>{flexRender(cell.column.columnDef.cell, cell.getContext())}</td>
))}
</tr>
))}
</tbody>
</table>
);
}Related packages
Fast, composable command palette for React — keyboard-driven search UI with fuzzy filtering and accessible markup out of the box.
@dnd-kit/coreReactModern, accessible drag-and-drop toolkit for React — fully customizable with keyboard support, collision detection, and zero dependencies.
embla-carousel-reactReactLightweight, extensible carousel library for React — smooth scrolling, touch/mouse drag, and full CSS control without prescribing markup.
flagsReactProvider-agnostic feature flags SDK for Next.js and React — toggle features without redeploying.
framer-motionReactProduction-ready declarative animation library for React — gestures, layout animations, and scroll-driven effects with a clean API.