SheetGrid
A spreadsheet grid: virtualized rows, a keyboard-driven active cell and range, in-place editing, and copy and paste through the system clipboard as tab-separated text, so it round-trips with Sheets and Excel. Keys: arrows, Tab and Shift+Tab move; Shift+arrows extend the range; Enter or F2 edits (Enter again saves and moves down); typing starts an edit; Escape cancels; Delete clears; Home/End and Ctrl+Home/End jump; PageUp/PageDown move a screen; Ctrl/Cmd+Z undoes. Why it isn't Radix (docs/FRAMEWORK.md rule 3): Radix has no data grid. The focus model follows the WAI-ARIA grid pattern instead: one tab stop (the grid), the active cell exposed through aria-activedescendant, and aria-selected for the range, so a screen reader announces each move. Virtualization comes from TanStack Virtual (decision 20's spike: stable, headless, actively released; react-data-grid's latest has been a beta for years and brings its own CSS).
packages/ui/src/components/sheet-grid/sheet-grid.tsx
@marktiderman/genesis-ui/sheet-gridimport { SheetGrid } from "@marktiderman/genesis-ui/sheet-grid";react-docgen-typescript.SheetGrid
A spreadsheet grid: virtualized rows, a keyboard-driven active cell and range, in-place editing, and copy and paste through the system clipboard as tab-separated text, so it round-trips with Sheets and Excel. Keys: arrows, Tab and Shift+Tab move; Shift+arrows extend the range; Enter or F2 edits (Enter again saves and moves down); typing starts an edit; Escape cancels; Delete clears; Home/End and Ctrl+Home/End jump; PageUp/PageDown move a screen; Ctrl/Cmd+Z undoes. Why it isn't Radix (docs/FRAMEWORK.md rule 3): Radix has no data grid. The focus model follows the WAI-ARIA grid pattern instead: one tab stop (the grid), the active cell exposed through aria-activedescendant, and aria-selected for the range, so a screen reader announces each move. Virtualization comes from TanStack Virtual (decision 20's spike: stable, headless, actively released; react-data-grid's latest has been a beta for years and brings its own CSS).
| Prop | Type | Default | Description |
|---|---|---|---|
| columns* | SheetGridColumn<T>[] | — | |
| getKey* | (row: T) => string | — | |
| label* | string | — | Accessible name for the grid. |
| onCommit* | (changes: SheetCellChange<T>[]) => void | Promise<void> | — | Save one or more cells. Return a promise to show them as saving until it settles; a rejection marks them failed with the error's message (or the cells a `SheetCommitError` names) and keeps their old values. |
| rows* | T[] | — | |
| className | string | — | |
| empty | ReactNode | — | Shown when there are no rows. |
| footer | ReactNode | — | Rendered after the last row, inside the scroll area (e.g. "Add a record"). |
| height | number | 480 | Viewport height in px. Default 480. |
| onSkipped | ((count: number) => void) | — | Called when a paste or clear touched cells that can't be edited. |
| onUndo | (() => void) | — | Cmd/Ctrl+Z inside the grid. |
| rowHeader | SheetGridRowHeader<T> | — | A pinned column at the left of every row. |
| rowHeight | number | 32 | Row height in px. Default 32. |
parseTsv
Parse spreadsheet clipboard text (tab-separated, quoted when needed).
No declared props.
toTsv
Write a block of cells as spreadsheet clipboard text (the inverse of `parseTsv`).
No declared props.
SheetCommitError
Reject `onCommit` with this to mark specific cells, rather than every cell in the commit, as failed.
No declared props.