TanStack Table
Headless UI for building powerful tables & datagrids
Framework-agnostic with sorting, filtering, pagination, and more.
ReactTableHeadlessSortingFiltering
๐ฎ Playground
Use cases
- โขData tables
- โขAdmin panels
- โขSpreadsheet-like interfaces
Good for
- โComplex data displays
- โCustom table designs
- โMulti-framework projects
Not good for
- โSimple lists
- โQuick prototypes needing styled tables
Installation
$npm install @tanstack/react-table
Example
import { useReactTable, getCoreRowModel, flexRender } from "@tanstack/react-table"
const data = [
{ name: "Alice", email: "alice@example.com" },
{ name: "Bob", email: "bob@example.com" },
{ name: "Charlie", email: "charlie@example.com" },
]
const columns = [
{ accessorKey: "name", header: "Name" },
{ accessorKey: "email", header: "Email" },
]
export default function Demo() {
const table = useReactTable({
data,
columns,
getCoreRowModel: getCoreRowModel(),
})
return (
<table style={{ width: "100%", borderCollapse: "collapse" }}>
<thead>
{table.getHeaderGroups().map(headerGroup => (
<tr key={headerGroup.id}>
{headerGroup.headers.map(header => (
<th key={header.id} style={{ border: "1px solid #ccc", padding: "8px", textAlign: "left" }}>
{flexRender(header.column.columnDef.header, header.getContext())}
</th>
))}
</tr>
))}
</thead>
<tbody>
{table.getRowModel().rows.map(row => (
<tr key={row.id}>
{row.getVisibleCells().map(cell => (
<td key={cell.id} style={{ border: "1px solid #ccc", padding: "8px" }}>
{flexRender(cell.column.columnDef.cell, cell.getContext())}
</td>
))}
</tr>
))}
</tbody>
</table>
)
}Comparison
"More flexible than AG Grid, more features than react-table v7."
Trust Metrics
25.5K
GitHub Stars
2.8M
Weekly Downloads
Last Commit:last year
Used by
FacebookAmazonMicrosoft
