Web only
Data table
sortable columns + built-in empty state · columns rows rowKey caption?
<DataTable className="w-full max-w-2xl" caption="Invoices this month" rows={INVOICES} rowKey={(r) => r.id} columns={[ { key: 'id', header: 'Invoice', sortValue: (r) => r.id }, { key: 'customer', header: 'Customer', sortValue: (r) => r.customer }, { key: 'status', header: 'Status', cell: (r) => <StatusBadge dot={STATUS_DOT[r.status]}>{r.status}</StatusBadge>, }, { key: 'amount', header: 'Amount', align: 'right', sortValue: (r) => r.amount, cell: (r) => `£${r.amount.toLocaleString('en-GB')}` }, ]}/>Usage
Every list of records in a prototype. Right-align numbers; give each column a sortValue only when sorting it helps.
API
<DataTable columns={[{key,header,cell?,sortValue?,align?}]} rows rowKey caption? />Get it
Already in every copy of the web kit:
import { DataTable } from '@/components/kit/data-table';Details
- Exports
DataTable- Packages
- cn@^0.5.2, lucide-react@^1.52.0
- Installs with
- @halftone-web/empty-state, @halftone-web/table
- Also searched as
- table, grid, list
- Registry JSON
- /r/web/data-table.json
Agents: the whole registry is at /llms.txt.