Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Code Block
- Collapsible
- Combobox
- Command
- Context Menu
- Copy Button
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Form
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Menubar
- Native Select
- Navigation Menu
- Page Header
- Pagination
- Panel
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Section Header
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Stat
- Stat Card
- Switch
- Table
- Tabs
- Textarea
- Theme Toggle
- Toggle
- Toggle Group
- Tooltip
- Typography
Data Table
Sortable, paginated tables built with TanStack Table.
| Invoice | Status | Amount |
|---|---|---|
| INV001 | Paid | $250.00 |
| INV002 | Pending | $150.00 |
| INV003 | Unpaid | $350.00 |
Page 1 of 2
01
Installation
Add the data table component with the shadcn CLI.
bash
npx shadcn@latest add https://swiss.ui.unsanity.ai/r/data-table.json02
Usage
tsx
import { DataTable } from "@/components/ui/data-table"03
Examples
Default
| Invoice | Status | Amount |
|---|---|---|
| INV001 | Paid | $250.00 |
| INV002 | Pending | $150.00 |
| INV003 | Unpaid | $350.00 |
Page 1 of 2
import type { ColumnDef } from "@tanstack/react-table"
import { DataTable } from "@/components/ui/data-table"
type Invoice = { invoice: string; status: string; amount: string }
const columns: ColumnDef<Invoice>[] = [
{ accessorKey: "invoice", header: "Invoice" },
{ accessorKey: "status", header: "Status" },
{ accessorKey: "amount", header: "Amount" },
]
<DataTable columns={columns} data={invoices} pageSize={3} />