Registry / Client component
Data Table
A typed client-side table with numeric sorting, search, column visibility, row selection and pagination.
Installation
Preview
Columns
| Launch website | Maya Chen | In progress | $8,400 | |
| Brand system | Alex Rivera | In review | $6,200 | |
| Mobile app | Jordan Lee | Planning | $12,400 | |
| Research sprint | Maya Chen | Completed | $3,100 | |
| Design tokens | Alex Rivera | In progress | $4,800 |
0 selected · 6 records
1 / 2
Usage
tsx
"use client"
import { DataTable } from "@/components/ui/data-table"
<DataTable
label="Projects"
data={[{ id: "launch", name: "Launch website", budget: 8400 }]}
getRowId={row => row.id}
columns={[
{ id: "name", header: "Project", value: row => row.name, hideable: false },
{ id: "budget", header: "Budget", value: row => row.budget },
]}
/>API reference
| Prop | Type | Default | Description |
|---|---|---|---|
data | T[] | — | Client-side records. For very large datasets add a server pagination layer. |
columns | DataColumn<T>[] | — | ID, header, value accessor and optional custom cell, sortable and hideable flags. |
getRowId | (row: T) => string | — | Stable unique row IDs for selection. |
pageSize | number | 5 | Records per page. |
onSelectionChange | (ids: string[]) => void | — | Receives selected row IDs. |