This skill should be used when the user asks about "data table", "tanstack table", "sortable table", "filterable table", "table pagination", "column sorting", "row selection", or mentions building data tables, grids, or TanStack Table integration with shadcn.
View on GitHubplugins/shadcn-dev/skills/shadcn-data-tables/SKILL.md
February 2, 2026
Select agents to install to:
npx add-skill https://github.com/nthplusio/functional-claude/blob/main/plugins/shadcn-dev/skills/shadcn-data-tables/SKILL.md -a claude-code --skill shadcn-data-tablesInstallation paths:
.claude/skills/shadcn-data-tables/# shadcn/ui Data Tables
Build powerful data tables with TanStack Table and shadcn/ui components.
## Setup
### Install Dependencies
```bash
npm install @tanstack/react-table
npx shadcn@latest add table
```
### Basic Structure
Data tables consist of:
1. **Column definitions** - Define columns and their behavior
2. **Table instance** - TanStack Table hook
3. **Render** - shadcn Table components
## Basic Data Table
### 1. Define Columns
```tsx
// columns.tsx
"use client"
import { ColumnDef } from "@tanstack/react-table"
export type Payment = {
id: string
amount: number
status: "pending" | "processing" | "success" | "failed"
email: string
}
export const columns: ColumnDef<Payment>[] = [
{
accessorKey: "status",
header: "Status",
},
{
accessorKey: "email",
header: "Email",
},
{
accessorKey: "amount",
header: "Amount",
cell: ({ row }) => {
const amount = parseFloat(row.getValue("amount"))
const formatted = new Intl.NumberFormat("en-US", {
style: "currency",
currency: "USD",
}).format(amount)
return <div className="font-medium">{formatted}</div>
},
},
]
```
### 2. Create DataTable Component
```tsx
// data-table.tsx
"use client"
import {
ColumnDef,
flexRender,
getCoreRowModel,
useReactTable,
} from "@tanstack/react-table"
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table"
interface DataTableProps<TData, TValue> {
columns: ColumnDef<TData, TValue>[]
data: TData[]
}
export function DataTable<TData, TValue>({
columns,
data,
}: DataTableProps<TData, TValue>) {
const table = useReactTable({
data,
columns,
getCoreRowModel: getCoreRowModel(),
})
return (
<div className="rounded-md border">
<Table>
<TableHeader>
{table.getHeaderGroups().map((headerGroup) => (
<TableRow key={headerGroup.id}>
{headerGroup.headers.map((header)