tanstack-table
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "tanstack-table" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-75c7fca2131cde5c91bc0e2b32e7844598b5736a7edf488661ab86872c26d70e. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Build powerful data tables with TanStack Table — a headless, framework-agnostic table library. Suitable for constructing sortable, filterable, and paginated tables and implementing features like column resizing, row selection, and virtualization (including use in React).
Introduction source: third_party · TerminalSkills · 1.0.0 Reference
SkillPi interpretation
- Audience
- Displaying tabular data with sorting, filtering, and pagination Need full control over table styling (not a pre-styled component) Server-side pagination and filtering Complex tables with column resizing, reordering, and pinning Row selection and bulk actions Large datasets with virtualized rendering
- Testing
- Not tested
Browse files
Frontmatter
name: tanstack-table
description: >-
Build powerful data tables with TanStack Table — headless, framework-agnostic
table library. Use when someone asks to "build a data table", "TanStack Table",
"sortable table", "filterable data grid", "paginated table", "React table",
or "headless table library". Covers sorting, filtering, pagination, column
resizing, row selection, and virtualization.
license: Apache-2.0
compatibility: "React, Vue, Svelte, Solid, vanilla JS. TypeScript."
metadata:
author: terminal-skills
version: "1.0.0"
category: development
tags: ["table", "data-grid", "tanstack", "react", "sorting"]TanStack Table
Overview
TanStack Table is a headless table library — it handles the logic (sorting, filtering, pagination, grouping, column visibility) and you handle the rendering. No predefined styles or markup, full control over how the table looks. Works with React, Vue, Svelte, Solid, or vanilla JS. The standard for building custom data tables that don't look like every other Material UI table.
When to Use
- Displaying tabular data with sorting, filtering, and pagination
- Need full control over table styling (not a pre-styled component)
- Server-side pagination and filtering
- Complex tables with column resizing, reordering, and pinning
- Row selection and bulk actions
- Large datasets with virtualized rendering
Instructions
Setup
npm install @tanstack/react-table
Basic Table
// components/DataTable.tsx — Sortable, filterable table
import {
useReactTable,
getCoreRowModel,
getSortedRowModel,
getFilteredRowModel,
getPaginationRowModel,
flexRender,
ColumnDef,
SortingState,
} from "@tanstack/react-table";
import { useState } from "react";
interface User {
id: number;
name: string;
email: string;
role: string;
status: "active" | "inactive";
joinedAt: string;
}
const columns: ColumnDef<User>[] = [
{
accessorKey: "name",
header: "Name",
cell: (info) => <span className="font-medium">{info.getValue<string>()}</span>,
},
{ accessorKey: "email", header: "Email" },
{ accessorKey: "role", header: "Role" },
{
accessorKey: "status",
header: "Status",
cell: (info) => (
<span className={info.getValue() === "active" ? "text-green-600" : "text-gray-400"}>
{info.getValue<string>()}
</span>
),
},
{
accessorKey: "joinedAt",
header: "Joined",
cell: (info) => new Date(info.getValue<string>()).toLocaleDateString(),
},
];
export function UsersTable({ data }: { data: User[] }) {
const [sorting, setSorting] = useState<SortingState>([]);
const [globalFilter, setGlobalFilter] = useState("");
const table = useReactTable({
data,
columns,
state: { sorting, globalFilter },
onSortingChange: setSorting,
onGlobalFilterChange: setGlobalFilter,
getCoreRowModel: getCoreRowModel(),
getSortedRowModel: getSortedRowModel(),
getFilteredRowModel: getFilteredRowModel(),
getPaginationRowModel: getPaginationRowModel(),
});
return (
<div>
{/* Search */}
<input
value={globalFilter}
onChange={(e) => setGlobalFilter(e.target.value)}
placeholder="Search all columns..."
className="mb-4 p-2 border rounded"
/>
{/* Table */}
<table className="w-full border-collapse">
<thead>
{table.getHeaderGroups().map((headerGroup) => (
<tr key={headerGroup.id}>
{headerGroup.headers.map((header) => (
<th
key={header.id}
onClick={header.column.getToggleSortingHandler()}
className="text-left p-3 border-b cursor-pointer hover:bg-gray-50"
>
{flexRender(header.column.columnDef.header, header.getContext())}
{{ asc: " ↑", desc: " ↓" }[header.column.getIsSorted() as string] ?? ""}
</th>
))}
</tr>
))}
</thead>
<tbody>
{table.getRowModel().rows.map((row) => (
<tr key={row.id} className="hover:bg-gray-50">
{row.getVisibleCells().map((cell) => (
<td key={cell.id} className="p-3 border-b">
{flexRender(cell.column.columnDef.cell, cell.getContext())}
</td>
))}
</tr>
))}
</tbody>
</table>
{/* Pagination */}
<div className="flex items-center gap-2 mt-4">
<button onClick={() => table.previousPage()} disabled={!table.getCanPreviousPage()}>
Previous
</button>
<span>
Page {table.getState().pagination.pageIndex + 1} of {table.getPageCount()}
</span>
<button onClick={() => table.nextPage()} disabled={!table.getCanNextPage()}>
Next
</button>
</div>
</div>
);
}
Server-Side Pagination
// components/ServerTable.tsx — Fetch data per page from API
const table = useReactTable({
data: serverData.rows,
columns,
pageCount: serverData.pageCount,
state: { sorting, pagination },
onSortingChange: setSorting,
onPaginationChange: setPagination,
getCoreRowModel: getCoreRowModel(),
manualPagination: true, // Server handles pagination
manualSorting: true, // Server handles sorting
});
// Fetch when pagination/sorting changes
useEffect(() => {
fetchData({
page: pagination.pageIndex,
pageSize: pagination.pageSize,
sortBy: sorting[0]?.id,
sortDir: sorting[0]?.desc ? "desc" : "asc",
});
}, [pagination, sorting]);
Row Selection
const [rowSelection, setRowSelection] = useState({});
const columns: ColumnDef<User>[] = [
{
id: "select",
header: ({ table }) => (
<input type="checkbox" checked={table.getIsAllRowsSelected()} onChange={table.getToggleAllRowsSelectedHandler()} />
),
cell: ({ row }) => (
<input type="checkbox" checked={row.getIsSelected()} onChange={row.getToggleSelectedHandler()} />
),
},
// ... other columns
];
// Get selected rows
const selectedUsers = table.getSelectedRowModel().rows.map((r) => r.original);
Examples
Example 1: Admin data table with CRUD
User prompt: "Build an admin table for managing users — sort, filter, paginate, and bulk delete."
The agent will create a TanStack Table with all features, row selection for bulk actions, and a search input.
Example 2: Server-side paginated table
User prompt: "My API returns paginated data. Build a table that fetches page by page."
The agent will set up manual pagination/sorting, fetch data on state change, and handle loading states.
Guidelines
- Headless = you own the markup — style however you want
getCoreRowModelis required — always include it- Add models for features —
getSortedRowModel,getFilteredRowModel, etc. manualPaginationfor server-side — table tracks state, you fetch dataColumnDeffor type safety —accessorKeymaps to data fieldsflexRenderfor cell rendering — renders header and cell components- Row selection with
getToggleSelectedHandler— works with checkboxes - Column visibility —
table.getColumn("email")?.toggleVisibility(false) - Virtualization — combine with
@tanstack/react-virtualfor 100K+ rows - No styles included — use Tailwind, CSS, or any styling solution
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 高价值/高频刚需。TanStack Table 是前端开发中构建数据表格的标准工具,解决排序、筛选、分页等核心需求,具有广泛实用价值
Highlights
- 触发词精准完整,覆盖多种变体如"build a data table"、"sortable table"、"React table"等,边界清晰
Highlights
- Phase/步骤清晰,有出口条件,含端到端示例,frontmatter完整,单文件≤500行
Highlights
- 工具来源明确,参数正确,覆盖主要异常,不可逆操作有确认机制
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 38
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.