Installation
$ pnpm dlx shadcn@latest add @pdfcn/takumi/data-table
Usage
import { DataTable } from "@/components/pdf/data-table";<DataTable
columns={[{ key: "name", header: "Name" }]}
data={[{ name: "Widget" }]}
/>Variants
Use any TableVariant for the table treatment and size="compact" for denser reports.
<DataTable columns={columns} data={rows} variant="striped" size="compact" />API Reference
DataTable
| Prop | Type | Default |
|---|---|---|
columns | DataTableColumn<T>[] | - |
data | T[] | - |
variant | 'line' | 'grid' | 'minimal' | 'striped' | 'compact' | 'bordered' | 'primary-header' | 'grid' |
footer | Partial<Record<keyof T, string | number>> | - |
stripe | boolean | false |
size | 'default' | 'compact' | 'default' |
noWrap | boolean | false |
style | Style | - |
DataTableColumn
key is the row-field accessor—for example, key: "name" reads row.name. It is not React's reserved key prop.
| Prop | Type | Default |
|---|---|---|
key | keyof T & string | - |
header | string | - |
align | 'left' | 'center' | 'right' | 'left' |
width | string | number | - |
render | (value, row) => ReactNode | - |
renderFooter | (value) => ReactNode | - |