Genesis
@stable

DataTable

packages/ui/src/components/data/DataTable.tsx

Import
Subpath export: @marktiderman/genesis-ui/data
import { DataTable } from "@marktiderman/genesis-ui/data";
Components
Auto-generated from TypeScript source via react-docgen-typescript.

DataTable

PropTypeDefaultDescription
columns*DataTableColumn<T>[]—
getKey*(item: T) => string—
items*T[]—
clipCellsbooleanfalseClip 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.
columnOrderKeystring—Storage key for the user's column order (the app's storage adapter; localStorage on the web).
columnVisibilitybooleantrueEnable column visibility toggle dropdown
columnVisibilityKeystring—Storage key for remembering column visibility (the app's storage adapter; localStorage on the web).
densityenumcomfortableRow height / padding rhythm. - compact: ~32px (py-1 / h-8) - comfortable: default (py-2) - spacious: taller (py-3)
emptyMessagestring—
footer((items: T[]) => Partial<Record<string, ReactNode>>)—A footer row: each column's cell, by key (totals, say), over the rows shown.
footerLabelReactNode—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.
footerPartialbooleanfalseThe footer covers only the rows loaded (server paging), not every row the list matches.
groupsDataTableGroups<T>—Rows under group headers with counts, a summary and a toggle to close each.
keyboardNavigationbooleantrueKeyboard 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.
minWidthnumber | "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)—
openColumnstring | 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).
pagerJumpsbooleanfalseThe 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".
pageSizenumber25Initial page size (default 25)
pageSizeOptionsnumber[][10, 25, 50, 100]Page size options (default [10, 25, 50, 100])
paginationbooleantrueEnable 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)—
reorderableColumnsbooleantrueLet 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.
resizableColumnsbooleantrueEnable column resizing via drag
resizeKeystring—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.
selectableboolean—
selectedSet<string>—
sortreadonly 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.
stickyFirstColumnboolean—Make the first column sticky when scrolling horizontally
stickyHeaderbooleantrueSticky header on scroll
treeDataTableTree<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).
virtualizeboolean | { 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

PropTypeDefaultDescription
alt*string—
srcstring | null—

LinkCell

PropTypeDefaultDescription
hrefstring | null—
labelstring—