DataTable
packages/ui/src/components/data/DataTable.tsx
Import
Subpath export:
@marktiderman/genesis-ui/dataimport { DataTable } from "@marktiderman/genesis-ui/data";Components
Auto-generated from TypeScript source via
react-docgen-typescript.DataTable
| Prop | Type | Default | Description |
|---|---|---|---|
| columns* | DataTableColumn<T>[] | — | |
| getKey* | (item: T) => string | — | |
| items* | T[] | — | |
| clipCells | boolean | false | Clip each cell's content at its column's edge, on one line with an ellipsis for text, so a long link or email doesn't run over the next column on a narrow table. Cells with an inline editor keep their overflow, so the editor's popover and focus ring aren't cut. Default false. |
| columnOrderKey | string | — | Storage key for the user's column order (the app's storage adapter; localStorage on the web). |
| columnVisibility | boolean | true | Enable column visibility toggle dropdown |
| columnVisibilityKey | string | — | Storage key for remembering column visibility (the app's storage adapter; localStorage on the web). |
| density | enum | comfortable | Row height / padding rhythm. - compact: ~32px (py-1 / h-8) - comfortable: default (py-2) - spacious: taller (py-3) |
| emptyMessage | string | — | |
| footer | ((items: T[]) => Partial<Record<string, ReactNode>>) | — | A footer row: each column's cell, by key (totals, say), over the rows shown. |
| footerLabel | ReactNode | — | The footer's label, in the first column when that column has no cell of its own. Default "Total"; with `footerPartial`, words that say it covers only the rows loaded. |
| footerPartial | boolean | false | The footer covers only the rows loaded (server paging), not every row the list matches. |
| groups | DataTableGroups<T> | — | Rows under group headers with counts, a summary and a toggle to close each. |
| keyboardNavigation | boolean | true | Keyboard use of rows when `onRowClick` is set. Each row's open column (see `openColumn`) is a button named by its content, and the table is one tab stop: Tab reaches the current row's button, Enter or Space opens it, ↑/↓ (or j/k) and Home/End move between rows, and x toggles the row's selection when `selectable`. Default true. |
| minWidth | number | "auto" | — | The narrowest the table may be before it scrolls sideways. `"auto"`: each column's pixel width (or its resized width), and 200px for each column without one, so fixed widths never squeeze a flexible column to nothing. A number is that many pixels. Default: none. |
| onRowClick | ((item: T) => void) | — | |
| onSortChange | ((sort: DataTableSort[]) => void) | — | Called with the next header sort whenever a header is clicked. |
| onToggleAll | (() => void) | — | |
| onToggleSelect | ((id: string) => void) | — | |
| openColumn | string | null | — | The column whose cell opens the row (as a button), by key. Default: the first visible column that isn't `editable`. A plain-text cell is wrapped by the button; an `editable` or `render` cell keeps its own content (a link or input stays usable) with the open button beside it, shown when focused. `null` makes no cell a button (mouse only). |
| pagerJumps | boolean | false | The pager with first and last page buttons, "Page n of m" (the catalogue's `page.pageOf`), and "Previous page" / "Next page" as the arrows' names. Default false: arrows and "n / m". |
| pageSize | number | 25 | Initial page size (default 25) |
| pageSizeOptions | number[] | [10, 25, 50, 100] | Page size options (default [10, 25, 50, 100]) |
| pagination | boolean | true | Enable pagination |
| pinnedColumns | { left?: string[]; right?: string[]; } | undefined | — | Columns that stay in view when the table scrolls sideways, by key, on the left and right. `stickyFirstColumn` is shorthand for pinning the first visible column left. |
| renderActions | ((item: T) => ReactNode) | — | |
| reorderableColumns | boolean | true | Let users reorder columns: drag a header, or press Alt+←/→ on its sort button. Default true; the order is kept per device under `columnOrderKey`, and "Reset to defaults" in the Columns menu restores it. |
| resizableColumns | boolean | true | Enable column resizing via drag |
| resizeKey | string | — | Storage key for remembering column widths (the app's storage adapter; localStorage on the web). |
| rowClassName | ((item: T) => string) | — | Classes for a row, after the table's own. |
| rowContextMenu | ((item: T) => ReactNode) | — | The menu a right-click on a row opens (the same items as the row's own menu). |
| rowTone | ((item: T) => DataTableRowTone | null) | — | A row's tone (ADR 0017): a leading bar and a tinted row, from tokens. |
| selectable | boolean | — | |
| selected | Set<string> | — | |
| sort | readonly DataTableSort[] | — | The header sort, controlled: the first entry is the primary sort, later ones break ties (Shift-click adds one). Leave it unset and the table keeps its own sort, starting unsorted. |
| stickyFirstColumn | boolean | — | Make the first column sticky when scrolling horizontally |
| stickyHeader | boolean | true | Sticky header on scroll |
| tree | DataTableTree<T> | — | Tree mode, drawn: `items` are already the tree's visible rows in order (genesis-core's `treeRows`, which `useResourceView` / ResourcePage's `tree` run), so the table doesn't sort them again: a header click reports through `onSortChange`, and the caller sorts within siblings. The table becomes a WAI-ARIA treegrid (`aria-level`, `aria-expanded`, `aria-posinset`, `aria-setsize`), the first column gets the indent and the expand arrow, and on a row's open button → opens a row (then moves to its first child) and ← closes it (then moves to its parent). |
| virtualize | boolean | { height?: number; estimateRowHeight?: number; } | undefined | — | Render only the rows in view, for a long table without pagination (`pagination={false}`). The table scrolls inside a box of `height` px (default 600). Ignored while paginated. |
ThumbnailCell
| Prop | Type | Default | Description |
|---|---|---|---|
| alt* | string | — | |
| src | string | null | — |
LinkCell
| Prop | Type | Default | Description |
|---|---|---|---|
| href | string | null | — | |
| label | string | — |