SpreadsheetGrid props
Every prop of SpreadsheetGridProps<T> and its default
One reference for both the React and Solid versions
SpreadsheetGrid props (SpreadsheetGridProps<T>)
T is the row type (an object). Write a generic component that wraps the grid with <T extends object>, as in function MyGrid<T extends object>(props: SpreadsheetGridProps<T>) (the grid component's type parameter is T extends object, while SpreadsheetGridProps<T> has no constraint, so a plain <T> gives TS2322. Adding the same constraint to SpreadsheetGridProps<T> is a candidate for 2.0).
| Name | Type | Default | Description |
|---|---|---|---|
rows | readonly T[] | — | Row data in clientSide mode. Readonly arrays are accepted (the grid never mutates the input array; edits come back as a new array through onRowsChange). Ignored when dataSource is given, which switches to serverSide mode (the two are mutually exclusive). |
columns | readonly GridColumn<T>[] | (required) | The array of column definitions. Readonly arrays are accepted. |
onRowsChange | (nextRows: T[]) => void | — | Called when the rows change (makes rows controlled). |
dataSource | ServerSideDataSource<T> | — | The data source for serverSide (SSRM) mode. When given, only the blocks near the visible window are fetched with getRows as needed, bypassing the clientSide pipeline of rows. With updateRows (optional), cell edits are written back (with optimistic updates) (see "Writing cell edits back"). |
serverSideRefreshToken | number | — | A token for serverSide soft refreshes. Increasing the value discards the cache and refetches the current visible range from the server without changing the query (filters / sorting / global filter). The scroll position is kept, and the count follows the totalRowCount of the arriving blocks (ignored in clientSide). To trigger it imperatively, use the handle's refreshServerSide(), which behaves the same. |
serverSideRefetch | 'skeleton' | 'keep' | 'skeleton' | What serverSide shows when the conditions (sorting / column filters / global filter) change and during a refetch (refreshServerSide() / serverSideRefreshToken) (since 1.5.0). 'skeleton' shows loading rows (the same as up to 1.4). 'keep' keeps showing the previous rows, dimmed, until the new rows arrive (.ssg-root--refetching on the root), shows a moving line below the column headers (.ssg-refetch-bar), and sets aria-busy="true" on the table (role="grid"). Once the new rows for the visible range are all in (or fetching that block fails), they are swapped in at once (new rows never mix in partially). While the previous rows are shown, editing, pasting, deleting and the fill handle are disabled (row positions don't match the new result). The first fetch, and fetches with no previous rows, show loading rows. If writes are being saved, the refetch waits until they settle (the same as up to 1.4). Colors come from the tokens --ssg-refetch-row-opacity / --ssg-refetch-bar / --ssg-refetch-bar-track. With motion set to 'off', the line doesn't move. Ignored in clientSide. Details are in "What shows during a refetch". |
onServerSideLoadError | (error, params) => void | — | Called when serverSide's getRows rejects (aborts are normal cancellations and are not reported). params is the view-space range of the failed request, { startIndex, endIndex }. Called independently of the grid's built-in error bar (retry UI) (for your own toasts / logging). Inline functions are fine (read through a latest ref). |
onServerSideWriteError | (error, params) => void | — | Called when serverSide's dataSource.updateRows rejects. The grid has already rolled back the optimistic update, and params.updates holds the row updates that failed and were rolled back (rowKey / changes / previousRow) (for your own toasts / retry flows. changes holds only the cells that were rolled back; changes already overwritten by a later edit to the same cell are not included. row is the current displayed row with the rolled-back changes applied, including the values of newer edits to the same row). Called independently of the grid's built-in save-failure bar. Inline functions are fine (read through a latest ref). Details are in "Writing cell edits back". |
onColumnsChange | (nextColumns: GridColumn<T>[]) => void | — | Called when the columns change. Pinning from the column menu takes effect only when this is given. The nextColumns passed by column reordering (header drag / the columns panel) and by applyState are reordered by pinning group (left pinned → center → right pinned) (the on-screen order doesn't change. For example, a column declared after a right-pinned column moves the right-pinned column to the end of the array). Pinning from the column menu doesn't change the array order and updates only pinned. Without it, the column menu's pin / reset and the tool panel's "Columns" tab show / hide, reorder and reset can't be used (the current state is still shown). The tooltip explaining why is written for end users ("Column pinning can't be changed in this table" and so on; since 1.0.2. Up to 1.0.1 it said "because onColumnsChange is not given…"). |
rowKeyGetter | (row: T, index: number) => GridRowKey | index based | Returns a stable row key. In React, pass the same function on every render too (define it outside the component or use useCallback). When the function changes, the row order and the aggregates that use it are rebuilt for every row (on large tables, every parent re-render gets slow). |
isRowExportable | (row: T, ctx: { viewRowIndex: number; rowKey: GridRowKey }) => boolean | true for every row | A row filter for copying (Ctrl/Cmd+C TSV) / exportCsv / getExportData. Rows returning false are removed from the output as whole rows (rows only; it doesn't affect the select-all check or pasting). ctx.viewRowIndex is the view row index after filtering / sorting (only scope 'raw' uses the source index in the rows array), and ctx.rowKey is the value of rowKeyGetter. Use it to drop display-only filler such as placeholder rows from the output. |
createRow | () => T | — | A new-row factory that creates the missing rows when a paste runs past the end of the table (called once per overflowing row). The grid adds rows only here and in the entry row (newRow, called once when editing starts in the entry row); without it, the overflow is discarded. To add rows from a button and the like, add them to rows yourself (the grid doesn't call createRow. Not used in serverSide). |
newRow | boolean | GridNewRowOptions<T> | false | Entry row (since 1.10.0). Shows an empty entry row at the end of the table (row number "*"), and typing there adds a row. When editing starts in the entry row, createRow is called once to create the row. Writing a value turns it into a draft (row number "✎"), which is appended to the end of rows on Enter, Tab in the last column, the active cell leaving the entry row, or focus leaving the grid (one onRowsChange, one undo step). Escape in an entry row that isn't being edited discards the draft. Shown only in clientSide (rows + onRowsChange) with createRow and rowKeyGetter and when not readOnly (when something is missing, in serverSide, and with row grouping (rowGroup), it isn't shown and a development warning is logged). The entry row is left out of counts, aggregates, copying, find, export and range selection. { placeholder } changes the text of the empty entry row (a string shows only in the first editable column, a function is per column, '' hides it; defaults to localeText.newRowPlaceholder). { onDraftChange } receives draft changes (the draft row or null). Details are in "Entry row (newRow)". |
createOverflowColumn | (columnIndex: number) => GridColumn<T> | — | A column factory that creates the missing columns when a paste runs past the rightmost column (use with onColumnsChange). |
onPasteSkipped | (params: GridPasteSkippedParams<T>) => void | — | Reports the cells a paste didn't write (since 1.1.0). Called once per paste, only when some cells weren't written (the other cells are written). Each cell in params.cells has row / rowKey / rowIndex (view row) / columnKey / colIndex / text (the pasted text) / reason ('readOnly' = a cell that can't be edited (the column's editable / canEditCell), 'invalid' = a value that fails validation in a validationMode: 'reject' column) / value (for 'invalid', the value the parser read) / message (for 'invalid', the validation message). Columns with validationMode: 'mark' (the default) are written and marked, so they aren't included. Cells outside the table (rows / columns that can't be added without createRow / createOverflowColumn), label rows, group rows, and empty text pasted into cells that can't be edited (since 1.3.0) aren't counted. Details are in "Values that can't be read when pasting". |
pasteFillsSelection | boolean | true | When you select a range of cells and paste, and the copied text divides the range evenly (a single-cell copy, or the range's rows and columns are multiples of the copy), the copy is repeated to fill the whole range (the same as Excel / Google Sheets; since 1.2.0). Data rows (label rows and group rows are skipped) and non-synthetic columns are counted. Column / row selections, ranges that don't divide evenly, and an active cell outside the range paste once. Write rules (cells that can't be edited and 'reject' columns are skipped) and the single undo step are the same as pasting. In serverSide, when the range contains rows not loaded yet, it pastes once (writing only to loaded rows would leave most rows unwritten after select-all and paste). false pastes once from the top left of the range, as up to 1.1. |
excelShortcuts | boolean | GridExcelShortcutsOptions | undefined (cut only) | The same key operations as Excel (since 1.10.0). When nothing is passed, only cut with Ctrl / ⌘+X works (a key that did nothing before). true enables all seven (cut, Ctrl+D copy down, Ctrl+R copy right, Ctrl+Enter in the editor to fill the selection, Ctrl+; today's date, Shift+Space select the row, Ctrl+Space select the column), and false turns off cut too. With an object, keys you don't write stay on, and only the keys set to false are removed ({ fillDown: false }). Details are in "Excel keys (excelShortcuts)". |
copyFormat | 'text' | 'rich' | 'text' | The form written to the clipboard on copy (Ctrl/Cmd+C) and cut (Ctrl/Cmd+X) (since 1.12.0). 'text' is TSV only, as before. 'rich' also writes a table with borders, alignment and colors (text/html) together with the TSV, so pasting into Excel, Google Sheets, Word or email gives a table (pasting into this grid reads the TSV). Ranges over 20,000 cells write TSV only. Details are in "Formatted copy (copyFormat / copyHeaders)". |
copyHeaders | boolean | false | Adds a row of column names (and the rows of column groups (columnGroups)) at the top of a copy (since 1.12.0; works with copyFormat set to 'text' too). Not added for cut or for single-cell copies. When text with headers copied from this grid is pasted back into this grid as is, the header rows are skipped. |
rowHeight | number | depends on density (standard: 36) | The row height (px) of uniform rows. When not given, it comes from the density preset (compact: 28 / comfortable: 44). An explicit value always wins. |
autoHeight | boolean | false | The main switch for auto-height rows (variable row height). In addition, at least one column needs column.autoHeight: true (that column wraps and drives the row height). Active when both are true and there are 50,000 rows or fewer (above that, it falls back to the uniform rowHeight). Details are in "auto-height rows". |
verticalAlign | 'top' | 'center' | — | Vertical alignment of cell contents in rows stretched by auto-height (rows taller than the base rowHeight). When not given, autoHeight columns align to the top (the first line of the wrapped text) and other columns to the middle. 'top' aligns every column to the top, 'center' every column to the middle (a per-column GridColumn.verticalAlign wins). Single-line rows, and grids that don't use auto-height, are always centered. Details are in "auto-height rows". |
estimateRowHeight | number | rowHeight | The estimated height (px) of rows not measured yet. |
headerHeight | number | depends on density (standard: 40) | The height (px) of the header row. When not given, it comes from the density preset (compact: 32 / comfortable: 48). An explicit value always wins. |
density | 'compact' | 'standard' | 'comfortable' | 'standard' | The density preset. Switches the defaults of rowHeight / headerHeight and the size tokens (horizontal cell padding / bar padding / icon button size / relative scale of cell text) at once. 'standard' matches the previous values. Fine-tune by overriding tokens (--ssg-cell-pad-x and so on). Portals such as popovers and menus are not affected. |
theme | 'light' | 'dark' | 'auto' | 'class' | 'light' | The color theme. 'dark' applies the dark preset (a bulk override of tokens with .ssg-theme-dark, a Mantine dark style palette) to the grid itself, all portals (popover / menu / panel), drag ghosts and tooltips. 'auto' follows prefers-color-scheme. 'class' turns dark through CSS when an ancestor has class="dark" or data-theme="dark" (for class-based dark modes such as Tailwind / next-themes / shadcn/ui / HeroUI; the colors are right from the server render. Popups render outside the table (directly under document.body by default; see popupContainer), so put the dark class / attribute on <html> or <body>). For libraries that decide dark mode another way, such as Mantine, pass your resolved value as 'light' | 'dark'. Fine-tune individual colors by overriding tokens (--ssg-*). |
motion | 'auto' | 'on' | 'off' | 'auto' | Enables motion (animations / transitions). 'auto' is treated as 'off' when the OS / browser "reduce motion" setting (prefers-reduced-motion: reduce) is on, and as 'on' otherwise. With 'off', .ssg-motion-off is added to the root, all portals (popover / menu / panel), drag ghosts and tooltips, and the duration tokens (--ssg-motion-fast / --ssg-motion-base / --ssg-motion-slow) become 0, so nothing moves (the result looks the same). 'on' animates regardless of the OS setting. Adjust speeds by overriding the tokens. Details are in "Motion". |
popupContainer | 'auto' | 'body' | HTMLElement | ((gridElement: HTMLElement) => HTMLElement | null | undefined) | 'auto' | Where popups (column menu / column filter / context menu / select options / tool panel / fill handle menu / tooltips / drag ghosts) are rendered (since 1.1.0). 'auto' renders inside a dialog that encloses the grid (<dialog> / popover / aria-modal="true" / role="dialog" / role="alertdialog"); without one, for a grid inside a shadow root, inside the element that wraps the grid directly under that shadow root (since 1.3.0); otherwise document.body. 'body' is always document.body (the same as up to 1.0). An element renders inside it, and a function receives the grid's element and returns where to render (null / undefined means document.body; it is called on every render while a popup is open, never while closed). Details are in "Grids inside dialogs". |
animateRows | boolean | true | Row movement animation. When sorting / filtering / opening or closing groups / replacing rows, rendered rows slide to their new positions (--ssg-motion-base), and rows that appear without scrolling fade in from the top. Rows entering and leaving through virtualization while scrolling are not animated. Automatically disabled for auto-height rows and serverSide (SSRM). Nothing moves when the effective motion is 'off'. Details are in "Motion". |
showCopyRange | boolean | true | After Ctrl/Cmd+C, leaves the same "marching ants" as Excel around the copied range (.ssg-copy-range-overlay; a static dashed line when motion is 'off'). It disappears on Esc and when editing starts, and stops being drawn when sorting / filtering / opening or closing groups / the row count / the columns change (it stays after pasting). false hides it (copying itself works as before). The line for cut (Ctrl/Cmd+X) shows even with false (so you can see what was cut; since 1.10.0). |
hoverHighlight | 'row' | 'cross' | 'row' | What hover highlights. 'row' is only the row under the pointer (as before). 'cross' adds the pointer's column (the column header plus a faint band over the column's other cells, .ssg-col-hover-overlay) and the row number, for a crosshair. Colors come from the tokens --ssg-col-hover-bg (band) / --ssg-select-bg (header and row number). It answers "which column is this value in?" on wide tables without moving your eyes. |
highlightChanges | boolean | false | When rows changes, cells whose values changed flash briefly in the accent color (.ssg-body-cell--changed, --ssg-motion-slow), and default number cells count up from the old value to the new one (--ssg-motion-base; formatted with valueFormatter). Cell edits, pastes, clears, undo / redo and rows replaced from outside all count. clientSide only (disabled in SSRM). Only rendered cells are animated; with more than 200 changed cells only the flash runs, and with more than 2,000, with rows inserted / removed / reordered, or with more than 5,000 rows whose reference changed (a data reload), nothing runs. On screens that replace rows many times a second, the main thread load is high (about twice that of the same table without it when many cells change every 250ms), so leaving it off is recommended there. |
showSaveStatus | boolean | true | For serverSide write-back (dataSource.updateRows), shows a save state mark on committed cells. While saving, diagonal stripes and a small spinner ([data-ssg-save="pending"]); on success, a ✓ badge for 1.3 seconds ("ok"); on failure, a shake, a red flash and a ✕ badge ("failed") plus a chip below the cell (the text is localeText's saveFailedCell, by default 「保存に失敗しました。値を戻しました」 ("Couldn't save. The value was restored."); it disappears after 4 seconds or on scroll). Shown independently of the existing save-failure bar (onServerSideWriteError). Only rendered cells are marked (the saving mark comes back on cells that scroll out and back in). Nothing shows in clientSide. |
rowDragMotion | 'ghost' | 'live' | 'ghost' | How row drag reordering (enableRowDrag) looks. 'ghost' is the original (a ghost and a guide line, sliding to the new position after the drop). With 'live', the grabbed row follows the pointer and the rows it passes move up or down out of the way (the drop target shows as a gap. Releasing outside the frame commits the last position, and Esc puts it back. Losing window focus also puts it back). With motion set to 'off', it is the same as 'ghost'. |
columnDragMotion | 'ghost' | 'live' | 'ghost' | How column header drag reordering (when onColumnsChange is given) looks. 'ghost' is the original (a ghost and a vertical line, sliding to the new position after the drop). With 'live', within the same pane the grabbed column (header plus rendered cells) follows the pointer and the columns it passes move left or right out of the way (the drop target shows as a gap. Releasing outside the frame commits the last position, and Esc puts it back. Losing window focus also puts it back). When moving across the pinned column panes (changing pinning), a copy of the grabbed column (a floating column) follows the pointer, the original pane closes up by the width of the column, and a vertical line shows the destination (the floating column's header shows a pin icon toward a pinned pane / a move arrow toward the center. The floating column stays inside the table frame and slides into its new position when released). With motion set to 'off', it is the same as 'ghost'. |
find | boolean | FindOptions | false | Find in cells. true enables a search bar at the top right of the grid (.ssg-find-bar) and Ctrl/Cmd+F (taken over only while the grid has focus). It matches substrings of the displayed text (after valueFormatter), highlights every match with <mark class="ssg-find-mark">, moves to the next match with Enter / ↓ and the previous one with Shift+Enter / ↑ (the active cell and scroll follow), and closes with Esc. Rows are not hidden (separate from filtering). FindOptions = { shortcut?: boolean (default true; false leaves the browser's own find to the browser), caseSensitive?: boolean (default false), replace?: boolean (default false; true adds the replace row and Ctrl+H. Since 1.12.0. See "Find and replace") }. Scanning is time-sliced (10ms per chunk), so input never stalls. In SSRM, only the loaded range is searched. Matches stop at 10,000 (the count shows +). Details are in "Find in cells". |
onFindChange | (params: FindChangeParams) => void | — | Called when the find state ({ query, matchCount, currentIndex, open, truncated }) changes. currentIndex is zero-based (null when there are no matches). Matches stop at 10,000; when they do, truncated is true (matchCount is 10000, and the built-in bar shows "10000+"; since 1.2.0). Use it to show "3 / 12" in a toolbar and the like. |
rowHeaderWidth | number | 56 | The width (px) of the row number column. The row number column is pinned to the left even without left-pinned columns, and doesn't move when scrolling horizontally (the same as Excel's row headers; since 0.63.0). |
height | number | string | — | The grid's explicit height. What it measures depends on the kind of value. ① A string containing % ('100%' / '50%' / 'calc(100% - 40px)'): the height of the whole grid, including the top bar, filter chip bar and bottom bar. '100%' fits the grid into its parent, and what remains after the bars becomes the scroll area (ssg-root--fill-height is added to the root). This assumes the parent has a definite height; if the parent's height is auto, the grid grows to fit every row and virtualization doesn't work. ② A number (px) / a string without % ('400px' / '50vh' / 'calc(100vh - 120px)'): the height of the scroll area only (the whole grid is taller by the bars). ③ Not given: the scroll area is as tall as its content, clipped by maxHeight. Setting style={{ height }} on the root alone doesn't size the scroll area, so set the height with this prop. |
maxHeight | number | string | — (480px by default) | The maximum height of the scroll area (bars not included; the same whatever kind of height you use). The default of 480px applies only when neither height nor maxHeight is given (the original behavior). With a numeric height, the scroll area is min(height, maxHeight); with a % height, min(maxHeight, parent height − bars) (if the parent is taller, the whole grid shrinks to the bars + maxHeight). |
readOnly | boolean | false | Disables editing for the whole grid. If it switches to true during an edit, the edit ends without being written when committed (canEditCell is also re-evaluated on commit). ctx.setValue in renderCell is not affected and can write even while readOnly (check ctx.readOnly and disable it yourself). Row drag reordering (enableRowDrag) is not affected either (it isn't a cell edit); to stop it, pass enableRowDrag={!readOnly}. |
dimReadOnlyCells | boolean | false | Enables the built-in dimmed look (background + text color) for readonly cells. Even with false, the semantic class .ssg-body-cell--readonly is always added, so you can hook your own CSS to it. |
canEditCell | (rowIndex, colIndex, row, column, ctx) => boolean | — | A per-cell gate for editing. rowIndex is the view row index (the displayed position after filtering / sorting), and the same value is passed on every path: display (the readonly look), starting an edit, committing, pasting, clearing with Delete and IME input. ctx (CanEditCellContext) is { sourceRowIndex, rowKey } = the index in the original rows and the row key (the same basis as cellClassName's ctx; in serverSide, sourceRowIndex equals the view index). Decide things that shouldn't move with sorting / filtering from row or ctx.rowKey. Rows appended by a paste are called with their position after being added and their index in the original rows. Note: up to v0.48, only clientSide pasting and Delete clearing passed the index in the original rows. |
enableUndoRedo | boolean | true | Undo / redo of grid edits (cell edits / pastes / setValue in renderCell). Ctrl/Cmd+Z = undo, Ctrl/Cmd+Shift+Z / Ctrl/Cmd+Y = redo (also the handle's undo() / redo()). clientSide (rows + onRowsChange) only; disabled for serverSide (dataSource) / readOnly / when onRowsChange isn't given. The history holds reference snapshots of the "rows array before the change" (unchanged rows are structurally shared, so it is cheap). It assumes the array received in onRowsChange is passed back to rows as the same reference (rebuilding it with map and the like is treated as an outside change every time, and the history is cleared). When rows are replaced by something other than the grid (a direct setState in the parent and so on), the history is discarded automatically. Undoing typing inside an editor is left to the input's native undo (the grid's undo covers committed edits). |
undoHistoryLimit | number | 100 | The maximum number of undo steps kept. Older ones are discarded first. |
enableClearOnDelete | boolean | true | Clearing the values of the selected cells (or the active cell when nothing is selected) with Delete / Backspace. With false the keys do nothing (passed through). Pasting, overwriting in an editor and undo / redo are not affected (an opt-out for the clearing keys only). |
editorEnterMove | EditorEnterMove | 'down' | Where the active cell moves after committing a built-in editor (text / number / select / date) with Enter ('down' | 'up' | 'right' | 'left' | 'none'; like Excel's "After pressing Enter, move selection (direction)"). 'none' stays in place. With labelRow, moving up or down doesn't stop on label rows and skips to the next data row in the same direction (the same as the ↑ / ↓ keys; if only label rows lie ahead, it stays on the committed row). Tab / Shift+Tab (right / left) and Escape are not affected. Custom editors are not covered because their key bindings are up to you (pass the direction in ctx.commit(value, direction)). |
imeDirectInput | boolean | false | Typing directly with the IME on (the same as Excel / SPREAD). With true, while not editing, the grid keeps focus on a transparent input (the input catcher) over the active cell, and IME conversion starts there. In editable cells with a text editor (no editor / type: 'text'), the text being converted is shown over the cell, and confirming the conversion starts an edit with the confirmed string as the initial value (press Enter again to commit the cell and move). In number editor columns, the confirmed full-width digits, signs, decimal points and thousands separators are converted to half-width before editing starts (「12.5」→ 12.5), and conversions that can't be read as numbers are discarded (a conversion of only 「ー」 or 「。」 starts the edit as typing - / .). In custom editor columns, the confirmed text goes into ctx.initialText and editing starts only when the editor definition has imeDirectInput: true (since 1.2.0). Searchable select editor columns (search and so on) open with the list filtered by the confirmed text (since 1.7.0). time / datetime / calendar date (picker: 'calendar') columns open with the confirmed text as the start of typing (「午後3時」 ("3 PM") → 15:00), and multi-select columns open with the list filtered by the confirmed text if they have search, or with the option found by that text highlighted if not (all since 1.11.0). Other columns (single select without search / date using the browser's date input / checkbox / custom without the flag) and readonly cells discard the conversion (nothing is entered, as before). Keyboard operations / copy and paste / Tab work as before. Why it's off by default: while enabled, document.activeElement is an input whenever the grid has focus, so app shortcuts that don't fire in inputs (for example the default of Mantine's useHotkeys) stop working. Details are in "Typing directly with the IME on". |
onUndoRedoStateChange | (state: UndoRedoState) => void | — | Called when whether undo / redo is possible changes (for reactive UI such as the disabled state of undo / redo toolbar buttons). Not called on the first mount, and not called again for the same value. An inline function created on every render is fine. The argument type UndoRedoState ({ canUndo, canRedo }) can be imported from the package. |
trackChanges | boolean | GridTrackChangesOptions | false | Change tracking (since 1.8.0). Compares cells changed in the grid (edits / pastes / clearing with Delete / the fill handle / checkboxes / setValue in renderCell / undo and redo / the handle's applyRows) with their saved values, and shows a triangle at the top left of differing cells, a dot at the top left of that row's number, and "未保存 2 行・3 セル" ("2 rows, 3 cells unsaved") in the default bottom bar. Typing a cell back to its saved value removes the mark. Get what to send for saving with the handle's getChanges(), call markChangesSaved() after saving, and revertChanges() to discard. Works only in clientSide (rows + onRowsChange) with rowKeyGetter (it tracks by row key; without it, and in serverSide, it does nothing and warns in development). true tracks only changes to cell values, not added or removed rows. { rows: true } also tracks rows added and removed in the grid (since 1.10.0; {} is the same as true). { baseline } shows, in color, the differences between the array of rows you pass and the current rows (showing differences; since 1.13.0, with showRemoved / changedOnly / showOriginal too; see "Showing differences"). Computed columns (columns with only getValue and no setValue) are not counted. Details are in "Change tracking (trackChanges)". |
onChangesChange | (summary: GridChangesSummary) => void | — | Called when the number of unsaved rows and cells ({ rowCount, cellCount }; with trackChanges={{ rows: true }}, also the numbers of added and removed rows addedCount / removedCount) changes (for enabling / disabling a save button and the like; since 1.8.0). Not called on the first render (it stays at 0). If the grid is removed after reporting one or more, it reports 0 (a re-created grid starts at 0, so the count held by the parent is reset). Only while trackChanges is in effect. |
rangeDecorations | readonly GridRangeDecoration[] | — | Range decorations (since 1.13.0). Draws a frame and a label around a range given by row keys and column keys (display only; it has nothing to do with selection, editing, copying or export). GridRangeDecoration = { id, rowKeys, columnKeys, color?, label?, labelColor?, fill?, lineStyle?: 'solid' | 'dashed' }. It is drawn at the current display position after sorting and filtering, and when the range with the same id changes, the frame slides. Details are in "Range decorations (rangeDecorations)". |
enableRangeSelection | boolean | true | Selecting ranges of multiple cells. |
enableRowSelection | boolean | false | Enables checkbox row selection (the master switch). With true, the row header (row number) gutter becomes the hit area for row selection, and Excel-style cell range selection starting from the gutter is turned off (dragging range selection in body cells is unchanged). Checks are O(1), and select-all uses an exclusion set without enumerating keys (constant cost even with 1M rows). |
rowSelectionMode | 'single' | 'multiple' | 'multiple' | Single / multiple selection mode. single is always one row. multiple toggles on click, and selects a range with shift+click / gutter drag. |
enableSelectAllRows | boolean | enableRowSelection && multiple | Enables the select-all checkbox in the top left header corner (tri-state: none/some/all). While rows are hidden by a clientSide filter, it selects / clears only the visible rows (and its state is decided by the visible rows only). With tree data (treeData), it covers every row that matched the filter (including rows inside closed parents, excluding parents that didn't match; since 1.9.0). |
rowSelection | RowSelectionModel | — | The controlled row selection descriptor. { type:'include', rowKeys } = these are selected / { type:'exclude', rowKeys } = everything except these. Select-all can be expressed without listing keys. When given, selection is controlled (no internal state). |
selectedRowKeys | GridRowKey[] | — | A simpler controlled form (sugar for { type:'include', rowKeys }). When used with rowSelection, rowSelection wins. Select-all (exclude) can't be expressed. |
onRowSelectionChange | (model: RowSelectionModel) => void | — | Reports row selection changes (fires whether controlled or uncontrolled). Calling the handle's getSelectedRowKeys() / getSelectedRowData() / getSelectedRowCount() and so on inside the callback returns the new selection. |
enableGlobalFilter | boolean | true | Enables the global filter feature. With false the feature is off and the default top bar's filter input doesn't show (the summary follows showTopBarSummary; to remove the top bar itself, use showTopBar=false). |
globalFilterMatch | 'value' | 'display' | 'both' | 'value' | The text the global filter matches against (since 1.1.0). 'value' is the text of the cell's value (the same as up to 1.0), 'display' is the text on screen (the result of the column's valueFormatter; the value's text for columns without one), and 'both' matches either (for columns whose value and label differ, you can search by code or by label). The label of status chips and the contents of renderCell are not looked at. clientSide only (in serverSide, the global filter text is just passed to the server; with manualFiltering it doesn't filter either). Details are in "Columns whose value and label differ". |
enableColumnFilter | boolean | true | Per-column filters. |
renderFilterDateInput | (ctx: FilterDateInputContext) => ReactNode | the built-in date field | A slot that replaces the date input of dateSet filter conditions with your own component (Mantine's DatePickerInput and the like). The default is the built-in field (free typing + a drill-up calendar). Details are in GridColumn's "Date input for dateSet (default UI)" and "Replacing the date input (renderFilterDateInput)" sections and in Sorting and filtering. |
getFilterOptions | (params: GetFilterOptionsParams<T>) => Promise<{ options: readonly GridSelectFilterOption[]; truncated?: boolean }> | — | Supplies the options asynchronously for set / select / combined (numberSet / textSet / dateSet) columns (a database DISTINCT and the like). Called every time the popover opens with { columnKey, column, columnFilters (active filters of the other columns, excluding this one), globalText, signal }, and signal is aborted on close / column switch (the library doesn't cache). The popover shows loading / failure (with retry) / truncation (truncated). Priority is column.filterOptions (static) > getFilterOptions > collected from rows. Columns with async options can be inverted (exclude). Works in both clientSide and serverSide. Details are in the "Sorting and filtering" guide. |
enableSorting | boolean | true | Enables sorting. Sort from "昇順 / 降順で並び替え" (sort ascending / descending) and the "並び替えを管理…" (manage sorting) panel in the column menu (⋮) (clicking the header itself selects the column range. Clicking a header while holding Shift adds that column to the sort instead of selecting it = each click goes ascending → descending → removed). With false, the sort items disappear from the menu, and a sort loaded with applyState and the like isn't applied. Sort order is decided by value: values readable as numbers → strings (Japanese collation, digits in numeric order) → empty cells (null / undefined / empty string). Empty cells go last in both ascending and descending order (the same as Excel). |
manualFiltering | boolean | false | The grid doesn't do the filtering of column / global filters (manual filtering mode). The filter UI (popover / chip bar / filter management / filtering indicators) and state (GridState.filters / onStateChange) work as before, and rows is shown with the count and order you passed (filtering is your job, for example a WHERE on the server). When rows is empty and filters are set, noMatchingRowsText is shown. Ignored in serverSide (dataSource). Details are in the "Sorting and filtering" guide. |
manualSorting | boolean | false | The grid doesn't do the reordering for sorting (manual sorting mode). The sort UI and state (GridState.sort / onStateChange) work as before, and rows stays in the order you passed. Can be switched without remounting (switching back to false applies client sorting right away). During manual sorting, label rows' sortMode doesn't react and row drag isn't disabled (treated as not sorted). Ignored in serverSide. |
enableColumnResize | boolean | true | The grid default for whether columns can be resized by hand. Inherited by columns without resizable (column.resizable ?? enableColumnResize). |
autoSizeColumns | 'onMount' | 'onDataChange' | false | false | Auto-fits every column width to its content when data arrives. 'onMount' = once, the first time data is loaded / 'onDataChange' = every time rows (the reference) changes (= every data replacement; manual resizes are overwritten) / false = off. Measuring uses the same engine as the column menu's "すべての列の幅を自動調整" (auto-size all columns) (suppressAutoSize / autoHeight columns are excluded). Filtering / sorting / column reordering don't refit. While the grid isn't rendered (inside display: none, such as a hidden tab), it waits without measuring and measures once rendered (since 1.0.1; 1.0.0 measured at width 0 and shrank the columns). Disabled in serverSide (dataSource). Details are in "flex and autoSize". |
showCellOverflowTooltip | boolean | false | In columns where cell content is truncated (…), shows the full text in a tooltip on hover. Only default text cells (not renderCell columns / autoHeight wrapping columns). On hover it checks scrollWidth > clientWidth, so it shows only for cells that are actually clipped. Shares the existing custom tooltip (data-ssg-tooltip). Details are in "Tooltips". |
showValidationMarks | boolean | true | Whether invalid marks (background + a marker at the top right + the message in a tooltip + aria-invalid / aria-description on the cell) are shown. false hides them and skips evaluating the checks (validate and number's min / max / integer) for visible cells. getInvalidCells() and write rejection with validationMode: 'reject' are not affected (separate paths). Build "show marks only on submit" by switching this prop with your own state (see the recipe in "Validation"). |
enableColumnMenu | boolean | true | The column menu (⋮ + right-click on the header). |
enableRowHover | boolean | true | Faintly highlights the whole row on hover. |
hoveredRowIndex | number | null | — | The controlled value of row hover (view row index / null = no hover). When given, the highlight follows this value instead of internal state, and changes from the pointer are only reported through onHoveredRowChange (optionally controlled). Ignored when enableRowHover: false (no highlight, no reports). It is temporary UI state, so it isn't part of GridState / the handle. |
onHoveredRowChange | (viewRowIndex: number | null, ctx: { source: 'pointer' }) => void | — | Reports changes of row hover (called even when uncontrolled). viewRowIndex is the view row index after filtering / sorting. Not called for the same value (pointerenter also fires when moving between cells of the same row). Use it to sync hover between several grids and the like. |
onCellClick | (params: GridCellEventParams<T>) => void | — | Called on a click on a data cell (a data row × one of your columns). Left button only, and only when the press and release happen on the same cell (a range selection drag doesn't count as a click). Called for readonly cells too, and clicks on elements inside the cell (checkboxes and the like) are reported as clicks on that cell. params is GridCellRef<T> ({ row, rowKey, rowIndex, sourceRowIndex, column, columnKey, colIndex, value }) + event (the standard DOM MouseEvent). Not called for column headers / row numbers / group rows / label rows / expanded rows / SSRM rows not loaded yet / synthetic columns (the expand toggle and the row drag handle). Inline functions are fine. Details are in "Cell event callbacks". |
onCellDoubleClick | (params: GridCellDoubleClickParams<T>) => void | — | Called on a double click on a data cell (including a double tap on touch), before the default action (starting an edit if the cell is editable). Called for readonly cells too. params.preventDefault() stops the default action (params.event.preventDefault() doesn't). The cells covered are the same as onCellClick. Inline functions are fine. |
onActiveCellChange | (cell: GridCellRef<T> | null) => void | — | Called when the active cell changes (whatever the cause: click / keys / setActiveCell and so on). null when there is no active cell anymore / it moved to something other than a data cell (a group row / label row / row not loaded / synthetic column). Not called when the row key, column key and position (rowIndex / colIndex) are all the same (setting the same cell again). Called when the coordinates are the same but the row at that position changed through sorting and the like (with activeCellFollows: 'row', not called when the active cell just moved with its row after the order changed). Not called on the first mount. Called after paint (before onCellClick for clicks). Inline functions are fine. |
activeCellFollows | 'position' | 'row' | 'position' ('row' with changedOnly in the diff view) | What the active cell does when the order changes (values changing while sorted, rows added / removed, row drag and so on) (since 1.2.0). 'position' stays at the displayed position (the nth row) and points at whatever row comes to that position (the same as Excel; the same as up to 1.1). 'row' follows the row you clicked (for tables whose values change while sorted, such as a stock ticker board). With 'row', a range within the active cell's row only (some columns of the same row / that row's row selection) moves with it, and a range spanning several rows is replaced by the single active cell when the rows inside the range change (so you never copy, delete or paste over rows you didn't mean to select. The same even if the active cell's row doesn't move; if only rows outside the range change, it stays). Ranges spanning every row (Ctrl+A and the like) and column selections stay. The table doesn't scroll (if the cell moves off screen, the arrow keys move to it). If the followed row disappears or is hidden by a filter, it stays at the position. It doesn't move while dragging a selection, and follows when released. Following through rows added / removed needs rowKeyGetter (without it the row key is the position in rows, so deleting a row above makes the same key point at another row). onActiveCellChange isn't called when only the position moved. clientSide only (serverSide doesn't reorder until a refetch, so it stays 'position'). A cell being edited follows its row either way (with the active cell and the selection). With 'row', when you edit and commit a cell in the sorted column and its row moves, Enter moves to the row that was below it in the order before the commit, and Tab to the next cell of the edited row ('position' moves below / next to that position in the order after the commit). |
enableColumnHeaderHover | boolean | true | Faintly highlights the header cell on column header hover. |
noMatchingRowsText | string | localeText's noMatchingRows ('一致する行がありません') | The overlay text when filtering leaves 0 rows. In serverSide (dataSource), this shows for 0 results while column / global filters are applied, and noRowsText when they aren't. |
noRowsText | string | localeText's noRows ('表示する行がありません') | The text shown when rows is empty. |
loading | boolean | false | Loading display (since 1.15.0). Set it to true while your app is loading rows. With no rows, the body shows skeleton rows (no empty-table message); with rows, the visible part is dimmed and a moving line appears under the column headers (the same look as serverSideRefetch="keep"). While there are rows, editing, pasting, Delete, the fill handle and replacing are stopped. The table gets aria-busy, and the default bottom bar shows 「読み込み中」 where the counts are. Details in "Loading display (loading)". |
ariaLabel | string | — | The accessible name of the table (the element with role="grid"; role="treegrid" for tree data). This is the name screen readers announce for the table; when you put several grids on one screen, set it so they can be told apart (see "Accessibility"). |
showTopBar | boolean | true | Whether the top bar (toolbar) is shown. With false, nothing is rendered regardless of renderTopBar / enableGlobalFilter (the master switch for display; wins over renderTopBar when they conflict). |
showTopBarSummary | boolean | true | Whether the default top bar's summary chips (counts / filter / sort) are shown. Only when renderTopBar isn't given. When both this and showTopBarFilter are hidden, the default top bar isn't rendered (no empty bar). |
showTopBarCounts | boolean | true | Whether the default top bar's Rows / Columns count chips are shown. Only when showTopBarSummary=true (and renderTopBar isn't given). The Filter / Sort chips are not affected. |
showTopBarFilter | boolean | true | Whether the default top bar's global filter input is shown. Only when renderTopBar isn't given. Hidden regardless of this value when enableGlobalFilter=false. |
globalFilterPlaceholder | string | localeText's globalFilterPlaceholder ('グローバルフィルター') | The placeholder of the default top bar's global filter input. Only when renderTopBar isn't given. |
globalFilterIcon | ReactNode | the built-in search icon | The icon on the left of the default top bar's global filter input. Only when renderTopBar isn't given. undefined = the built-in search (magnifier) icon / null (or other falsy) = no icon / any ReactNode = a replacement. The clear button shows as × inside the right edge of the input, and doesn't show while the input is empty. |
localeText | Partial<GridLocaleText> | Japanese | The text the grid shows itself (bars, menus, column filters, the tool panel, find, names for screen readers, validation messages and so on). Pass only the keys you want to change ({ noRows: 'No data' }). {name} parts are replaced with values. For English, use localeTextEn from the /locales/en entry point (localeText={localeTextEn}). The list of keys is in "Text (localeText) and English". |
showBottomBar | boolean | true | Whether the bottom bar (status bar) is shown. With false, nothing is rendered regardless of renderBottomBar (the master switch for display; wins over renderBottomBar when they conflict). |
showBottomBarCounts | boolean | true | Whether the default bottom bar's Rows / Columns count chips (on the left) are shown. Only when renderBottomBar isn't given. Active / Selection / selection statistics / Cols on the right are not affected. |
showSelectionAggregates | boolean | true | When two or more cells are selected, shows aggregates of the selection (average / count / sum) on the right of the default bottom bar (in the free space next to Active / Selection). Cells counted are visible data rows × data columns (rows hidden by filters, group rows, label rows and synthetic columns are excluded). Sum / average count only numbers and numeric strings (the same check as group aggregation), and count counts non-empty cells. Large selections are computed in time slices, showing "集計中…" (aggregating…) meanwhile. In SSRM it computes over loaded rows only and adds "読み込み済みの行のみ" (loaded rows only). With false, nothing is computed and slotContext.selectionAggregates is null (see "Selection aggregates"). Items that don't fit in the bar are hidden whole rather than cut off (hidden in the order average → count → sum; since 1.0.1). |
showFilterChipBar | boolean | false | Whether the filter chip bar (the applied column filters, always shown as chips right below the top bar) is shown (opt-in). With 0 active filters the bar is hidden (no empty bar). Independent of showTopBar. Clicking a chip jumps to its column and opens the filter popover, × clears that one, and "すべてクリア" (clear all) covers column filters only (not the global filter). |
renderTopBar | (ctx: SpreadsheetGridSlotContext<T>) => ReactNode | the built-in top bar | Replaces the top bar. When not given, the built-in top bar (summary chips + filter input; what it contains is controlled by showTopBarSummary / showTopBarFilter, and the filter input needs enableGlobalFilter=true). Not rendered when showTopBar=false, whatever you pass. |
renderBottomBar | (ctx: SpreadsheetGridSlotContext<T>) => ReactNode | the built-in bottom bar | Replaces the bottom bar. When not given, the built-in status bar. Not rendered when showBottomBar=false, whatever you pass. |
className | string | — | The class of the root element. |
style | CSSProperties | — | The inline style of the root element (.ssg-root). Merged with the style of classNames.root, and this one wins. |
classNames | GridClassNames | — | Extra per-part slots. Each value is GridSlotProps (string | { className?, style? }), so you can pass the return value of StyleX's stylex.props(...) as is. All 25 slots are wired (the list and rules are in "Per-part slots"). Passing a new object on every render is fine (memoized by a signature of the contents). The base classes are unlayered with specificity (0,1,0), so classes with the same specificity are decided by load order (for a reliable override, use a chained selector or style.layer.css). Tailwind CSS v4 utilities live in a layer (@layer utilities), so they lose to style.css (unlayered) whatever the load order and have no effect. Use style.layer.css plus a layer order declaration (@layer theme, base, ssg-base, components, utilities;), or add !. |
getRowClassName | (row: T, rowIndex: number, ctx: RowStyleContext<T>) => GridSlotProps | undefined | — | Extra classes per row (or { className, style }). Added to the row container + the row header "#" cell + every data cell, for row highlights with Tailwind / StyleX. style is applied inline, and the grid's coordinates / sizes win (the returned style is memoized by comparing contents). The third argument ctx is { row, rowIndex, sourceRowIndex, rowKey, isSelected, pinned? } (see "Helper types"). Also called for pinned rows (pinnedTopRows / pinnedBottomRows), where ctx.pinned is 'top' / 'bottom' (rowIndex / sourceRowIndex are the position within the pinned rows). Existing two-argument functions keep working (backward compatible). Group rows are not covered. The class and style go on both the row and each cell, so don't return stacking properties such as opacity / filter as style; return a class and target only the row with .ssg-body-row.<class> (a style of opacity: 0.5 becomes 0.25). |
onStateChange | (state: GridState) => void | — | Called with the latest GridState when the persistent slices (manually resized widths / filters / sorting; also the page and rows per page of pagination = since 1.15.0) actually change. A signal for when to save (for example, autosaving to localStorage). The firing rules are in "Saving / restoring state". |
includeGroupingInState | boolean | false | Includes row grouping (each column's rowGroup) and collapsed groups (collapsedGroups) in the state (since 1.2.0). They appear in the values of getState() / onStateChange (opening and closing groups also calls onStateChange), and are restored by applyState / initialState / restoreColumnsFromState. By default they aren't included, as up to 1.1. Details are in "Saving / restoring state". |
initialState | Omit<GridStatePatch, 'columns'> | — | The initial value of the state (column widths / filters / sorting; also pagination's page / pageSize = since 1.15.0). Used only once (on mount); changing it later doesn't change the current state (use applyState for that). It takes effect from the first render, the server render (SSR) and serverSide's first getRows (only the global filter filters.globalText on clientSide tables over 50,000 rows takes effect a little after the first render, because it is evaluated in time slices), and getState() returns it too. On mount, onStateChange / onFiltersChange / onSortChange aren't called. You can pass a getState() value as is (the column metadata columns isn't used. Column order / visibility / pinning are decided by the columns prop. To restore from a saved value, pass the array made with restoreColumnsFromState(columns, saved). A development warning appears only when the order / visibility / pinning visibly differ from the columns prop). Widths / filters / sorting for columns not in the current columns are discarded (with a development warning). Use it to restore from URL queries or saved state. |
onFiltersChange | (filters: GridFilterState) => void | — | Called with a copy of the filter slice (globalText + columnFilters) only when it actually changes. onStateChange is also called for column widths / column metadata, so this is for following filters only, such as building a WHERE from the descriptor. The rules are the same as onStateChange (not on first render / not for the same value / fires for applyState too). |
onSortChange | (sort: GridSortState) => void | — | Called with a copy of the sort state only when it actually changes (to build an ORDER BY and the like). The rules are the same as onFiltersChange. |
onScroll | (params: GridScrollEventParams) => void | — | Reports scroll position changes (throttled with rAF to once per frame; fires for both vertical and horizontal changes). params is { top, left, source, atBottom } (px. atBottom is whether the vertical scroll is at the end = the same check as the handle's isAtBottom(); since 1.2.0). source: 'api' comes from setScrollPosition / scrollTo* (and, on large tables whose scroll position is mapped onto a shrunken range, the adjustment that keeps the rows you're looking at when rows are added or removed); 'user' is everything else (wheel / drag / keyboard, and also when filtering or re-measuring row heights shrinks the table and the browser clamps the position). To sync scrolling both ways between two grids, apply the position to the other grid only when source === 'user' to avoid a loop. Inline functions are fine (through a latest ref). |
enableContextMenu | boolean | false | Enables the context menu feature (the master switch). Off by default, like the other features' enable*. While false, getContextMenuItems isn't called even if given, and right-click shows the browser's own menu. It ships off by default because the feature / UI still has room to improve (opt in explicitly). |
getContextMenuItems | (params: GridContextMenuParams<T>) => GridContextMenuItem[] | — | A fully custom context menu for cells / rows. Called only on right-click and on Shift+F10 / the menu key at the active cell (1.1.0) (once per action), and the menu is drawn from the items you return (the library has no fixed default items). Opting in needs both enableContextMenu={true} and this callback. When not given, or when it returns [], it falls through to the browser's own right-click menu (no empty panel). It doesn't open on SSRM rows not loaded yet. Right-clicking a header is handled by the column menu (enableColumnMenu); this menu is for the body only (cells / the row number gutter). Details are in "Context menu". |
onContextMenuOpen | (params: GridContextMenuParams<T>) => void | — | Reported right after the context menu actually opens (only when it has at least one item and was shown). |
scrollHint | boolean | ScrollHintOptions<T> | — (off) | Scroll position indicator. While scrolling, shows a row number bubble ("row N / total rows" + any column values) and a row ruler next to the scrollbar, and hovering the scrollbar strip previews the jump target ("go to row N"). true means all defaults ({ bubble: true, ruler: true, scrollbar: true, trigger: 'scroll', minRows: 0 }). minRows gates it by data size ("only when the displayed row count is at least this"). It is driven only by the total row count and the scroll position, so it works in every clientSide / SSRM setup. The overlay is pointer-events: none and never interferes with existing interactions. Details are in "Scroll position indicator" and the guide. |
detailRow | DetailRowOptions<T> | — (off) | Expandable rows (master/detail). Inserts a full-width band right below a master row without changing the row order (view index), and renders any React element returned by render inside it (in a card: your own sub-grid / form / summary panel and so on). Active only when given; when not given, existing rendering, state and event paths don't change at all. { render, height?, isExpandable?, showToggleColumn?, className? }. Works in both clientSide and serverSide (serverSide constraints are in the section). Details are in "Expandable rows (master/detail)" and the guide. |
onExpandedDetailRowKeysChange | (keys: GridRowKey[]) => void | — | Called when the set of master row keys of open expandable rows changes (to persist open / closed state or sync it elsewhere). Not called on the first mount. Inline functions are fine (through a latest ref). |
labelRow | LabelRowOptions<T, L> | — (off) | Label rows (headings / separators). Rows in rows for which isLabelRow(row) is true are drawn as "headings not counted as rows", in full-width bands spanning the three panes (their contents can be replaced with any React element through render; they stay at the left edge when scrolling horizontally). They are left out of editing / selection / copying / export by default, and don't use up row numbers. Sorting / filtering stay within the span from one label row to the next (a section) by default (sortMode). sticky: true pins the current section's label right below the column header. { isLabelRow, getLabel, render?, height?, className?, sticky?, sortMode?, keepEmptySections?, exportText? }. A separate feature from row grouping (rowGroup), and the two can't be used together. Details are in "Label rows (headings / separators)" and the guide. |
totalRow | boolean | TotalRowOptions<T> | — (off) | Total row. Pins a total row to the bottom of the table (it doesn't move when scrolling vertically, and follows horizontal scrolling and the left / right pinned columns). Each column's aggregate is decided by GridColumn.aggFunc (shared with row grouping) and recalculated over the data rows after filtering (label rows aren't counted; while grouping, collapsed rows are counted too). Built-in aggregates other than sum show their kind (average / min / max / count) before the value. Display only (not selectable / editable / pasteable / copyable). true uses the defaults; an object takes { label?, values?, renderCell?, height?, className? }. serverSide doesn't compute and shows only the values. Export includes it at the end only with includeTotalRow: true. Details are in "Total row". |
pinnedTopRows | T[] | — (off) | Pinned rows (top). Rows pinned right below the column headers (they don't move when scrolling vertically, and follow horizontal scrolling and the left / right pinned columns). Pass rows to compare against, such as targets, last year's results or averages, as an array separate from the body rows (don't put them in rows). Cells are drawn with the column's valueFormatter / renderCell (ctx.pinned is 'top') / cellClassName / conditional formatting. Display only (not covered by selection / editing / pasting / copying / keyboard navigation / find in cells (find); sorting / filtering don't apply either). Row height is rowHeight. Export includes them only with includePinnedRows: true. Details are in "Pinned rows". |
pinnedBottomRows | T[] | — (off) | Pinned rows (bottom). Rows pinned to the bottom of the table (right above the total row (totalRow) if there is one; below the total row with pinnedBottomRowsPlacement: 'belowTotal'). Otherwise the same as pinnedTopRows (ctx.pinned is 'bottom'). |
pinnedBottomRowsPlacement | 'aboveTotal' | 'belowTotal' | 'aboveTotal' | Where the bottom pinned rows go when there is a total row (totalRow) (since 1.2.0). 'aboveTotal' is right above the total row, 'belowTotal' below it (for rows calculated on from the total, such as subtotal → sales tax → total with tax). Either way they stay at the bottom of the table, and with few rows they come right after the last row. The row order in export (includePinnedRows) and the reading order (aria-rowindex) follow the same arrangement. Does nothing when there is no total row. |
columnGroups | readonly GridColumnGroup[] | — (off) | Column groups (multi-level column headers). Adds rows of headers that group several columns above the column headers (since 1.6.0). Groups are written with column keys (children), and columns stays as is. The number of header rows is decided by the deepest group, and the headers of columns not in a group, columns in shallow groups, and columns the grid adds (such as row numbers) stretch up into the rows above. A group that crosses the boundary of the left / right pinned columns is split per pane, with its name shown in each. Columns can be moved only within their group, and the group header's grip moves the whole group (when onColumnsChange is given). Clicking a group header selects all its columns (Shift extends), and dragging its right edge resizes the columns inside while keeping their proportions. collapsible groups show an open / close button. Group names stay in view when scrolling horizontally. Export includes them only with includeColumnGroups: true. Details are in "Column groups". |
columnGroupHeaderHeight | number | headerHeight | The height (px) of one row of column groups (columnGroups) (since 1.6.0). When not given, the same height as the column header row. |
onColumnGroupOpenChange | (params: ColumnGroupOpenChangeParams) => void | — | Reports opening / closing of column groups (collapsible) (since 1.6.0). Called once per group whose open state changed, whether through the open / close button, setColumnGroupOpen or applyState (not on the first render). params = { groupKey, open, closedGroups } (closedGroups lists the keys of closable groups that are closed). |
treeData | GridTreeDataOptions<T> | — (off) | Tree data (rows with parents and children). Turns flat rows into a tree using the parent row key returned by getParentKey(row), and indents the cells of the column column by depth with an open / close marker (since 1.9.0). Needs rowKeyGetter; clientSide only. { getParentKey, column, defaultOpenDepth? } (defaultOpenDepth is the depth opened at first; default 'all'). Sorting happens among siblings, and filtering shows the matching rows, the rows below them and their parents up the tree. Columns with aggFunc show the aggregate of the leaf rows below in the cells of rows that have children (readonly). Can't be used together with rowGroup / labelRow / enableRowDrag (tree data wins, with a development warning). Details are in "Tree data". |
onTreeRowOpenChange | (params: TreeRowOpenChangeParams) => void | — | Reports opening / closing of tree data (treeData) rows (since 1.9.0). params = { rowKey, open }. Called once per row opened or closed by the marker, the keys (Alt+Shift+↓ / Alt+Shift+↑), setTreeRowOpen, revealRow or moving through find results. Not called for expandAllTreeRows / collapseAllTreeRows / applyState (the current state is getState().closedTreeRows). |
pagination | boolean | GridPaginationOptions | — (off) | Pagination (since 1.15.0). Splits the displayed rows into pages of pageSize rows, shows one page at a time, and puts a pager (the row range, page numbers and 「表示件数」 = rows per page) at the right of the default bottom bar. true uses the defaults (50 rows per page, rows-per-page choices [20, 50, 100]). GridPaginationOptions = { pageSize?, pageSizeOptions?, autoPageSize? }. Row numbers on the handle are continuous across all pages. Details in "Pagination (pagination)". |
onPageChange | (info: GridPageInfo) => void | — | Called when the page or the rows per page change (since 1.15.0). GridPageInfo = { page, pageCount, pageSize, rowCount, firstRow } (page starts at 0). Not called on the first render. Called for the pager buttons, the rows-per-page choice, the handle, going back to the first page after filtering or sorting, and moving the page when rows decrease. |
fillHandle | boolean | FillHandleOptions<T> | — (off) | Fill handle. Shows a small square at the bottom right of the selection (the active cell if nothing is selected), and fills the cells you drag over with a series (1, 2, 3 … / dates / weekday and month names / a trailing number such as P-001) or copies of the cells (Excel's AutoFill). While dragging, the fill range is drawn with a dashed line and the value for the farthest cell appears near the pointer; Ctrl (⌘ on Mac) switches the fill mode, and Escape cancels. After releasing, the button at the bottom right lets you switch between "series / copy cells" (one undo goes back to before the fill). Double-clicking the handle fills down as far as the neighboring column has values. Writes follow the same rules as pasting (cells that can't be edited and validate rejections are skipped / undoable). Not shown when readOnly or when there is nowhere to write (neither onRowsChange nor dataSource.updateRows). true uses the defaults; an object takes { getFillValue? }. Details are in "Fill handle". |
enableRowDrag | boolean | false | Row drag to reorder. Inserts a drag handle column at the start (28px wide, a synthetic column without a title; on the left pinned side if there are left-pinned columns), and grabbing the handle (⋮⋮) moves rows up and down. On commit, the new array after the move goes to onRowsChange (through the history wrapper = undo / redo applies), followed by onRowMove. clientSide (rows + onRowsChange) only; the handle column isn't shown with dataSource (serverSide) / while row grouping / without onRowsChange. While sorting / filtering is applied, the handle is dimmed with a tooltip giving the reason, and dragging is disabled (the column stays). Details are in "Row drag to reorder" and the guide. |
isRowDraggable | (row: T, ctx: RowDragContext) => boolean | every row | Whether each row can be dragged. Rows returning false don't get a handle. ctx = { rowKey, sourceRowIndex }. |
onRowMove | (params: RowMoveParams<T>) => void | — | Called after a row move is committed (right after onRowsChange). params = { rowKey, fromIndex, toIndex, rows } (indexes are based on the original rows array, and rows is the same new array reference as onRowsChange). Also called for moves made with the handle's moveRow(). |
canDropRow | (params: RowDropParams<T>) => boolean | anywhere | Whether a dragged row can be dropped there (since 1.2.0). At positions returning false, no guide line shows and releasing doesn't move the row (rowDragMotion: 'live' stays at the last position where it could be dropped). params = { row, rowKey, fromIndex, toIndex, rowAbove, rowBelow, rows } (fromIndex / toIndex are the same as onRowMove, rowAbove / rowBelow are the rows that will be right above / below the grabbed row after the drop (undefined at the start / end), and rows is the array before the move). It is called every time the drop position changes, so keep it light. It doesn't apply to the handle's moveRow(). |
Showing the bars (top / bottom)
The top / bottom bars are resolved in this order of priority.
showTopBar/showBottomBar(master switches): whenfalse, that bar isn't rendered at all (wins overrender*/enable*).renderTopBar/renderBottomBar(custom): when given, rendered as is. The top bar's content props (showTopBarSummary/showTopBarFilter) don't apply, because your bar decides its own content.- Default bars: the fallback when
render*isn't given.
The default top bar has two parts, summary chips (left) and the global filter input (right), which can be shown independently.
| What you want | Setting |
|---|---|
| Remove the whole bar | showTopBar={false} |
| Summary only (no filter input) | showTopBarFilter={false} |
| Filter input only (no summary) | showTopBarSummary={false} |
| Remove only the row / column counts at the top | showTopBarCounts={false} |
| Remove only the row / column counts at the bottom | showBottomBarCounts={false} |
| Remove the selection aggregates (average / count / sum) | showSelectionAggregates={false} |
| Always show the applied column filters as chips | showFilterChipBar (off by default) |
| Draw the pager in your own bottom bar | renderBottomBar's ctx.pagination ("Pagination (pagination)") |
| Turn off the filter feature itself but keep the summary | enableGlobalFilter={false} |
| A completely custom bar | renderTopBar={(ctx) => …} |
When showTopBarSummary and showTopBarFilter (effectively showTopBarFilter && enableGlobalFilter) are both false, the default top bar isn't rendered (no empty bar).
In the bottom bar, the row / column counts are controlled by showBottomBarCounts and the selection aggregates by showSelectionAggregates (the cell / range / selection size / column count on the right are not affected). To change anything else in it, use renderBottomBar.
With pagination (pagination), the pager is shown at the right of the default bottom bar (since 1.15.0). Tables with showBottomBar={false} show it in a band below the table, and tables with renderBottomBar don't show it and pass ctx.pagination instead (draw it yourself).
Text (localeText) and English
All the text the grid shows itself (the top / bottom bars, the column menu, column filters, the tool panel, find in cells, the fill handle, row group rows, names and tooltips for screen readers, built-in validation messages, serverSide's failure bar, subtotals in export and so on) can be changed with localeText. The default is Japanese. For English, pass localeTextEn from the entry point @ishibashi0112/spreadsheet-grid/locales/en (the English text is a separate entry point, so it isn't in the JS of apps that keep Japanese).
import { SpreadsheetGrid } from '@ishibashi0112/spreadsheet-grid';
import { localeTextEn } from '@ishibashi0112/spreadsheet-grid/locales/en';
// switch to English
<SpreadsheetGrid localeText={localeTextEn} … />
// English, with a few keys changed
<SpreadsheetGrid localeText={{ ...localeTextEn, rowCount: 'Showing {shown} of {total}' }} … />
// keep Japanese and change a few keys (keys you don't pass keep their defaults)
<SpreadsheetGrid localeText={{ noRows: 'データがありません' }} … />- Values are strings or functions (type
GridLocaleTextTemplate). In strings,{name}parts are replaced with values; functions receive the values and return a string (for languages whose wording changes with numbers. Example:filterColumns: ({ count }) => (count === 1 ? '1 column' : `${count} columns`)). Create a table that holds functions outside the component or wrap it inuseMemo(functions are compared by reference, so creating new ones on every render re-renders everything that uses the text every time). - Weekdays (
calendarWeekdays) and months (calendarMonths) are arrays (7 starting from Sunday / 12 starting from January). - In Next.js (App Router),
localeTextEncontains functions, so it can't be passed as props from a server component (the page returns a 500 and static pages fail to build; the types still check). Import it inside the'use client'file that renders the grid, and pass only the language (a string such as'en') from the server. - When you pass a prop that sets text (
noRowsText/noMatchingRowsText/globalFilterPlaceholder/totalRow.label/GridAskBar'splaceholder/label), it wins. - Even in English, date formats (
yyyy/mm/dd), number formats and count numbers (without separators, as inRows 1000000 of 1000000) don't change. Text you supply, such as a column'svalueFormatter, doesn't change either. - Writing
localeText={{ … }}inline is fine: nothing is rebuilt while the contents (strings, arrays, function references) stay the same. - Changing
localeTextmidway (switching languages and so on) changes the grid's text right away. However, a serverSide save-failure popup that is showing when you change it (it disappears in a few seconds) keeps the previous text. - When you put another grid inside, for example, an expandable row (
detailRow) card, passlocaleTextto that grid too (it doesn't inherit the outer grid's text). - Console warnings in development are two lines, one in Japanese and one in English, whatever the language (never in production).
- The text of the AI bar (
GridAskBar/useGridAsk) is passed separately throughGridAskBar'slocaleText("AI bar text (localeText)" in "Filter with words").
List of keys (default and English):
Top / bottom bars
| Key | Default (Japanese) | English (localeTextEn) | Description |
|---|---|---|---|
rowCount | 行 {shown} / {total} | Rows {shown} of {total} | The row count. {shown} = rows shown, {total} = all rows (label rows aren't counted). |
loadingRows | 読み込み中 | Loading… | The text where the counts are in the default bottom bar while loading (loading) (since 1.15.0). |
columnCount | 列 {shown} / {total} | Columns {shown} of {total} | The column count. {shown} = columns shown, {total} = all columns. |
filterSummary | 絞り込み: {value} | Filter: {value} | The filter summary. {value} is none / filterGlobal / filterColumns (joined with + when both). |
filterGlobal | 「{text}」 | "{text}" | The text in the search box ({text}; cut at 16 characters when long). |
filterColumns | {count} 列 | (depends on the number) | The number of column filters ({count}). |
sortSummary | 並び替え: {value} | Sort: {value} | The sort summary. {value} is none, or sortEntry items joined with listSeparator. |
sortEntry | {column}({direction}) | {column} ({direction}) | One sorted column. {column} = the column header, {direction} = sortAscending / sortDescending. |
sortAscending | 昇順 | ascending | Ascending (in the bar summary). |
sortDescending | 降順 | descending | Descending (in the bar summary). |
activeCell | セル {cell} | Cell {cell} | The address of the active cell ({cell}; none when there isn't one). |
selection | 範囲 {range} | Range {range} | The selected range ({range}: B3:D5 / rows 3:5 / columns B:D; none when there isn't one). |
selectionSize | {cells} セル / {rows} 行 | (depends on the number) | The size of the selection. {cells} = number of cells, {rows} = number of rows. |
selectedColumns | {count} 列 | (depends on the number) | The number of columns in the selection ({count}). |
detailColumnName | 詳細 | Details | The name of the expand button column (the address "Details 7" when the active cell is in this column). |
rowDragColumnName | 移動 | Move | The name of the row drag handle column (the address "Move 7"). |
aggregateAverage | 平均 | Average | The average in the selection aggregates. |
aggregateCount | データの個数 | Count | The count in the selection aggregates. |
aggregateSum | 合計 | Sum | The sum in the selection aggregates. |
aggregateComputing | 集計中… {percent}% | Calculating… {percent}% | While aggregating a large selection ({percent} = progress). |
aggregatePartial | 読み込み済みの行のみ | Loaded rows only | The note added when serverSide aggregated while skipping rows not loaded. |
none | なし | — | "None" (when there is no filter / sort / active cell / selection). |
listSeparator | 、 | , | The separator between listed items (sorted columns). |
globalFilterPlaceholder | グローバルフィルター | Filter all columns | The placeholder of the search box in the top bar (the prop globalFilterPlaceholder wins if given). |
globalFilterLabel | 表全体を検索 | Search the whole table | The name screen readers use for the search box in the top bar (when the placeholder is empty). |
clearGlobalFilter | フィルターをクリア | Clear filter | The name screen readers use for the × of the search box in the top bar. |
toggleFilterPanel | フィルター管理パネルを開閉 | Show or hide the filter panel | The tooltip of the filter summary in the top bar (when it can be clicked), and the second half of its name for screen readers (the first half is the visible summary; since 1.0.2. Up to 1.0.1 this text alone was the name). |
paginationLabel | ページ | Pagination | The accessible name of the pager (pagination) (<nav aria-label>; since 1.15.0). |
pageRange | {from}–{to} / {total} 行 | {from}–{to} of {total} | The row range of the current page in the pager (also read out when the page changes). {from} / {to} are rows counted from 1, {total} is the number of rows across all pages. |
pageRangeEmpty | 0 行 | 0 rows | Same as above when there are no rows. |
previousPage | 前のページ | Previous page | The name and tooltip of the pager's ‹ button. |
nextPage | 次のページ | Next page | The name and tooltip of the pager's › button. |
goToPage | ページ {page} | Page {page} | The name of a page number button ({page} starts at 1). |
pageOfPages | {page} / {pageCount} | {page} of {pageCount} | 「3 / 25」 in the pager shrunk for narrow tables. |
pageSizeLabel | 表示件数 | Rows per page | The name of the pager's rows-per-page choice. |
Shared
| Key | Default (Japanese) | English (localeTextEn) | Description |
|---|---|---|---|
clear | クリア | Clear | The "Clear" button / tooltip. |
clearAll | すべてクリア | Clear all | The "Clear all" button. |
close | 閉じる | Close | The "Close" button / name for screen readers. |
apply | 適用 | Apply | "Apply" in column filters. |
retry | 再試行 | Retry | "Retry" when loading fails. |
blank | (空白) | (Blank) | How empty values show (groups, column filter options, condition summaries). |
noOptions | 候補がありません | No options | When there are no options (select editor, column filters). |
Table body and headers
| Key | Default (Japanese) | English (localeTextEn) | Description |
|---|---|---|---|
noRows | 表示する行がありません | No rows to show | When there are 0 rows (the prop noRowsText wins if given). |
noMatchingRows | 一致する行がありません | No matching rows | When filtering leaves 0 rows (the prop noMatchingRowsText wins if given). |
selectAllRows | すべての行を選択 | Select all rows | The name screen readers use for the header checkbox. |
selectRow | 行 {row} を選択 | Select row {row} | The name screen readers use for a row checkbox ({row} = row number). |
sortedAscending | 昇順で並び替え中 | Sorted ascending | The tooltip of the sort indicator in the header. |
sortedDescending | 降順で並び替え中 | Sorted descending | The tooltip of the sort indicator in the header. |
sortPriority | (優先度 {priority}) | (priority {priority}) | The priority when sorting by several columns (appended to the two above). |
columnFiltered | フィルター適用中 | Filtered | The tooltip of the filter indicator in the header. |
dragColumn | ドラッグで列を移動 | Drag to move the column | The tooltip of the header grip. |
columnMenu | 列メニュー | Column menu | The tooltip of the header's ⋮. |
columnMenuFor | {column} の列メニュー | Column menu for {column} | The name screen readers use for the header's ⋮. |
showDetails | 行 {row} の詳細を開く | Show details for row {row} | The name screen readers use for the expand button when closed ({row} = the same row number as the row header). |
hideDetails | 行 {row} の詳細を閉じる | Hide details for row {row} | The name screen readers use for the expand button when open ({row} = the same row number as the row header). |
expandGroup | {group} を展開 | Expand {group} | The name screen readers use for a group row's ▸. |
collapseGroup | {group} を折りたたみ | Collapse {group} | The name screen readers use for a group row's ▾. |
groupRowCount | ({count}件) | (depends on the number) | The count on a group row ({count} is the number with thousands separators). |
editCell | {column} を編集 | Edit {column} | The name screen readers use for a cell's editor. |
cellInput | セルへの入力 | Cell input | The name screen readers use for the input catcher of imeDirectInput. |
sizingColumns | 列幅を計算中… | Sizing columns… | While column widths are being auto-sized. |
applyingFilter | 適用中 {percent}% | Filtering {percent}% | While the search box text is being applied on a large table. |
dragRow | ドラッグで行を移動 | Drag to move the row | The tooltip of the row drag handle. |
dragRowDisabled | ソート / フィルター適用中は行を並び替えできません | Rows can't be moved while the table is sorted or filtered | The handle's tooltip when rows can't be moved. |
dragRowDisabledRemoved | 削除した行を表示している間は行を並び替えできません | Rows can't be moved while removed rows are shown | The handle's tooltip while the diff view shows removed rows (showRemoved) (since 1.13.0). |
dragRowLabel | 行 {row} | Row {row} | The text on the drag shadow while moving a row (when the first column is empty). |
scrollHintRow | 行 {row} | Row {row} | The row number in the scroll bubble ({row} is the number with thousands separators). |
scrollHintJump | 行 {row} へ | Go to row {row} | The row number when pointing at the scrollbar track. |
scrollHintJumpSeparator | ・ | · | The separator between the row number and the extra info (scrollHint's hintColumn / renderHint) when pointing at the scrollbar track. |
scrollHintTenThousands | {value}万 | {full} | Ruler ticks at multiples of 10,000 ({value} = the number in units of 「万」 (10,000), {full} = the original number with thousands separators). |
Column menu
| Key | Default (Japanese) | English (localeTextEn) | Description |
|---|---|---|---|
menuFilter | フィルター… | Filter… | "Filter…" in the column menu. |
menuSortAscending | 昇順で並び替え | Sort ascending | Ascending in the column menu. |
menuSortDescending | 降順で並び替え | Sort descending | Descending in the column menu. |
menuManageSort | 並び替えを管理… | Manage sorting… | Managing sorting in the column menu. |
menuManageFilters | フィルターを管理… | Manage filters… | Managing filters in the column menu. |
menuGroupBy | この列でグループ化 | Group by this column | Grouping in the column menu. |
menuUngroup | グループ化を外す | Ungroup | Ungrouping in the column menu. |
menuPin | 列の固定 | Pin column | Pinning in the column menu. |
menuPinNone | 固定しない | No pin | "No pin" in the pin submenu. |
menuPinLeft | 左に固定 | Pin left | Left in the pin submenu. |
menuPinRight | 右に固定 | Pin right | Right in the pin submenu. |
menuPinUnavailable | この表では列の固定を変えられません | Pinning can't be changed in this grid. | The pin tooltip when there is no onColumnsChange. |
menuAutosize | この列の幅を自動調整 | Autosize this column | Auto-sizing the width in the column menu. |
menuAutosizeAll | すべての列の幅を自動調整 | Autosize all columns | Auto-sizing all column widths in the column menu. |
menuColumns | 列の表示 | Choose columns | "Choose columns" in the column menu (opens the tool panel's columns tab). |
menuResetColumns | 列のリセット | Reset columns | Resetting columns in the column menu. |
resetColumnsHint | すべての列の幅・固定・表示・並び順・グループ化を初期状態に戻します | Restores the width, pinning, visibility, order and grouping of all columns. | The tooltip of the column reset (column menu and tool panel). |
menuResetUnavailable | この表では列をリセットできません | Columns can't be reset in this grid. | The column reset tooltip when there is no onColumnsChange. |
Tool panel
| Key | Default (Japanese) | English (localeTextEn) | Description |
|---|---|---|---|
toolPanelFilters | フィルター | Filters | A tool panel tab. |
toolPanelSort | 並び替え | Sort | A tool panel tab. |
toolPanelColumns | 列 | Columns | A tool panel tab. |
toolPanelLabel | ツールパネル | Tool panel | The name screen readers use for the tool panel (a dialog) (since 1.1.0). |
columnsPinnedLeft | 左固定 | Pinned left | A heading in the columns tab. |
columnsUnpinned | 固定なし | Not pinned | A heading in the columns tab. |
columnsPinnedRight | 右固定 | Pinned right | A heading in the columns tab. |
columnsHideAll | すべての列を非表示(先頭の列は残ります) | Hide all columns (the first one stays) | The all-columns checkbox in the columns tab (when all are shown). |
columnsShowAll | すべての列を表示 | Show all columns | The all-columns checkbox in the columns tab. |
columnsDragToReorder | ドラッグして並べ替え | Drag to reorder | The tooltip of a grip in the columns tab. |
columnsDragWithinSection | ドラッグして並べ替え(同じセクション内のみ) | Drag to reorder (within the same section) | The tooltip of a grip in the columns tab (when there are pinning sections). |
columnsReorderUnavailable | この表では列を並べ替えられません | Columns can't be reordered in this grid. | The grip tooltip when there is no onColumnsChange. |
columnsReorderWhileSearching | 検索中は並べ替えできません | Columns can't be reordered while searching. | The grip tooltip while searching in the columns tab. |
columnsGroupedHint | グループ化している列です(値は自動グループ列に出ます) | This column is grouped. Its values appear in the group column. | The tooltip of a grouped column. |
columnsToggleGroup | {group} の列をまとめて表示 / 非表示 | Show or hide the columns in {group} | The tooltip of a column group (columnGroups) heading in the columns tab (since 1.6.0). {group} is the group's title. |
columnsDragWithinGroup | ドラッグして並べ替え(同じグループ内のみ) | Drag to reorder (within the same group) | The grip tooltip of a column inside a group in the columns tab (since 1.6.0). |
groupedColumnTitle | {column}(グループ化中) | {column} (grouped) | The name of a grouped column (in the columns tab and in the list of columns to add a filter to). |
columnsSearchPlaceholder | 検索... | Search… | The search box in the columns tab. |
columnsNoMatches | 該当する列がありません | No matching columns | When a search in the columns tab finds nothing. |
columnsReset | すべての列を初期状態に戻す | Reset all columns | The reset button in the columns tab. |
columnsUnavailable | この表では列の表示/非表示とリセットは使えません | Showing, hiding and resetting columns isn't available in this grid. | The columns tab tooltip when there is no onColumnsChange. |
globalFilterTitle | グローバルフィルター | Global filter | The row for the search box text in the filters tab. |
globalFilterRows | "{text}" を含む行 | Rows containing "{text}" | The summary of the search box text in the filters tab. |
clearGlobalFilterTitle | グローバルフィルターをクリア | Clear the global filter | The × for the search box text in the filters tab. |
noColumnFilters | 適用中の列フィルターはありません | No column filters | When there are no column filters in the filters tab. |
addFilterLabel | フィルターを追加する列を選択 | Choose a column to filter | The name screen readers use for "add" in the filters tab. |
addFilter | + フィルターを追加… | + Add filter… | "Add" in the filters tab. |
addFilterNone | + 追加できる列がありません | + No columns to add | When no columns can be added in the filters tab. |
sortPanelEmpty | 並び替えは設定されていません | No sorting | When there is no sorting in the sort tab. |
sortPanelDrag | ドラッグして優先順位を変更 | Drag to change the priority | The tooltip of a grip in the sort tab. |
sortPanelDisabled | 並び替えが無効です | Sorting is turned off | The tooltip when sorting is disabled. |
sortPanelNeedsTwo | レベルが 2 件以上のとき並べ替えできます | Add a second level to reorder | The grip tooltip when there is only one sort level. |
sortPanelAscending | 昇順 | Ascending | The tooltip and screen reader name of the ascending button in the sort tab. |
sortPanelAscendingShort | 昇順 | Asc | The text shown on the ascending button in the sort tab (preceded by ↑; kept short so it doesn't take too much width from the column select). |
sortPanelDescending | 降順 | Descending | The tooltip and screen reader name of the descending button in the sort tab. |
sortPanelDescendingShort | 降順 | Desc | The text shown on the descending button in the sort tab (preceded by ↓). |
sortPanelRemove | このレベルを削除 | Remove this level | The × of a sort level. |
sortPanelAllUsed | すべての列が並び替えに使われています | All columns are already used | The tooltip when no columns can be added. |
sortPanelAddHint | 並び替えの基準を追加します | Add a sort level | The tooltip of "Add level". |
sortPanelAdd | + 基準を追加 | + Add level | The "Add level" button. |
sortPanelClearHint | すべての並び替えを解除します | Remove all sorting | The tooltip of "Clear all". |
sortPanelReadOnly | 並び替えが無効のため編集できません | Sorting is turned off, so it can't be changed | The tooltip of the column select when sorting is disabled. |
Filter chips and summaries
| Key | Default (Japanese) | English (localeTextEn) | Description |
|---|---|---|---|
filterHiddenColumn | (非表示列) | (hidden) | The marker for a filter on a hidden column (appended right after the header, so the English starts with a space). |
filterGroupedColumn | (グループ化中) | (grouped) | The marker for a filter on a grouped column (the English starts with a space). |
filterJumpUnavailable | 非表示列のためジャンプ編集できません(× でクリアは可能) | This column is hidden, so its filter can't be opened here. You can still clear it with ×. | The tooltip of a filter on a hidden column. |
filterEditUnderGroup | グループの列の見出しの下で編集 | Opens under the group column header | The tooltip of a filter on a grouped column. |
filterJump | この列へジャンプして編集 | Go to this column to edit | The tooltip of a filter chip. |
filterEditFor | {column} のフィルターを編集 | Edit the filter on {column} | The second half of a filter chip's screen reader name (the first half is the visible column name and condition; since 1.0.2. Up to 1.0.1 this text alone was the name), and the screen reader name of ✎ in filter management. |
filterClear | この列のフィルターをクリア | Clear this column's filter | The tooltip of a filter chip's ×. |
filterClearFor | {column} のフィルターをクリア | Clear the filter on {column} | The screen reader name of a filter chip's ×. |
filterNone | フィルターなし | No filter | The summary of a filter without conditions. |
filterCustom | カスタム条件 | Custom filter | The summary of a custom filter (when the value isn't a string). |
filterExcluded | {count} 件を除外 | (depends on the number) | The summary of a value selection (excluding; 3 or more, or 0. In tables that change only this key and not filterExcludedValues, also 1-2). |
filterExcludedValues | {values} を除外 | Excluding {values} | The summary of a value selection (excluding; 1-2 values are listed). |
filterSelected | {count} 件を選択 | {count} selected | The summary of a value selection (3 or more). |
filterMatches | "{value}" に一致 | Is "{value}" | The summary of a select filter. |
filterBoth | {condition} かつ {set} | {condition} and {set} | The summary when there are both a condition and a value selection. |
filterCurrentNone | (なし) | (none) | When the column filter has no "current value". |
filterCurrentExcluded | {count}件を除外中 | (depends on the number) | The column filter's "current value" (value selection, excluding). |
filterCurrentSelected | {count}件を選択中 | {count} selected | The column filter's "current value" (value selection). |
Conditions (summaries and column filters)
| Key | Default (Japanese) | English (localeTextEn) | Description |
|---|---|---|---|
conditionGreaterThanOrEqual | {value} 以上 | ≥ {value} | A condition summary. |
conditionGreaterThan | {value} より大きい | > {value} | A condition summary. |
conditionLessThanOrEqual | {value} 以下 | ≤ {value} | A condition summary. |
conditionLessThan | {value} 未満 | < {value} | A condition summary. |
conditionEquals | {value} に等しい | = {value} | A condition summary ({value} is quoted in text columns). |
conditionNotEquals | {value} に等しくない | ≠ {value} | A condition summary. |
conditionRange | {min} 〜 {max} | {min} – {max} | A range condition summary. |
conditionOnOrAfter | {value} 以降 | On or after {value} | A date condition summary. |
conditionOnOrBefore | {value} 以前 | On or before {value} | A date condition summary. |
conditionContains | "{value}" を含む | Contains "{value}" | A text condition summary. |
conditionStartsWith | "{value}" で始まる | Starts with "{value}" | A text condition summary. |
conditionEndsWith | "{value}" で終わる | Ends with "{value}" | A text condition summary. |
conditionBlank | (空白) | (Blank) | The summary of the blank condition. |
conditionNotBlank | (空白でない) | (Not blank) | The summary of the not-blank condition. |
datePresetToday | 今日 | Today | A built-in date preset. |
datePresetThisMonth | 今月 | This month | A built-in date preset. |
datePresetLast30Days | 過去 30 日 | Last 30 days | A built-in date preset. |
operatorEquals | に等しい | Equals | A column filter operator. |
operatorNotEquals | に等しくない | Does not equal | A column filter operator. |
operatorGreaterThanOrEqual | 以上 | Greater than or equal to | A column filter operator. |
operatorGreaterThan | より大きい | Greater than | A column filter operator. |
operatorLessThanOrEqual | 以下 | Less than or equal to | A column filter operator. |
operatorLessThan | 未満 | Less than | A column filter operator. |
operatorBetween | 範囲 | Between | A column filter operator. |
operatorContains | を含む | Contains | A column filter operator. |
operatorStartsWith | で始まる | Starts with | A column filter operator. |
operatorEndsWith | で終わる | Ends with | A column filter operator. |
operatorOnOrAfter | 以降 | On or after | A column filter operator. |
operatorOnOrBefore | 以前 | On or before | A column filter operator. |
operatorBlank | 空白 | Blank | A column filter operator. |
operatorNotBlank | 空白でない | Not blank | A column filter operator. |
Column filters
| Key | Default (Japanese) | English (localeTextEn) | Description |
|---|---|---|---|
filterTitle | 列フィルター: {column} | Filter: {column} | The column filter heading. |
filterCollecting | 候補を収集中… {percent}% | Collecting values… {percent}% | While collecting the options of a large column. |
filterOptionsLoading | 候補を取得中… | Loading values… | While waiting for getFilterOptions. |
filterOptionsLoadingShort | 取得中… | Loading… | Same as above (the short form for columns with both a condition and values). |
filterOptionsFailed | 候補の取得に失敗しました | Couldn't load the values | When getFilterOptions fails. |
filterOptionsFailedShort | 取得失敗 | Failed | Same as above (short form). |
filterOptionsTruncated | (先頭のみ・打ち切り) | (first values only) | When there are too many options and the list is cut short. |
filterSearchPlaceholder | 検索(Enter で確定) | Search (Enter to apply) | The search box of the value list. |
filterSelectAll | (すべて選択) | (Select all) | "Select all" in the value list. |
filterSelectAllResults | (検索結果をすべて選択) | (Select all results) | "Select all" in the value list while searching. |
filterNoOptionsSource | 候補が未指定です(serverSide では列に filterOptions などの候補供給が必要) | No values. With serverSide, give the column filterOptions or another source of values. | When there are no options in serverSide. |
filterNoMatches | 一致する候補がありません | No matching values | When a search in the value list finds nothing. |
filterSelectedCount | 選択中: {selected} / {total} 件 | Selected {selected} of {total} | The number selected in the value list. |
filterShownCount | (表示中 {count} 件) | ({count} shown) | The number shown while searching in the value list. |
filterMatchCount | 一致 {count} 件 | (depends on the number) | The count in the values heading (while searching). |
filterTotalCount | 全 {count} 件 | {count} total | The count in the values heading. |
filterOptionCount | 候補数: {count} | Values: {count} | The number of options in a select filter. |
filterAll | (すべて) | (All) | "All" in a select filter. |
filterConditionSection | 条件 | Condition | The heading for columns with both a condition and values. |
filterValuesSection | 値 | Values | The heading for columns with both a condition and values. |
filterOperator | 条件の演算子 | Operator | The screen reader name of the operator select. |
filterValue | 条件の値 | Value | The screen reader name of the condition value input. |
filterValuePlaceholder | 値 | Value | The placeholder of the condition value input. |
filterMin | 下限 | Min | The lower bound of a range. |
filterMax | 上限 | Max | The upper bound of a range. |
filterRangeSeparator | 〜 | – | The mark between the lower and upper bounds of a range. |
filterNoValue | この演算子は値入力を使いません | This operator doesn't take a value | When the blank operator is chosen. |
filterDate | 条件の日付 | Date | The screen reader name of the date input. |
filterStartDate | 開始日 | Start date | The start of a date range. |
filterEndDate | 終了日 | End date | The end of a date range. |
filterTextPlaceholder | 部分一致で絞り込み | Contains… | The input of a text filter. |
filterTextHint | 部分一致検索です | Matches text anywhere in the value | The description of a text filter. |
filterCurrentValue | 現在値: {value} | Current: {value} | The current value of the column filter. |
treeExpand | 展開する | Expand | ▸ in the date value list. |
treeCollapse | 折りたたむ | Collapse | ▾ in the date value list. |
dateTreeYear | {year} 年 | {year} | A year in the date value list. |
dateTreeMonth | {month} 月 | (depends on the number) | A month in the date value list ({month} = 1-12). |
dateTreeDay | {day} 日 | {day} | A day in the date value list. |
Date calendar
| Key | Default (Japanese) | English (localeTextEn) | Description |
|---|---|---|---|
calendarWeekdays | 日 月 火 水 木 金 土 | Su Mo Tu We Th Fr Sa | Weekdays (7, starting from Sunday). |
calendarMonths | 1月 2月 3月 4月 5月 6月 7月 8月 9月 10月 11月 12月 | Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec | Months on the month picker (12, starting from January). |
calendarTitle | {year}年 {month}月 | (depends on the number) | The heading of the day picker ({month} = 1-12). |
calendarYear | {year}年 | {year} | The heading of the month picker. |
calendarOpen | カレンダーを開く | Open calendar | The calendar button. |
calendarClose | カレンダーを閉じる | Close calendar | The calendar button (when open). |
calendarPrevious | 前へ | Previous | Previous in the calendar. |
calendarNext | 次へ | Next | Next in the calendar. |
calendarChangeView | 表示単位を切り替える | Change view | The heading button of the calendar. |
calendarBack | ← 戻る | ← Back | Back in the calendar. |
calendarToday | 今日 | Today | Today in the calendar. |
Find in cells and fill
| Key | Default (Japanese) | English (localeTextEn) | Description |
|---|---|---|---|
findLabel | セル内検索 | Find in cells | The screen reader name of the find bar. |
findPlaceholder | 検索 | Find | The placeholder of the find input. |
findInput | 検索文字列 | Search text | The screen reader name of the find input. |
findSearching | 検索中… | Searching… | While searching. |
findNoResults | 0 件 | No results | When find has no matches. |
findPrevious | 前のヒットへ | Previous match | The screen reader name of find's ↑. |
findPreviousHint | 前へ(Shift+Enter) | Previous (Shift+Enter) | The tooltip of find's ↑. |
findNext | 次のヒットへ | Next match | The screen reader name of find's ↓. |
findNextHint | 次へ(Enter) | Next (Enter) | The tooltip of find's ↓. |
findClose | 検索を閉じる | Close find | The screen reader name of find's ×. |
findCloseHint | 閉じる(Esc) | Close (Esc) | The tooltip of find's ×. |
findReplaceShow | 置換の欄を開く | Show replace | The screen reader name of the ▸ that opens the replace row. |
findReplaceHide | 置換の欄を閉じる | Hide replace | The screen reader name of the ▸ that closes the replace row. |
findReplaceToggleHint | 置換(Ctrl+H) | Replace (Ctrl+H) | The tooltip of the ▸ that opens the replace row. |
findReplacePlaceholder | 置換後 | Replace | The placeholder of the replace-with input. |
findReplaceInput | 置換後の文字 | Replacement text | The screen reader name of the replace-with input. |
findReplace | 置換 | Replace | The replace button. |
findReplaceHint | 今の当たりを置換して次へ(Enter) | Replace this match and go to the next (Enter) | The tooltip of the replace button. |
findReplaceAll | すべて置換 | Replace all | The replace all button. |
findInSelection | 選んだ範囲だけ | In selection | The "selected range only" checkbox. |
findReplacing | 置換中… | Replacing… | While replace all is running. |
findReplaced | {replaced} 件を置換しました | Replaced {replaced} | The result of replacing (when no cells were skipped; {replaced} = number replaced). |
findReplacedSkipped | {replaced} 件を置換、{skipped} 件は置換できないため飛ばしました | Replaced {replaced}, skipped {skipped} that cannot be replaced | The result of replacing (when some cells were skipped). |
findReplaceNothing | 置換するものがありません | Nothing to replace | When replace all found no matches. |
findReplaceCellSkipped | このセルは変更できないため飛ばしました | Skipped: this cell cannot be changed | When the current match's cell was skipped (a cell that can't be changed). |
findReplaceCellUnsupported | この列は置換できないため飛ばしました | Skipped: this column cannot be replaced | When the current match's cell was skipped (a kind of column that can't be replaced in: numbers, dates, columns whose display is rewritten and so on). |
findReplaceCellNotOption | 候補に無い名前になるため飛ばしました | Skipped: the result is not one of the options | When the current match's cell was skipped (in a select column, the result would be a name that isn't an option). |
findReplaceCellInvalid | 入力の検査で断られたため飛ばしました({message}) | Skipped: {message} | When the current match's cell was skipped (rejected by validation; {message} = the validation message). |
findReplaceCellUnchanged | 置き換えても値が変わらないため飛ばしました | Skipped: the value would not change | When the current match's cell was skipped (replacing wouldn't change the value). |
findInSelectionNeedsRange | 先に表で 2 つ以上のセルを選んでください | Select two or more cells first | When "selected range only" is turned on without a range. |
findReplaceInterrupted | 表が変わり続けたため置換をやめました(何も置換していません) | Stopped: the table kept changing (nothing was replaced) | When the table kept changing during replace all and replacing was abandoned. |
fillOptions | オートフィル オプション | Auto Fill Options | The tooltip of the fill button and the name of its menu. |
fillOptionsCurrent | オートフィル オプション({kind}) | Auto Fill Options ({kind}) | The screen reader name of the fill button ({kind} = fillSeries / fillCopy). |
fillSeries | 連続データ | Fill Series | The fill menu. |
fillCopy | セルのコピー | Copy Cells | The fill menu. |
Validation, saving and aggregates
| Key | Default (Japanese) | English (localeTextEn) | Description |
|---|---|---|---|
invalidValue | 入力値が不正です | Invalid value | The message when validate returns false / an empty string. |
enterNumber | 数値で入力してください | Enter a number | The number editor check (not a number). |
enterInteger | 整数で入力してください | Enter a whole number | The number editor check (integer). |
enterMin | {min} 以上で入力してください | Enter {min} or more | The number editor check (min only). |
enterMax | {max} 以下で入力してください | Enter {max} or less | The number editor check (max only). |
enterRange | {min}〜{max} で入力してください | Enter a number from {min} to {max} | The number editor check (min and max). |
enterDate | 日付で入力してください(例: 2026/3/15) | Enter a date (e.g. 2026-03-15) | When input typed into a date editor (including picker: 'calendar' editors) can't be read as a date. The mark for date's strict. |
enterTime | 時刻で入力してください(例: 9:30) | Enter a time (e.g. 9:30) | When text typed into a time editor can't be read as a time. The mark for time's strict (since 1.11.0). |
enterDateTime | 日時で入力してください(例: 2026/3/15 9:30) | Enter a date and time (e.g. 2026-03-15 09:30) | Same as above (datetime editor). |
saveFailedCell | 保存に失敗しました。値を戻しました | Couldn't save. The value was restored. | The chip below a cell whose serverSide save failed (showSaveStatus). |
loadFailed | 行の取得に失敗しました({count} ブロック) | (depends on the number) | The bar shown when serverSide loading fails. |
dismissLoadError | エラー通知を閉じる | Dismiss the error | The screen reader name of its ×. |
saveFailed | 変更の保存に失敗しました({count} 行)。値を元に戻しました | (depends on the number) | The bar shown when a serverSide save fails. |
dismissSaveError | 保存エラー通知を閉じる | Dismiss the save error | The screen reader name of its ×. |
totalRowLabel | 合計 | Total | The text at the left end of the total row (totalRow.label wins if given). |
totalAverage | 平均 | Avg | The kind of aggregate in the total row / group rows. |
totalMin | 最小 | Min | The kind of aggregate in the total row / group rows. |
totalMax | 最大 | Max | The kind of aggregate in the total row / group rows. |
totalCount | 個数 | Count | The kind of aggregate in the total row / group rows. |
pinnedTopRow | 上に固定 {row} | Pinned to top {row} | The screen reader name of the row header (the pin mark) of top pinned rows (pinnedTopRows). {row} is the position counted from 1. |
pinnedBottomRow | 下に固定 {row} | Pinned to bottom {row} | The screen reader name of the row header of bottom pinned rows (pinnedBottomRows). |
selectSearchLoading | 候補を取得中… | Loading options… | While the searchable select editor (loadOptions) is fetching options (since 1.7.0). |
selectSearchFailed | 候補の取得に失敗しました | Couldn't load the options | When that fetch fails (with "Retry" = retry next to it). |
selectSearchNoMatch | 一致する候補がありません | No matching options | When no option matches the typed text in the searchable select editor (noOptions if there are no options when it opens). |
multiSelectSeparator | 、 | , | The separator joining the values of a multi-select column (select's multiple) (since 1.11.0). Used in cell tooltips, copying, CSV, export and the text for find and the global filter, and pasted text is split by it (and by 「、」 「,」 「,」). |
multiSelectHint | Space で選ぶ、Enter で確定、Esc で取り消し | Space to select, Enter to save, Esc to cancel | The usage hint below the list of the multi-select editor (not shown when empty). |
multiSelectSearchHint | 打って Enter で足す、Enter で確定、Esc で取り消し | Type and press Enter to add, Enter to save, Esc to cancel | The usage hint for columns with search (search / loadOptions) (not shown when empty). |
multiSelectLoading | 候補を取得中… | Loading options… | While the multi-select editor (loadOptions) is fetching options. |
multiSelectFailed | 候補の取得に失敗しました | Couldn't load the options | When that fetch fails (with "Retry" = retry next to it). |
multiSelectNoMatch | 一致する候補がありません | No matching options | When no option matches the typed text in the multi-select editor (noOptions if there are no options when it opens). |
dateEditorCalendar | {column} のカレンダー | Calendar for {column} | The screen reader name of the calendar in date / datetime editors (since 1.11.0). {column} is the column's title. |
timeEditorList | {column} の時刻 | Times for {column} | The screen reader name of the time list (picker: 'list') in the time editor. |
dateTimeEditorTime | 時刻 | Time | The name of the time input below the calendar in the datetime editor (timeInput). |
contextMenuCell | セルのメニュー | Cell menu | The screen reader name of the context menu (enableContextMenu) opened on a cell (since 1.2.0). |
contextMenuRow | 行のメニュー | Row menu | Same as above (opened on a row number). |
expandColumnGroup | {group} を開く | Expand {group} | The screen reader name and tooltip of the open button in the header of a closed column group (columnGroups' collapsible) (since 1.6.0). {group} is the group's title. |
collapseColumnGroup | {group} を閉じる | Collapse {group} | Same as above (the close button of an open group). |
expandTreeRow | {row} を開く | Expand {row} | The screen reader name and tooltip of the open / close marker of a closed tree data (treeData) row (since 1.9.0). {row} is the value of the tree column (the text after valueFormatter, with surrounding whitespace trimmed; when empty, treeRowNumber's "Row 3"). |
collapseTreeRow | {row} を閉じる | Collapse {row} | Same as above (the close marker of an open row). |
treeRowNumber | 行 {row} | Row {row} | For the above, the {row} of rows whose tree column value is empty or whitespace only ({row} is the row number; since 1.9.0). |
dragColumnGroup | ドラッグで {group} を移動 | Drag to move {group} | The screen reader name and tooltip of the grip in a column group header (moves the group's columns together) (since 1.6.0). |
exportSubtotal | {label} 小計 | {label} subtotal | Subtotal rows in export (includeGroupRows). |
unsavedChanges | 未保存 {rows} 行・{cells} セル | (depends on the number) | The count in the default bottom bar for change tracking (trackChanges) (since 1.8.0). {rows} is the number of rows with unsaved cells, {cells} the number of cells. |
unsavedCell | 未保存(変更前: {value}) | Unsaved (was {value}) | The tooltip and screen reader description of an unsaved cell. {value} is the saved value (the text after valueFormatter). |
unsavedEmptyValue | (空) | (empty) | The {value} above when it is empty. |
unsavedChecked | オン | checked | The {value} above (when it was on in a checkbox column). |
unsavedUnchecked | オフ | unchecked | Same as above (when it was off). |
unsavedRow | 未保存の変更あり | Has unsaved changes | The screen reader description of the row number of a row with unsaved cells. |
unsavedInClosedTreeRow | 閉じた中に未保存の変更あり | Has unsaved changes inside | The screen reader description of a closed tree data parent's row number when there are unsaved rows inside it (since 1.9.0). |
unsavedAddedRows | 追加 {rows} 行 | (depends on the number) | In the bottom bar count with trackChanges={{ rows: true }}, the number of rows added in the grid (since 1.10.0). |
unsavedRemovedRows | 削除 {rows} 行 | (depends on the number) | In the same count, the number of rows removed in the grid (since 1.10.0). |
unsavedRowChanges | 未保存 {changes} | Unsaved: {changes} | The same count when there are no unsaved cells, only added or removed rows. {changes} is unsavedAddedRows / unsavedRemovedRows joined (since 1.10.0). |
unsavedSeparator | ・ | , | The text that joins those counts (「未保存 2 行・3 セル・追加 1 行」; since 1.10.0). |
unsavedAddedRow | 追加した行(未保存) | Added row (unsaved) | The screen reader description of the row number of a row added in the grid (since 1.10.0). |
diffChanges | 変更 {cells} セル({rows} 行) | (depends on the number) | The number of changed cells in the bottom bar of the diff view (trackChanges' baseline) (since 1.13.0). {cells} is the number of cells, {rows} the number of rows with changed cells. The added and removed counts are unsavedAddedRows / unsavedRemovedRows, joined with unsavedSeparator. |
diffComparing | 比べています… | Comparing… | The bottom bar text while a large table is being compared for the first time (since 1.13.0). |
diffPrevChange | 前の変更へ | Previous change | The name of the ▲ button in that bottom bar (since 1.13.0). |
diffNextChange | 次の変更へ | Next change | The name of the ▼ button (since 1.13.0). |
diffChangedCell | 変更(前: {value}) | Changed (was {value}) | The tooltip and screen reader description of a changed cell in the diff view. {value} is the baseline value (the text after valueFormatter; empty is unsavedEmptyValue) (since 1.13.0). |
diffChangedRow | 変更あり | Has changes | The screen reader description of the row number of a row with changed cells in the diff view (since 1.13.0). |
diffAddedRow | 追加した行 | Added row | The screen reader description of the row number of an added row (a row not in the baseline) in the diff view (since 1.13.0). |
diffRemovedRow | 削除した行 | Removed row | The screen reader name of the row number of a removed row with showRemoved in the diff view (since 1.13.0). |
diffNavCell | {row} の {column}: {change}({position} / {total}) | {column} of {row}: {change} ({position} of {total}) | What is announced (aria-live) when ▲ ▼ (goToNextChange / goToPrevChange) in the diff view moves to a changed cell. {row} is the text of the row's first data column, {column} the column's title, {change} the diffChangedCell text, {position} / {total} the position / the number of places visited (since 1.13.0). |
diffNavRow | {change}: {row}({position} / {total}) | {change}: {row} ({position} of {total}) | What is announced when it moves to an added / removed row. {change} is diffAddedRow / diffRemovedRow (since 1.13.0). |
diffNoChanges | 変更はありません | No changes | The empty table text with changedOnly in the diff view when there are no changes at all (instead of noMatchingRows; diffComparing while comparing) (since 1.13.0). |
revertCellChanges | このセルの変更を取り消す | Revert this cell | An item of the context menu's params.revertItems (cell). |
revertRowChanges | この行の変更を取り消す | Revert this row | Same as above (row). |
revertSelectionChanges | 選択範囲の変更を取り消す | Revert the selection | Same as above (selection). |
newRowPlaceholder | ここに入力して行を追加 | Type here to add a row | The text shown in the first editable column of the empty entry row (newRow) (since 1.10.0). To change it per table, use newRow={{ placeholder }}. |
newRowHeader | 新しい行 | New row | The screen reader name of the entry row's row number ("*") (since 1.10.0). |
newRowDraftHeader | 新しい行(下書き) | New row (draft) | The screen reader name of the row number ("✎") of an entry row with values written (a draft) (since 1.10.0). |
Selection aggregates (showSelectionAggregates)
Select two or more cells and the right side of the default bottom bar shows average / count / sum, the same as Excel's status bar (on by default).
- Cells counted are the visible data rows × data columns within the selection. Rows hidden by filters, group rows, label rows and synthetic columns (row drag / expand toggle / automatic group column) are excluded.
- Sum / average count only numbers and numeric strings (the same check as group aggregation's
aggFunc; whitespace-only strings, booleans andDatearen't counted). Count is the number of non-empty cells (notnull/undefined/ empty string). When there are no numbers at all, only the count shows; when only empty cells are selected, nothing shows. - For columns that hold digit strings that aren't quantities, such as JAN codes, postal codes or employee numbers, set the column's
selectionAggregate: falseto leave them out of sum / average (and min / max inslotContext) (they are still counted; since 1.2.0). The same goes for select editor columns: if the value (code) is a digit string ('10'/'8'), it is counted in sum / average even though the cell shows the label ("課税 10%" (10% tax)) (counting uses the value). AddselectionAggregate: falseto columns you don't want counted. - The value is the
getValueresult if there is one (the display-onlyvalueFormatterisn't applied). Shown with up to 4 decimal places and thousands separators. - Selections that scan more than 50,000 cells (select-all and the like) are computed in time slices so as not to block the main thread, showing "集計中… N%" (aggregating… N%) meanwhile. When an edit changes values, it recomputes (keeping the previous result on screen meanwhile; even if rows change often, the value updates each time a computation finishes).
- In the default bottom bar it sits in the free space next to the right group (Active / Selection …), without changing the bar's height or the position of other items (when it doesn't fit it is cut at the edge, and hovering shows the full text).
- Nothing is computed when there is no place to show it (the bottom bar, or your own
renderTopBar). - In SSRM it computes over loaded rows only and adds "読み込み済みの行のみ" (loaded rows only).
- In your own bars (
renderTopBar/renderBottomBar), the same values are available asslotContext.selectionAggregates(GridSelectionAggregates, which also includes min / max).
renderBottomBar={(ctx) => {
const agg = ctx.selectionAggregates;
return (
<div className="my-statusbar">
{agg?.status === 'computing' && <span>Calculating…</span>}
{agg?.status === 'ready' && agg.sum !== undefined && (
<span>Sum {agg.sum} / Min {agg.min} / Max {agg.max}</span>
)}
</div>
);
}}Fill handle (fillHandle)
With fillHandle, a small square (the fill handle) appears at the bottom right of the selection (the active cell when nothing is selected). Dragging it fills cells, as with Excel's AutoFill, either by continuing the original values (a series) or by repeating them (copying the cells).
<SpreadsheetGrid rows={rows} onRowsChange={setRows} columns={columns} fillHandle />
// replace the filled values (example: round the "qty" column to multiples of 10)
<SpreadsheetGrid
rows={rows}
onRowsChange={setRows}
columns={columns}
fillHandle={{
getFillValue: ({ column, defaultValue }) =>
column.key === 'qty' && typeof defaultValue === 'number' ? Math.round(defaultValue / 10) * 10 : defaultValue,
}}
/>FillHandleOptions<T> (when an object is passed to fillHandle):
| Name | Type | Default | Description |
|---|---|---|---|
getFillValue | (params: GridFillValueParams<T>) => unknown | — | Decides the value written to each filled cell. The returned value is written as is (return params.defaultValue to keep the default). Not called for cells that can't be edited. It is also called for the tooltip while dragging (the value of the farthest cell), so keep it free of side effects. Returned values also go through validate, and rejected values aren't written. |
GridFillValueParams<T> (the argument of getFillValue):
| Field | Type | Description |
|---|---|---|
column | GridColumn<T> | The column of the cell being filled. |
row | T | The row of the cell being filled (before writing). |
rowIndex | number | The view row index of the cell being filled. |
sourceValues | readonly unknown[] | The original values, in the fill direction, with the last element nearest to the filled cell (when filling up / left, they are listed from the bottom / right). |
index | number | The position, with 0 right after the original range (label rows / group rows aren't counted). |
direction | GridFillDirection | The fill direction ('down' | 'up' | 'right' | 'left'). |
kind | GridFillKind | How this column (when filling up / down) / row (when filling left / right) is filled ('series' | 'copy'). |
defaultValue | unknown | The value written by default. |
- Using it: press the handle and drag up / down or left / right (the direction farther from the original range wins). The dashed line is the range to fill, and the value near the pointer is what goes into the farthest cell. Dragging toward the edge of the table scrolls automatically. Holding
Ctrl(⌘on Mac) switches the fill mode, andEscapecancels (keys pressed while dragging aren't passed to the grid). On release, the original range + the filled range are selected (the active cell stays). - Default fill mode: decided per column (when filling up / down) / per row (when filling left / right). Values whose progression is clear become a series; a single number, a single digits-only string and values without a progression are copied. Filling select editor columns up / down also copies (since 1.7.0; advancing
C-0005would give a different option or a code that isn't an option).Ctrl/⌘switches this (a single number increases by 1). Dragging up / left continues backward (above1, 2, 3comes0, -1 …; a single original value steps back by 1, and dates go to the previous day). - Series rules:
- Numbers: with two or more, continue along a least-squares line (for an arithmetic sequence, by its difference:
1, 3→5, 7). Floating-point errors are rounded. Numeric strings ('1.5') follow the same rule and return strings, with decimals matched to the most decimal places in the original values ('1.50', '1.75'→'2.00', '2.25'). - Dates:
Dateand'YYYY-MM-DD'/'YYYY/MM/DD'strings (the format is kept). If the day is the same and the month difference is constant, by month (2026-01-15, 2026-02-15→2026-03-15; days that don't exist in a month are rounded to the month's end), otherwise by day (one day at a time for a single value). - Weekday / month names: Japanese (
月/月曜/月曜日,1月) and English abbreviated / full (Mon/Monday,Jan/January). English capitalization follows the last value. - Strings ending in a number (
P-001,No.9): when the prefix is the same, the trailing number advances. Zero padding keeps its width only when the last value starts with 0. - Times / date-times (time / datetime editor columns; since 1.11.0): a single time steps by 1 hour, two or more follow a line in minutes (
09:00, 09:15→09:30, wrapping within 0:00-23:59). A single date-time steps by 1 day; if the times are all the same, the same rules as dates apply (including by month), otherwise a line in minutes. Unreadable text is copied. When filling left / right, only when the original columns are all of the same kind. - Original values that include empty cells, mixed types and booleans are always copied (dragging from empty cells empties the fill range, the same as Excel).
- Numbers: with two or more, continue along a least-squares line (for an arithmetic sequence, by its difference:
- The button after filling: appears at the bottom right of the filled range. Pressing it opens a menu (series / copy cells), and choosing again rebuilds from the values before the fill (the history stays one entry = one undo goes back to before the fill). If columns / rows were filled in mixed modes, choosing one fills every column / row that way (values without a progression stay copies). When no values can form a series, "series" can't be chosen. When there is no room at the bottom right (the bottom of the table, the total row or the bottom of the visible area), it shows above the corner. It disappears when the selection changes, a cell's value changes from outside, the columns change, sorting / filtering / group open state changes, or editing starts.
- Double-click: double-clicking the handle (the visible square) fills down as far as the column on the left (the right if the left has no values) has values. It stops before cells in the fill column that already have values, label rows / group rows and rows not loaded, and never overwrites existing values.
- Write rules: the same as pasting. Cells that can't be edited because of
readOnly/ the column'seditable: false/canEditCellare skipped, and cells rejected byvalidatearen't written (markwrites and shows the error). Values are written with their types kept (no conversion from strings, unlike pasting). In clientSide, everything goes toonRowsChangeat once, and it can be undone / redone. - What is skipped: label rows / group rows (not counted in positions either) / synthetic columns (row drag / expand toggle / automatic group column) / the total row. While filtered / sorted, cells are filled in displayed order, and hidden rows aren't written. Rows are never added past the end of the table.
- When it isn't shown:
readOnly, nowhere to write (noonRowsChangein clientSide / nodataSource.updateRowsin serverSide), while editing, while selecting a range, while rows / columns are selected, and when the selection is only synthetic columns / only label rows or group rows (no values to fill from). - serverSide (
dataSource): available only withdataSource.updateRows(optimistic updates and rollback on failure are the same as editing). Rows not loaded aren't written, and columns / rows whose original range includes rows not loaded aren't filled. There is no undo / redo (as everywhere in serverSide). Choosing again from the button works only while the row order is the same as when you filled. Choosing again writes over the rows as they are then, so cells that the second choice doesn't write (because of avalidaterejection and the like) keep the value from the first fill. - Keyboard / assistive technology: the handle is a pointer-only part and isn't announced (
aria-hidden). With the keyboard, copy / paste does the same. The button after filling hasaria-haspopup="menu", and the menu isrole="menu"+role="menuitemradio"(↑ / ↓ to move,Escape/Tabto close). - Look: the handle
.ssg-fill-handle, the dashed line.ssg-fill-preview, the root while dragging.ssg-root--filling, the button.ssg-fill-options, the menu.ssg-menu-panel.ssg-fill-menu, the value tooltip.ssg-tooltip.ssg-fill-tooltip. Tokens--ssg-fill-line(the dashed line color; text color by default) /--ssg-fill-handle-ring(the handle's outline; the cell background by default). The handle's color is--ssg-accent.
Change tracking (trackChanges)
Marks cells changed in the grid as "unsaved", and lets you take out what to send for saving (since 1.8.0). After saving, clear the marks with markChangesSaved().
const gridRef = useRef<SpreadsheetGridHandle<Row>>(null);
const [unsaved, setUnsaved] = useState(0);
<SpreadsheetGrid
ref={gridRef}
rows={rows}
onRowsChange={setRows}
rowKeyGetter={(row) => row.id}
columns={columns}
trackChanges
onChangesChange={({ rowCount }) => setUnsaved(rowCount)}
/>
const save = async () => {
const grid = gridRef.current;
if (!grid || grid.getInvalidCells().length > 0) return; // check the input first
const changes = grid.getChanges();
await api.save(changes.rows.map(({ rowKey, row, columnKeys }) => ({ id: rowKey, columnKeys, row })));
// mark only what was sent as saved (cells retyped while waiting for the save stay unsaved).
grid.markChangesSaved(changes);
};- What is tracked: changes made by the grid (cell edits, pastes, clearing with
Delete, the fill handle, checkboxes,setValueinrenderCell, undo / redo, the handle'sapplyRows). The value before a cell first changes is kept as its saved value, and cells whose current value differs are unsaved (values are compared withObject.is; since 1.13.0,Dateis compared by time. Typing a cell back to its saved value removes the mark). Adding, removing and reordering rows aren't tracked (a row that was only added isn't counted as unsaved. If you edit cells after adding it, the edited cells become unsaved, with the values at the time it was added as the saved values). Computed columns (columns with onlygetValueand nosetValue) aren't counted. rowsreplaced from outside: replacingrowsfrom outside (new values from the server and the like) doesn't change the saved values. In unsaved rows, columns you didn't change show the outside value as is, and changed columns keep being compared with the saved value (the replaced value shows as is; if the outside value becomes equal to the saved value, the mark disappears).applyRows(next, { undoable: false })is also treated as an outside change. When a row is removed from outside, its record is discarded too.- Making received values the saved values: pass save responses, other people's updates and refetched rows with
applyRows(next, { asSaved: true }). The values you pass become the saved values, and cells being edited keep their current values and stay unsaved (reverting goes back to the passed value). Cells whose current value equals the passed value lose their marks. Nothing is added to the undo history, and the current history isn't cleared. If the server returns corrected values (trimming whitespace, assigning numbers), callmarkChangesSaved(changes)first and then pass the returned rows (cells whose sent values were marked saved take the returned values). If only some rows came back, pass them layered over the current rows (applyRows((prev) => prev.map((row) => returned.get(key(row)) ?? row), { asSaved: true })). Passed rows that are the same as current rows (===, rows that didn't come back) aren't treated as server values, so cells edited, rows added and rows removed while waiting stay unsaved (since 1.10.0; up to 1.9, passing layered rows made the changes made while waiting saved too). - Per grid: the records belong to each grid and are lost when the grid is removed (a re-created grid starts from 0; removing it reports 0 to
onChangesChange). - Changes the parent didn't take: when the parent doesn't render the
rowspassed throughonRowsChange(rejecting them after validation and the like), that change isn't counted (no marks, no count, not ingetChanges()). When it renders a copy of the receivedrows([...next]or one with corrected values), it is counted.getChanges()called insideonRowsChangeincludes that change. - When a column is removed: unsaved values of columns removed from the
columnsarray keep being counted (in the row number dot, the count andcolumnKeysofgetChanges()). Putting the column back brings the cell marks back (columns hidden withvisible: falseare counted the same way). - Marks: an 8px triangle at the top left of unsaved cells (the child element
.ssg-unsaved-mark; its color is the token--ssg-unsaved-indicator, the accent color by default), a dot at the top left of the row number of rows with unsaved cells (.ssg-row-header-cell--unsaved), and "未保存 2 行・3 セル" (2 rows, 3 cells unsaved) in the default bottom bar (.ssg-bar-chip--unsaved; hidden at 0). Cells get.ssg-body-cell--unsavedand a tooltip and screen reader description "未保存(変更前: 120)" (unsaved, was 120) (the previous value is the text aftervalueFormatter. If there is an input error or a note, the order is "error → note → unsaved"). Rows get.ssg-body-row--unsaved, and row numbers the screen reader description "未保存の変更あり" (has unsaved changes). The text comes fromlocaleText'sunsavedChanges/unsavedCell/unsavedEmptyValue/unsavedChecked/unsavedUnchecked/unsavedRow. - Reverting: the handle's
revertChanges(rowKeys?)(everything when omitted), or the context menu'sparams.revertItems("このセルの変更を取り消す" (revert this cell), "この行の変更を取り消す" (revert this row), "選択範囲の変更を取り消す" (revert the selection); included only when the target has unsaved cells, otherwise[]). You build the menu yourself, so put them in the array you return to use them (getContextMenuItems={(params) => [...(params.revertItems ?? []), ...yourItems]}). A revert is added to the undo history as one change, soCtrl/Cmd+Zgoes back to before it. The text comes fromrevertCellChanges/revertRowChanges/revertSelectionChanges. - Marking as saved:
markChangesSaved()marks everything saved,markChangesSaved(rowKeys)those rows, andmarkChangesSaved(changes)(thegetChanges()result you sent for saving) only the values you sent. It doesn't change values, so nothing is added to the history. If you undo after marking as saved and the restored value differs from the saved value, it becomes unsaved again. Cells retyped / undone between sending and the save finishing stay unsaved if their current value differs from what was sent (the sent value becomes the saved value). - Your own bars:
slotContext.unsavedChanges({ rowCount, cellCount }; withtrackChanges={{ rows: true }}, alsoaddedCount/removedCount.nullwhentrackChangesisn't in effect). - When it works: in clientSide (
rows+onRowsChange) withrowKeyGetter. In serverSide (dataSource) and withoutrowKeyGetter, it does nothing and warns in development. Calling the handle's methods while it isn't in effect does nothing (getChanges()is empty; a development warning once per grid and per method). /lite: the feature part ischangeTrackingFeature(createSpreadsheetGrid({ features: { changeTracking: changeTrackingFeature } })). In setups without it,trackChanges/onChangesChangehave no effect, with one development warning.
Tracking added and removed rows (trackChanges={{ rows: true }})
With trackChanges={{ rows: true }}, rows added and removed in the grid are tracked too (since 1.10.0). Tables with true behave as before.
<SpreadsheetGrid
ref={gridRef}
rows={rows}
onRowsChange={setRows}
rowKeyGetter={(row) => row.id}
createRow={() => ({ id: crypto.randomUUID(), name: '', qty: null })}
newRow
columns={columns}
trackChanges={{ rows: true }}
/>
const save = async () => {
const grid = gridRef.current;
if (!grid) return;
const changes = grid.getChanges(); // { rows, rowCount, cellCount, added, removed, addedCount, removedCount }
await api.save({
insert: changes.added?.map(({ row }) => row) ?? [],
update: changes.rows.map(({ rowKey, row, columnKeys }) => ({ id: rowKey, columnKeys, row })),
delete: changes.removed?.map(({ rowKey }) => rowKey) ?? [],
});
grid.markChangesSaved(changes);
};- What is tracked: as in 1.8.0, rows added and removed by changes the grid made (rows added with the entry row
newRow, rows added by a paste that runs past the end, rows added and removed with the handle'sapplyRows, and undo / redo of those). Rows added or removed by replacingrowsfrom outside aren't counted (rows loaded asynchronously don't all become "added"). - Added rows: listed once in
getChanges().added(GridAddedRow<T>={ rowKey, row }, inrowsorder) and not counted as unsaved cells (cells edited after adding get no triangle either, androwholds the current values). A vertical line to the left of the row number (.ssg-row-header-cell--added; color--ssg-unsaved-indicator),.ssg-body-row--addedon the row, and the screen reader description of the row number is "追加した行(未保存)" (added row, unsaved; textunsavedAddedRow). Removing an added row makes it as if nothing happened. - Removed rows: listed in
getChanges().removed(GridRemovedRow<T>={ rowKey, row }, in the order removed) as the row with its saved values from before removal (unsaved cells set back to their saved values). They aren't shown in the table (only in the counts andgetChanges()). Bringing one back with undo removes it fromremovedand brings back the unsaved marks of its cells. - Counts:
onChangesChangeandslotContext.unsavedChangesgetaddedCount/removedCount, and the default bottom bar shows "未保存 2 行・3 セル・追加 1 行・削除 1 行" (unsaved 2 rows, 3 cells, 1 added row, 1 removed row; without cells, "未保存 追加 1 行". TextunsavedAddedRows/unsavedRemovedRows/unsavedRowChanges/unsavedSeparator). The entry row's draft isn't counted (it is counted once it becomes a row). - Marking as saved:
markChangesSaved()marks everything,markChangesSaved(rowKeys)those rows (added rows become saved, records of removed rows are discarded), andmarkChangesSaved(changes)also marks theadded/removedyou sent as saved (columns of an added row edited after sending stay unsaved as cells whose saved value is the sent value). With a list that has noadded/removed({ rows }), added and removed rows stay unsaved. - Reverting:
revertChanges()removes added rows and puts removed rows back in their place (after the row that was right before them) with their saved values (one change together with the cell reverts;Ctrl/Cmd+Zundoes it).revertChanges(rowKeys)only the rows you pass. - Making received values saved (
applyRows(next, { asSaved: true })): added rows that are in the received rows become saved, and added rows that aren't stay as not yet saved (after the row that was right before them). Removed rows not in the received rows become saved, and removed rows that are in them stay removed (taken out of the received rows). When you pass returned rows layered over the current rows (containing rows that are the same as current rows), removed rows not in the received rows also stay removed. Rows added and removed while waiting for the save don't disappear. If after sending you remove an added row or bring a removed row back with undo,markChangesSaved(changes)turns that row into a "removed" / "added" row (to match the server). - Difference from
true:added/removed/addedCount/removedCountappear in thegetChanges()result and the counts only with{ rows: true }(withtrue, the same shape as 1.9:{ rows, rowCount, cellCount }).
Showing differences (trackChanges's baseline)
With trackChanges={{ baseline }}, the differences between an array of rows you pass (a previous version, data before an import, server values and so on) and the current rows are shown in color (since 1.13.0).
<SpreadsheetGrid
ref={gridRef}
rows={rows}
onRowsChange={setRows}
rowKeyGetter={(row) => row.id}
columns={columns}
trackChanges={{ baseline: savedRows, showRemoved: true }}
/>
// to the next / previous change (same as ▲ ▼ in the bottom bar)
gridRef.current?.goToNextChange();- How rows are compared: rows are matched by the
rowKeyGetterkey. Rows only in the currentrowsare "added", rows only inbaselineare "removed", and for rows in both, values are compared column by column and differing cells are "changed" (how values are compared, not counting computed columns and how multiple selection is compared are the same as change tracking). Whether a change was made in the grid or replaced from outside, it compares again every timerowsorbaselinechanges (after editing one cell, only the edited row is compared again). Large tables are compared in time slices, and the previous result shows until the comparison finishes (during the first comparison the bottom bar says "比べています…" (comparing…)). - Look: changed cells are lightly filled yellow (
--ssg-diff-changed), added rows green (--ssg-diff-added) and removed rows red (--ssg-diff-removed). Marks use the same colors (the triangle at the top left of changed cells, the dot on that row's row number, the vertical line to the left of added rows' row numbers)..ssg-root--diffon the root. Cell and row classes are the same as change tracking (.ssg-body-cell--unsaved/.ssg-body-row--unsaved/.ssg-body-row--added). The tooltip and screen reader description of changed cells is "変更(前: 120)" (changed, was 120; textdiffChangedCell), and row numbers are described as "変更あり" (changed) / "追加した行" (added row) (diffChangedRow/diffAddedRow). - Bottom bar: the default bottom bar shows "追加 1 行・削除 2 行・変更 3 セル(2 行)" (1 added row, 2 removed rows, 3 changed cells in 2 rows; with colored dots, shown at 0 too;
.ssg-bar-chip--diff) and ▲ ▼ buttons to step through changes (.ssg-bar-diff-nav-btn; textdiffPrevChange/diffNextChange; disabled when there are no changes). In your own bars you can build the same withslotContext.unsavedChanges(withaddedCount/removedCount) and the handle'sgoToNextChange()/goToPrevChange(). - Stepping through changes:
goToNextChange()/goToPrevChange()visit, in display order, changed cells (column order within a row), added rows and removed rows (withshowRemoved). They move to the first place after / before the current active cell, and wrap to the first / last at the end. For changed cells and added rows they place the active cell (for added rows, the current column; if it isn't a data column, the first data column); for removed rows they scroll the row into view and draw lines above and below it (.ssg-body-row--change-target; removed when the active cell moves. While the lines show,↑/↓go to the row right above / below the removed row). Where it moved is announced in a hidden region (aria-live="polite"; textdiffNavCell/diffNavRow). Only rows shown in the table are visited (not inside collapsed groups or closed tree data parents). Returnstrueif it moved,falseif there is no change to go to. showRemoved: true: shows removed rows in the table with a strikethrough (in baseline order, after the row that was right before them and still exists). "−" in place of the row number (.ssg-row-header-cell--removed),.ssg-body-row--removedon the row, and its accessible name is "削除した行" (removed row;diffRemovedRow). Display only: like label rows, selection, editing, copy, paste, fill and active cell movement skip them, and they aren't in counts, aggregates, the total row, exports or find (Ctrl+F). They take no row number but do take view row positions (getViewRowIndex(),selectCell'srow,aria-rowindex). Values are drawn asvalueFormattertext (renderCell, conditional formatting, notes, validation marks and functioncellClassNamearen't used). During sorting and filtering (column filters, global search) they are sorted and filtered by their baseline values. With row grouping (rowGroup), label rows (labelRow) or tree data (treeData) they aren't shown in the table (they are still in the counts andgetChanges(); a development warning).changedOnly: true: shows only rows with changes (rows with changed cells and added rows; removed rows too withshowRemoved). Counts are the filtered counts. Rows whose changes disappear (retyped back to the baseline value) drop out right away. With row grouping and label rows only groups / sections with matches show; with tree data, like filtering, rows with changes plus their parents above and rows below show.activeCellFollowsdefaults to'row'(the active cell stays with the same row when an edit makes the row drop out or the order changes). The text of the empty table when there are no changes isdiffNoChanges("変更はありません" (no changes)). While a large table is being compared for the first time, all rows show.showOriginal: true: shows the baseline value with a strikethrough next to changed cells (before the current value;.ssg-diff-original).- Editing: cells can still be edited while differences show (when there is
onRowsChange; stop it withreadOnly). Differences show even withoutonRowsChange(a table just for comparing).getChanges()returns changes against the baseline (originalis the row with baseline values;added/removedare always present; called insideonRowsChange, it includes that change).revertChanges()goes back to the baseline values (removes added rows and puts removed rows back in place; added to the history as one change). The context menu'sparams.revertItemsreverts only changed cells (to revert added / removed rows, add your own item that callsrevertChanges([rowKey]); the menu doesn't open on removed rows).markChangesSaved()does nothing andapplyRows'sasSavedhas no effect (rows are applied as a plainapplyRows; both warn once in development). After saving, setbaselineto the rows at the time you sent them (passing the current rows afterawaitmakes values edited while waiting and not sent count as saved too). - When it works: as with change tracking, in clientSide with
rowKeyGetter. Removingbaselinegoes back to 1.8.0 change tracking (recording only the grid's changes; comparison results are dropped). - Not included: comparing three or more versions, showing added / removed columns, exporting differences.
/lite: the feature part isdiffViewFeature(keydiffView;changeTrackingFeatureis needed too). In setups without it,baselinehas no effect (one development warning) andtrackChangesbehaves as in 1.8.0.
Range decorations (rangeDecorations)
Draws a frame and a label on ranges given by row keys and column keys (since 1.13.0). Use it to show cells an AI touched, where other people are looking, check results and so on. It is display only and has nothing to do with selection, editing, copy or export.
<SpreadsheetGrid
rows={rows}
onRowsChange={setRows}
rowKeyGetter={(row) => row.id}
columns={columns}
rangeDecorations={[
{ id: 'ai', rowKeys: [3, 4, 5], columnKeys: ['qty', 'price'], label: 'Updated by AI', color: '#7c3aed' },
{ id: 'review', rowKeys: [8], columnKeys: ['name'], lineStyle: 'dashed', fill: true },
]}
/>- How to write them:
GridRangeDecoration={ id, rowKeys, columnKeys, color?, label?, labelColor?, fill?, lineStyle? }. The range isrowKeys(rowKeyGettervalues; withoutrowKeyGetterthey are compared with row positions = the index inrows, with one development warning) timescolumnKeys.coloris a CSS color (defaults to--ssg-range-decoration, the accent color by default),labelis the label text (only the frame when omitted),labelColoris the label's text color (when omitted, white or a dark color readable oncoloris chosen; forms other than#rrggbb/#rgb/rgb()get white. Ifcoloris omitted too,--ssg-range-decoration-contrast),fill: truefills it lightly,lineStyle: 'dashed'makes it dotted. To mark scattered cells, grouping them into one decoration per column reduces the count. - Position: rows and columns are mapped to their current display positions (they follow sorting, filtering and column reordering). Adjacent rows and columns are merged into one frame and split when sorting separates them. Ranges spanning left / right pinned columns are drawn per pane with no line at the boundary (like the selection). They are split around expandable row bands.
- Where nothing is drawn: rows filtered out, rows inside collapsed groups or closed tree data parents, hidden columns, rows not loaded (serverSide). Label rows, group rows, the total row, pinned rows, the entry row and removed rows in the diff view are excluded.
- Label: always shown, only on the first visible frame. It straddles the top line, placed on the side that doesn't hide the text of the row above (left if the range's leftmost column is right-aligned = numbers, right if both ends are left-aligned text; 10px in from the frame's corner). For the table's top row and ranges cut off right below the column headers, it goes inside the frame. When the top of the range is scrolled out of view, it moves down inside the top visible row (not in tables with expandable row bands). The text is cut at 220px. It is smaller with
density="compact". Marks at the top left / right of the range's first cell, and labels of two decorations, may overlap. - Stacking: below the selection and active cell frames. It doesn't take the pointer (you can click the cell below as is).
- Motion: when the range of a decoration with the same
idchanges, the frame slides (followingmotion; no sliding with'off'or "reduce motion"). It slides vertically only in tables where rows slide too (tables whereanimateRowsis in effect); withanimateRowsoff,autoHeightor serverSide it moves at once like rows. It doesn't slide while a column width is being dragged. Give each decoration a differentid(two or more with the sameidwarn once in development). - Screen readers: when the active cell is inside a range, the label text is added to the cell description (in the order error → note → unsaved → label). The frame itself isn't read (
aria-hidden). - Count: up to about 200 draw quickly. Over 1,000 warns once in development. Changing decorations doesn't redraw rows or cells (only the decoration layer). Arrays re-created on every render are compared by content (nothing happens if the content is the same).
- Look: frame
.ssg-range-decoration(idin[data-ssg-range-decoration]; fill is.ssg-range-decoration--fill, dotted is.ssg-range-decoration--dashed), label.ssg-range-decoration-label. /lite: the feature part israngeDecorationsFeature. In setups without it,rangeDecorationshas no effect, with one development warning.
Loading display (loading)
Set loading to true while your app is loading rows, and the grid shows a loading look (since 1.15.0). Fetching rows stays outside the grid as before (replace rows when they arrive).
const [rows, setRows] = useState<Row[]>([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
fetchRows().then((data) => {
setRows(data);
setLoading(false);
});
}, []);
<SpreadsheetGrid rows={rows} onRowsChange={setRows} columns={columns} loading={loading} />;- With no rows (the first load): skeleton rows fill the height of the body (the same look as serverSide's loading rows), and the empty-table message (
noRows) isn't shown. Skeleton rows aren't counted as rows (aria-hidden), and clicking them does nothing. The default top and bottom bars show 「読み込み中」 (textloadingRows) where the counts are, and so does the pager's row range. - With rows (reloading): the current rows stay, the visible part of the body is dimmed, and a moving line appears under the column headers (the same look as a refetch with
serverSideRefetch="keep"; tokens--ssg-refetch-row-opacity/--ssg-refetch-bar/--ssg-refetch-bar-track; the line doesn't move whenmotionis'off'). Meanwhile editing, pasting,Delete, the fill handle and replacing are stopped (the read-only marks don't change. An editor that was open when loading started stays open and writes its value when committed; new edits don't start). Selecting, copying, scrolling, sorting and filtering still work. - Screen readers: the table gets
aria-busy="true". The root gets.ssg-root--loading(in both cases). - serverSide (
dataSource) doesn't need it, because the grid shows loading rows itself. - It's part of the core (works with
/litetoo).
Pagination (pagination)
Splits the displayed rows into pages of pageSize rows and shows one page at a time (since 1.15.0). The right of the default bottom bar shows the row range 「1–50 / 1234 行」, ‹ 1 2 3 … 25 › and the 「表示件数」 (rows per page) choice.
<SpreadsheetGrid
rows={rows}
onRowsChange={setRows}
columns={columns}
pagination={{ pageSize: 50, pageSizeOptions: [20, 50, 100] }}
onPageChange={(info) => console.log(`${info.page + 1} / ${info.pageCount}`)}
/>- Options (
GridPaginationOptions;truekeeps the defaults):pageSize(rows per page. Default50. Changing it later also resets the rows-per-page choice to this value and shows the page containing the current page's first row),pageSizeOptions(the numbers offered for rows per page. Default[20, 50, 100].falsehides the choice. If the current rows per page isn't among them, it is added in ascending order),autoPageSize(makes a page as many rows as fit in the visible height of the body, recounting when the table's height changes and showing the page containing the first row from when the height started changing (or the active cell's row, if any). The body's height is measured after rendering, so HTML rendered on the server and the first render are split bypageSize. The rows-per-page choice isn't shown. It doesn't work inautoHeighttables, which are split bypageSizeinstead = a development warning). - How rows are split: the displayed rows after filtering, sorting and opening / closing row groups or trees are split. Group rows, label rows and removed rows in the diff view count as one row each (detail row bands don't). Within a page, virtual scrolling works as before. The total row and pinned rows appear on every page, and the total row aggregates the rows of all pages. The entry row (
newRow) appears only on the last page (when committing it overflows the page, you move to the entry row on the new last page). - When the page changes: changing filtering or sorting goes back to the first page (the active cell stays at the same position in the page. When you filter
rowswith conditions outside the grid, the page doesn't change, so callsetPage(0)). When rows decrease and the current page no longer exists, the last page is shown. Changing the page commits a value being edited, scrolls the body back to the top, and, if there is an active cell, puts it on the same column of the new page's first row (the selection is that one cell).onPageChangeandonStateChangeare called (not on the first render.onPageChangeis called only when the page or the rows per page change, not when only the row count changes). - Keys and selection: key navigation, range selection,
Ctrl/Cmd+A, copy, paste,Delete, the fill handle and row dragging stay within the current page (Ctrl/Cmd+Endgoes to the end of that page). Pasting stops at the end of the page and rows that overflow aren't pasted (treated like outside the table, so they aren't inonPasteSkipped. On the last page, rows are added withcreateRow). Cut (Ctrl/Cmd+X) also stays within the page; moving to another page and pasting becomes a normal paste. There is no key to change pages. - Things that span pages: find (
find) and replace search every page and switch to the page of the found cell. Undo goes back to the page of the changed cell, and redo goes back to where undo was pressed (the same as in tables without pagination). Row selection with the header checkbox covers the rows of all pages.goToNextChange()/goToPrevChange()also go through all pages. - Row numbers: the handle (
scrollToRow/selectCell/getRowKeyand so on), callbacks,ctx.rowIndexofrenderCelland others,canEditCell, row numbers andaria-rowindexare continuous across all pages (with 50 rows per page, the first row of page 2 is50). Pointing at a row on another page switches to that page first ("Pagination" in "Imperative API"). - Export: scope
'view'is all pages,'page'is only the current page's rows. - State:
getState()includespage/pageSize, which can be restored withapplyState/initialState. A page given while there are 0 rows (before loading) is kept as is (pageingetState()is that page meanwhile), and moving to that page when the rows arrive doesn't callonPageChange/onStateChange. - Bottom bar: the count chip (
rowCount) keeps counting the data rows of all pages (the pager's row range also counts group rows and label rows, so the numbers can differ). Tables withshowBottomBar={false}show the pager in a band below the table; tables withrenderBottomBardon't show it and passctx.pagination(GridPaginationContext=GridPageInfopluspageSizeOptions/setPage/setPageSize). The pager keeps the same width when the page changes. When it doesn't fit in the bottom bar, it wraps to the next line of the bar; when the bar is 760px wide or less the page number buttons become3 / 25, at 500px or less the row range is hidden, and at 300px or less the rows-per-page choice is hidden. - serverSide (
dataSource): the server's row count is split into pages, and only the blocks of the current page are requested. - Screen readers:
<nav>(named bypaginationLabel),aria-current="page"on the current page's number button, and the row range is read out witharia-livewhen the page changes (a pager drawn withrenderBottomBarisn't read out, so add your ownaria-live). When ‹ / › takes you to the first or last page and the button can't be pressed anymore, focus moves to the current page's number button. - Look:
.ssg-pager(.ssg-pager--barat the right of the default bottom bar,.ssg-pager--bandinside the band below the table.ssg-pager-band), buttons.ssg-pager-button. /lite: the feature part ispaginationFeature(not instandardFeatures). In setups without it,paginationhas no effect, with one development warning.
Cell event callbacks (onCellClick / onCellDoubleClick / onActiveCellChange)
Callbacks for clicks / double clicks on data cells and changes of the active cell. All three are optional; without them nothing changes (the grid's default behavior stays the same).
- What you get:
GridCellRef<T> = { row, rowKey, rowIndex, sourceRowIndex, column, columnKey, colIndex, value }. For rows, rely mainly on the row datarowandrowKey, not indexes (rowIndexis the display position after filtering / sorting = the same space ashandle.selectCell,sourceRowIndexis the index in the originalrows, andcolIndexis the on-screen column order = the same space ashandle.selectCell, counting the row drag handle column, the expand toggle column and the auto group column too. Tell columns apart bycolumnKey, and usehandle.getColIndex(columnKey)when you need the position).valueis the cell's raw value (for columns withgetValue, its return value; beforevalueFormatter). Clicks / double clicks come withevent(a standard DOMMouseEvent, not a React synthetic event). Read modifier keys (ctrlKey/shiftKey/metaKey/altKey) from it.row/valueare snapshots at the time of the callback, and editing the same cell doesn't callonActiveCellChange("same cell" below). For a panel that keeps showing edited values, rememberrowKeyand look the row up again in the currentrows. - Targets: only cells of data rows × your columns. Column headers, the row number "#", group rows, label rows, expandable row bands, SSRM rows not yet loaded (skeletons) and synthetic columns (the expand toggle column, the row drag handle column, the auto group column) don't report clicks / double clicks, and
onActiveCellChangegetsnullwhen the active cell moves onto them. - What counts as a click: follows the browser's
clickevent. Left button only, and it isn't called when the cell pressed and the cell released differ (a range selection drag). Clicks on your own elements placed in a cell also arrive as clicks on that cell, so callevent.stopPropagation()yourself on elements you don't want in cell callbacks. - Order: clicking another cell with the mouse calls
onActiveCellChange(the active cell moved on pointerdown) →onCellClick. A double click follows the browser spec:onCellClick× 2 →onCellDoubleClick. - Default action of a double click: starts editing on an editable cell; does nothing on checkbox columns and read-only cells.
params.preventDefault()stops it (starting an edit withF2/Enter/ printable keys isn't affected).
// Read-only list: copy the clicked row into the form above.
<SpreadsheetGrid<Row>
rows={rows}
columns={columns}
readOnly
rowKeyGetter={(row) => row.id}
onCellClick={({ row }) => form.setValues(row)}
/>
// Picker modal: confirm with the double-clicked row and close.
<SpreadsheetGrid<Row> rows={rows} columns={columns} readOnly onCellDoubleClick={({ row }) => onConfirm(row)} />
// Only the "Subject" cell opens a modal on double click; other cells start editing as usual.
<SpreadsheetGrid<Row>
rows={rows}
columns={columns}
onRowsChange={setRows}
onCellDoubleClick={(params) => {
if (params.columnKey === 'subject') {
params.preventDefault();
openSubjectPicker(params.rowKey);
}
}}
/>
// Show the active cell's row in a detail panel, including moves with keys (look it up by rowKey so edited values show too).
const [currentKey, setCurrentKey] = useState<GridRowKey | null>(null);
const current = rows.find((row) => row.id === currentKey) ?? null;
<SpreadsheetGrid<Row> rows={rows} columns={columns} rowKeyGetter={(row) => row.id} onActiveCellChange={(cell) => setCurrentKey(cell?.rowKey ?? null)} />Context menu (enableContextMenu / getContextMenuItems)
A fully custom menu that opens on right-clicking a cell / row. Off by default (enableContextMenu={false}); like the other features' enable*, turn it on with the master switch (off by default because the feature / UI still has room for improvement). The library has no built-in items at all and draws only the array of items getContextMenuItems returns. It provides only the "window" (the panel shell, placement at the right-click position, opening / closing on Escape / outside click / scroll); all the content (labels / icons / onSelect) comes from you. It reuses the same .ssg-menu-panel / .ssg-menu-item shell as the column menu.
Opt-in and falling through to the browser menu
enableContextMenuunset /false(default) → the browser's own right-click menu (it doesn't fire even if you passgetContextMenuItems).enableContextMenu={true}andgetContextMenuItemsreturned items → a menu with those items at the right-click position.enableContextMenu={true}butgetContextMenuItemsis missing / returned[](no items for the target) → the browser's own menu (no empty panel floats up).
Targets and behavior
- Right-clicking the header isn't covered (the column menu
enableColumnMenuhandles it). This menu is only for data cells and the row number gutter in the body. - It doesn't open over SSRM rows not yet loaded (the browser menu opens).
- Keyboard:
Shift+F10/ the Menu key (the Windows application key) on the active cell opens that cell's menu (since 1.1.0; up to 1.0.2 it didn't open, giving the browser menu). The menu appears at the bottom left of the cell and focus moves to the first enabled item.params.targetis the active cell (type: 'cell'), andclientX/clientYare the cell's bottom left coordinates (the grid's top left when the cell is off screen). With no items, no active cell or an unloaded row, the browser menu stays. The row number menu (type: 'rowHeader') doesn't open from the keyboard. Input fields in the grid, such as the top bar search box, get the browser menu. - Uncontrolled only. Right-clicking doesn't change the cell selection (you get the target cell / row through
params). - Closes on: choosing an item / outside click / Escape / Tab / scroll.
- Keyboard: while open,
↓/↑move between items (skipping disabled items and wrapping at the ends; right after opening with a right click focus is on the panel (since 1.1.0), so↓goes to the first item and↑to the last).Home/Endgo to the first / last, andEnter/Spacerun the item. While open, keys don't scroll the grid behind. When focus is in an input inside acustomitem, arrow keys and the like stay with that input.
GridContextMenuParams<T> (callback argument)
| Field | Type | Description |
|---|---|---|
target | GridContextMenuTarget<T> | What was right-clicked. { type:'cell', rowIndex, colIndex, rowKey, row, column, value } or { type:'rowHeader', rowIndex, rowKey, row } (the row number gutter). rowIndex is the view row index and colIndex the on-screen column order (visual order left → center → right = the same space as handle.selectCell; counts the row drag handle column, the expand toggle column and the auto group column too. Tell columns apart by column / column.key). |
clientX / clientY | number | Viewport coordinates of the right click (already used to place the menu; also useful for branching). |
selection | GridSelection | The current cell range selection. Get the checkbox row selection separately with handle.getRowSelection(). |
activeCell | CellCoord | null | The current active cell. |
isTargetSelected | boolean | Whether the target (for cell, that cell; for rowHeader, that row) is in selection. A convenience value for choosing between "act on the selection" and "act on a single target". |
revertItems | GridContextMenuItem[] | Change tracking (trackChanges) items "このセルの変更を取り消す" (revert this cell), "この行の変更を取り消す" (revert this row) and "選択範囲の変更を取り消す" (revert the selection) (since 1.8.0). Present only when the target has unsaved cells; [] when it doesn't, when trackChanges isn't in effect and while readOnly (the grid always fills it). The row item appears only when the row has unsaved cells besides the target, and the selection item only when the range has unsaved cells besides the target. Item ids are ssg-revert-cell / ssg-revert-row / ssg-revert-selection. To use them, put them in the array getContextMenuItems returns. |
GridContextMenuItem (discriminated union)
- action (default):
{ kind?: 'action'; id?; label: ReactNode; icon?: ReactNode; disabled?; danger?; onSelect: () => void }— on click, runsonSelectand closes automatically. Withouticon, a 14px empty spacer on the left still keeps label left edges aligned.dangerhighlights dangerous actions such as delete in red (like Mantine'scolor="red"). - label (heading):
{ kind: 'label'; id?; label: ReactNode }— a non-interactive section heading (like Mantine'sMenu.Label). Use it to group items. - separator:
{ kind: 'separator'; id? }— a divider (like Mantine'sMenu.Divider). - custom (renderer / escape hatch):
{ kind: 'custom'; id?; render: (ctx: { close: () => void }) => ReactNode }— puts any JSX in the panel.close()closes it whenever you like.
id is for the React key (the array index when omitted). Items aren't generic: capture row data in a closure through params inside getContextMenuItems.
Example
<SpreadsheetGrid
// …
enableContextMenu // default false. This master switch is needed to use the feature
getContextMenuItems={(params) => {
const items: GridContextMenuItem[] = [];
items.push({ kind: 'label', label: 'Actions' }); // section heading
if (params.target.type === 'cell') {
const value = params.target.value; // keep the narrowed value in a local before using it in onSelect
items.push({
label: 'Copy value',
icon: '📋',
onSelect: () => navigator.clipboard?.writeText(String(value ?? '')),
});
}
items.push({ kind: 'separator' });
items.push({
label: 'Delete this row',
danger: true, // red highlight
onSelect: () => deleteRow(params.target.rowKey),
});
items.push({ kind: 'separator' });
items.push({
label: 'Export selection as CSV',
disabled: !params.isTargetSelected,
onSelect: () => gridRef.current?.downloadCsv('selection.csv', { scope: 'selection' }),
});
items.push({
kind: 'custom',
render: ({ close }) => (
<div style={{ padding: '6px 8px' }}>
Row {params.target.rowIndex}
<button type="button" onClick={close}>Close</button>
</div>
),
});
return items; // returning [] falls through to the browser menu
}}
onContextMenuOpen={(params) => console.log('opened at', params.target)}
/>Recipe: open the filter manager panel from a right click
The filter manager panel that lists / edits / clears active filters (the same one as the column menu's "フィルターを管理…" (Manage filters…)) can be opened from anywhere with the handle's openFilterManager(). To put it in the context menu:
const gridRef = useRef<SpreadsheetGridHandle<Row>>(null);
<SpreadsheetGrid
ref={gridRef}
enableContextMenu
getContextMenuItems={() => [
{
label: 'Manage filters…',
onSelect: () => gridRef.current?.openFilterManager(),
},
]}
/>;Scroll position indicator (scrollHint)
With many rows (especially around a million), 1px of scrollbar movement covers hundreds to thousands of rows, and you lose track of "which row am I at" while moving. scrollHint answers this with the following three overlays (completely off by default; opt-in).
- Row number bubble (
bubble): while scrolling, shows "行 N / total rows" (row N) next to the scrollbar (at the thumb position).hintColumn/renderHintcan add any column value. - Row ruler (
ruler): a row count scale at the right edge of the body (round steps; when the step is a multiple of 10,000, all ticks switch to the compact form "10万"). It fades in only while scrolling and while hovering the scrollbar strip. - Jump preview (part of
ruler): pointing at the scrollbar strip (right edge) shows a dotted line + label "行 N へ" (to row N), using the same thumb-center mapping as a click / drag on the scrollbar. - Custom scrollbar (
scrollbar): draws its own always visible track + minimum 30px thumb in a dedicated gutter starting below the header (supports dragging / click jumps / the wheel). It replaces macOS overlay scrollbars, which hide on their own, and thumbs that become tiny with many rows, so you can always find "where to grab". When on, the native vertical scrollbar is hidden (Chromium / WebKit; in Firefox the native vertical bar stays, but the gutter still works).
ScrollHintOptions<T>:
| Option | Type | Default | Description |
|---|---|---|---|
bubble | boolean | true | Shows the row number bubble. |
ruler | boolean | true | Shows the ruler + jump preview. |
scrollbar | boolean | true | The custom vertical scrollbar (dedicated gutter, always visible). false keeps the native bar (the bubble and the like show at a pseudo thumb position). |
trigger | 'scroll' | 'hover' | 'always' | 'scroll' | When the bubble / ruler show (the scrollbar itself is always shown). 'scroll' = only while scrolling (fades out about 1 second after stopping) / 'hover' = while hovering the grid + while scrolling / 'always' = always. |
minRows | number | 0 | Data size gate. While the number of shown rows (view rows after filtering / grouping; for SSRM the server's total row count) is below this value, the whole scrollHint (including the custom scrollbar) turns off automatically and the native scrollbar stays. 0 = always on (the previous behavior). |
hintColumn | string | — | Key of a column (= field name of the row object) to show next to the row number. |
renderHint | ({ rowIndex, rowData }) => ReactNode | — | Fully custom content (takes priority over hintColumn). Returning null / undefined gives the default row-number-only display. |
// Simple: row number + part number
<SpreadsheetGrid scrollHint={{ hintColumn: 'partNo' }} />
// Fully custom: part number — part name
<SpreadsheetGrid
scrollHint={{
trigger: 'scroll',
renderHint: ({ rowData }) =>
rowData ? `${rowData.partNo} — ${rowData.partName}` : null,
}}
/>Data size gate (minRows): with small data the bubble / ruler / custom scrollbar are noise, so minRows makes them show "only when the number of shown rows is at or above the threshold" (e.g. scrollHint={{ minRows: 100 }}). It uses the same row count as the bubble's "/ total rows" (view rows after filtering / grouping; for SSRM the server's total row count), so when filtering drops it below the threshold it turns off for that time. The default is 0 (always on). Note: with scrollbar on, the gutter space is added and removed as the threshold is crossed, so screens where the row count changes see a slight layout shift (combine with scrollbar: false if that bothers you).
With SSRM / grouping: when the bubble / preview row is an SSRM row not yet loaded (or a grouping group row), rowData is undefined, and with hintColumn it falls back to the row number only (renderHint receives undefined as is, so branch on it yourself). The indicator is driven only by the total row count and the scroll position, so it works in every setup including SSRM.
Implementation notes: row numbers are resolved with the same mapping as the virtualizer's vertical geometry (pixel scaling for 1M rows / auto-height prefix sums), so they are always accurate. The bubble / ruler / preview overlays are pointer-events: none and never interfere with scrolling or cell interaction. Only the custom scrollbar gutter takes pointer input, and content scrolling itself stays native (the gutter is a mirror that only writes scrollTop). When all rows fit in the viewport and nothing scrolls, nothing is shown. Colors use theme tokens (--ssg-pill-* / --ssg-scrollhint-*) and support light / dark.
Tree data (treeData)
Keep rows a flat array; when treeData.getParentKey(row) returns the key of the parent row (the rowKeyGetter value), the table becomes a hierarchy you can open and close (since 1.9.0).
type Dept = { id: string; parentId: string | null; name: string; budget: number };
const columns: GridColumn<Dept>[] = [
{ key: 'name', title: 'Department', width: 220 },
{ key: 'budget', title: 'Budget', width: 120, align: 'right', aggFunc: 'sum' },
];
<SpreadsheetGrid
rows={rows}
columns={columns}
rowKeyGetter={(row) => row.id}
treeData={{ getParentKey: (row) => row.parentId, column: 'name', defaultOpenDepth: 1 }}
onRowsChange={setRows}
/>| Name | Type | Default | Description |
|---|---|---|---|
getParentKey | (row: T) => GridRowKey | null | undefined | (required) | The key of the parent row. null / undefined is a top-level row. Rows whose parent key isn't in rows and rows that lead back to themselves when following parents (cycles) are placed at the top (one development warning). Order under the same parent is the order of rows. The tree's shape is rechecked when the rows array changes (when you replace only getParentKey, or rewrite a row object's parent in place, pass rows as a new array too). |
column | string | (required) | The key of the column that shows indentation and the open / close mark. That column can still be edited, and in renderCell columns too the grid draws the indentation and mark (renderCell draws the content to the right of the mark). |
defaultOpenDepth | number | 'all' | 'all' | How deep it opens initially. 'all' opens everything, and n opens rows shallower than depth n (0 shows only top-level rows). |
- Open / close: press the mark,
Alt+Shift+↓(open) /Alt+Shift+↑(close) on a cell of the tree column (Optionon Mac;Enterisn't used because it edits), or the handle'ssetTreeRowOpen(rowKey, open)/expandAllTreeRows()/collapseAllTreeRows()/revealRow(rowKey)(opens the parents and scrolls to that row). The active cell and selection follow their rows through opening and closing, and what was on rows hidden by closing moves to the closed parent. Opening and closing use theanimateRowsmotion (the same as row grouping). Closed parents are ingetState().closedTreeRows(opening / closing also callsonStateChange) and can be restored withclosedTreeRowsininitialState/applyState(listed rows are closed, others opened). - Sorting: sorts among siblings under the same parent. Parents move with their children. Sorting by a column with an aggregate (
aggFunc) compares rows with children by their aggregate. - Filtering: column filters and the global filter show matching rows and every row below them as matches, plus the parents leading to them (searching by a parent's name shows every row below it). Parents that don't match have faint text (
.ssg-body-row--tree-unmatchedon the row), and the count is the number of matching rows (including rows below matching rows). Parents leading to matching rows are opened, but can be closed by hand. Rows below matching rows keep their current open / closed state. Opening and closing while filtered is a temporary copy, and removing the filter goes back to the state before filtering (getState().closedTreeRowsstays at the state before filtering). - Values of parent rows: by default parents show their own values. Only in columns with
aggFunc, cells of rows with children show the aggregate of the leaf rows below (rows without children) (the same aggregates and format as row grouping; while filtered, only matching rows). The tree column shows each row's own value even for rows with children, even ifaggFuncis set (for showing a count in the total row and so on). Those cells aren't covered by editing, paste, fill orDelete; copy and export use the aggregate, and find and selection aggregates don't count them. The total row (totalRow) aggregates only leaf rows (not double counting the parents' aggregates). - Selection, editing, copy, paste, fill: work as before on the order of visible rows (rows inside closed parents aren't in ranges). Select all for row selection covers every row matched by filtering (including rows inside closed parents and rows below matching rows, but not unmatched parents; the same as row grouping). The edit input of a tree column cell starts to the right of the indentation and mark.
- Find (
find): matches rows inside closed parents too, and opens the parents when moving to that result. - Export: scope
'view'outputs the rows to show (rows matched by filtering and their parents) parent first, regardless of open / closed state (the same as row grouping;isRowExportable'sviewRowIndexis the view row number with everything open).getExportData'streeLevelshas each row's depth (top = 0). CSV doesn't indent the tree column by default (exportCsv({ treeIndent: true })adds one full-width space per depth level, and a string adds that text once per level). renderCell/cellClassName/cellNote:ctx.treeof tree data row cells has{ level, hasChildren, open, aggregate, setOpen }(hasChildrenis whether there are visible children, andaggregatewhether it is an aggregate cell of a row with children;ctx.treeofcellClassName/cellNoteisCellTreeStatewithoutsetOpen). In aggregate cells of rows with children,ctx.valueis the aggregate. In the tree column the grid draws the indentation and mark, andrenderCelldraws the content to their right.- Screen readers: the body is
role="treegrid", and rows havearia-level/aria-expanded(rows with visible children) /aria-setsize/aria-posinset. The open / close mark is named "(row name)を開く / 閉じる" (open / close (row name)) (localeText'sexpandTreeRow/collapseTreeRow; rows whose name is empty or whitespace get "行 3 を開く" (open row 3) =treeRowNumber). - Not usable together:
rowGroup/labelRow/enableRowDrag(tree data is used and they have no effect), serverSide (dataSource; tree data has no effect). Each gives a development warning. WithoutrowKeyGetterit stays a flat table (a development warning). - Look: indentation is
--ssg-tree-indentper depth level (default16px). Column auto-fit adds the deepest indentation among visible rows and the mark's width for the tree column. Tree column cells get.ssg-tree-cell, the open / close mark.ssg-tree-toggle, rowsdata-ssg-tree-level(depth; top = 0), unmatched parent rows.ssg-body-row--tree-unmatched, and aggregate cells of rows with children.ssg-body-cell--tree-aggregate. Aggregate cells look the same as row grouping aggregates; to show that they can't be edited, color this class (e.g..ssg-body-cell--tree-aggregate { color: var(--ssg-readonly-text); }). - Not in the first version: lazy-loading children in SSRM, reparenting (drag / keys), selecting all children by checking a parent, nested
children. /lite: the feature part istreeDataFeature(createSpreadsheetGrid({ features: { treeData: treeDataFeature } })). In setups without it,treeData/onTreeRowOpenChangehave no effect (a flat table), with one development warning.
Expandable rows (master/detail) (detailRow)
Passing the detailRow prop lets each row "expand" to insert your own UI (a card) right below the master row (like AG Grid's Master/Detail). Row grouping is a feature where "the library makes group rows", while expandable rows are a path where "you fully decide what goes below a row". The two are independent and can be used together.
<SpreadsheetGrid
rows={rows}
columns={columns}
rowKeyGetter={(row) => row.id}
detailRow={{
height: 220,
isExpandable: (row) => row.lines.length > 0,
render: ({ row, rowKey, collapse }) => (
<OrderLinesPanel order={row} onClose={collapse} />
),
}}
onExpandedDetailRowKeysChange={(keys) => save(keys)}
/>DetailRowOptions<T>:
| Name | Type | Default | Description |
|---|---|---|---|
render | (ctx: DetailRowRenderContext<T>) => ReactNode | (required) | The content of the expanded row. ctx = { row, rowKey, rowIndex, sourceRowIndex, collapse } (rowIndex is the view row index, and collapse() closes that expanded row). Drawn in the card element inside the band (.ssg-detail-card, with the data-ssg-detail attribute). |
height | number | 200 | Height of the band (px). A fixed height; when the content is taller, it scrolls inside the card (auto height isn't supported). |
isExpandable | (row: T, ctx: { rowKey; sourceRowIndex }) => boolean | every row can expand | Whether each row can expand. Rows returning false get no toggle, and expanding them from the imperative API / ctx.detail.toggle() is a no-op too. |
showToggleColumn | boolean | true | Inserts a dedicated toggle column automatically (28px wide, no title, right next to the row header = the first column; on the left pinned side when there are left pinned columns). With false no column is inserted, and you place the toggle yourself with ctx.detail.toggle() from any column's renderCell (below). |
className | GridSlotProps | — | Classes added to the card element (or { className, style }; added on top of classNames.detailCard). |
- Display: the band sits right below the master row across the full grid width (all 3 panes draw the background), and the card is placed in the center pane with
position: sticky, staying at the viewport's left edge (right next to the left pinned pane) even when scrolling horizontally. Its width is the center pane's visible width. Expanding doesn't change row order or view indexes (no third kind of row is made); following rows move down by the band's height. The scroll position doesn't move when expanding. - State: expanded state is kept by the
rowKeyGetterrow key, so it follows the same row across sorting / filtering / adding and removing rows (rows excluded by a filter show no band and show it again when they come back). Removing an expanded row fromrowstakes its key out of the expanded set and callsonExpandedDetailRowKeysChange(adding a row with the same key back keeps it closed; serverSide isn't covered). Keys restored withsetDetailRowExpanded()beforerowsare loaded stay until that row arrives. It is UI state and isn't covered by undo/redo orgetState(). Persist it withonExpandedDetailRowKeysChange+setDetailRowExpanded(). - Mounting: cards are mounted only while they are in the virtualizer's render window (unmounted when scrolled out, remounted when they come back). Keep state you want to keep in the card on your side, keyed by
rowKey. Taborder:Tabon the last column enters the first input or similar in that row's card, andTabon the card's last element leaves the grid (other rows' cards aren't passed).Shift+Tabis the reverse (the card's first element → that row's last-column cell; coming back from after the grid enters the last element of the active cell's row card).Tabinside dialogs and popovers portaled out of the card keeps the browser's default (or their focus trap). When the card closes with focus inside it (collapse()/ the toggle /ctx.detail.setExpanded(false)/ the handle'ssetDetailRowExpanded(key, false)/collapseAllDetailRows()), a cell of that row (in the active cell's column) becomes the active cell, focus goes back to the table, and if that cell is outside the visible area it scrolls into view (so focus doesn't vanish with the closed card).- Event boundary: keyboard / clipboard / right click / double click / drag start inside the card don't propagate to the grid body (pressing arrow keys in an input in the card doesn't move the active cell). While focus is inside the card, the grid's focus restoration (after an edit commit or a popover closes) doesn't take focus. Even if you nest another
SpreadsheetGridin the card, the outer grid's auto-height measurement / column header lookups don't target the inner cells. - Writing back to the parent row from a nested grid: when reflecting edits in the grid inside the card to the outer
rows, replacing them directly with the parent'ssetRowsmakes the outer grid treat it as a replacement from outside and clear its undo history. To keep the outer history, pass it with the outer handle'sapplyRows(next)(added to the outer history, so the outerCtrl/Cmd+Zundoes that write-back too). The inner grid's history holds only the inner edits, and after writing back the innerrowsare replaced from outside, so it is cleared (undo with the outerCtrl/Cmd+Z). - Opening and closing: pressing ▸ / ▾ in the toggle column opens / closes it (pressing doesn't move the active cell or selection, and
onActiveCellChangeisn't called). With the keyboard, move the active cell to the toggle column (←from the row's first data column) and pressEnter/Space(nothing happens on rows that can't expand). The imperative API (setDetailRowExpandedand others) works too. - From
renderCell(ctx.detail): withdetailRowon,CellRenderContexthasdetail: { expanded, expandable, toggle(), setExpanded(bool) }(undefinedwhen off). Combined withshowToggleColumn: false, you can place the toggle yourself, such as next to the product name cell. - Selection / active cell: the band isn't a cell, so it isn't covered by selection or the active cell. The highlight of a range selection spanning a band is split to avoid the band.
- serverSide (
dataSource): works, but (1) when the query (filters / sort / global) changes, all expanded rows close (the result set is replaced entirely and keys of unloaded rows can't be scanned). (2) Bands of rows not yet loaded aren't shown. - Limit: bands are drawn with the same variable-row-height geometry as auto-height rows, so in setups where
rows × rowHeight + total of expanded bandsexceeds 15,000,000px (about 410,000 rows at 36px; 8,000,000px in Firefox = about 220,000 rows), bands aren't drawn (a development warning; expanded state is kept and shows when the row count is reduced). While the rows alone exceed this limit, the expand toggle (▸) isn't shown either, andEnter/Spacedon't open or close (ctx.detail.expandableisfalsetoo; since 1.0.1). - With row grouping: only leaf rows can expand (group rows aren't covered).
Label rows (headings / separators) (labelRow)
Passing the labelRow prop treats specific rows in rows as "heading (separator) rows". They are the same as section heading rows placed in an Excel sheet: drawn as full-width bands at the position where they sit between data rows, and not counted as rows. Neither the row type T nor the types of rows / onRowsChange change, so you can use data imported from Excel / CSV in its shape as is (guide).
Difference from row grouping
Label rows (labelRow) | Row grouping (rowGroup) | |
|---|---|---|
| What it does | Draws heading rows at the position they are placed in rows as bands | Regroups rows by column values and makes group rows |
| Order | The order of rows as is (sorting stays within sections) | Reordered by group |
| Aggregates / tree / open-close | None | Yes (aggFunc / auto group column / open-close) |
| Data source | The row data itself (identified with isLabelRow) | Column definitions (rowGroup: true) |
| Combining | Not possible (label rows aren't shown while rowGroup is on; a development warning) |
type Row = { id: string; kind?: 'label'; code: string; name: string; qty: number };
<SpreadsheetGrid
rows={rows} // label rows are mixed into the same array as data rows
columns={columns}
rowKeyGetter={(row) => row.id}
labelRow={{
isLabelRow: (row) => row.kind === 'label',
getLabel: (row) => row.name,
sticky: true, // keep the current section's heading pinned below the header while scrolling vertically
render: ({ label, sectionRowCount }) => (
<>
<strong>{label}</strong>
<span className="text-gray-500">{sectionRowCount} rows</span>
</>
),
}}
/>LabelRowOptions<T, L> (L is the label row type; inferred when isLabelRow is written as a type guard, otherwise T):
| Name | Type | Default | Description |
|---|---|---|---|
isLabelRow | (row: T, sourceIndex: number) => boolean (a type guard row is L works too) | (required) | Identifies label rows. Every row is evaluated in one pass when rows / this function changes, so keep it pure and light. Written as a type guard ((row): row is Section => …), the row of getLabel / render / height / className / exportText gets that type (below). |
getLabel | (row: L) => string | (required) | The display text. Used for the default rendering (without render) / export / aria-label. |
render | (ctx: LabelRowRenderContext<L>) => ReactNode | — | React rendering of the content (decoration). ctx = { row, rowKey, rowIndex, sourceRowIndex, label, sectionRowCount } (sectionRowCount is the number of data rows in the section after filtering; undefined in serverSide). |
height | number | ((row: L) => number) | rowHeight | Height of label rows (px). A function to vary it per row. |
className | GridSlotProps | ((row: L) => GridSlotProps | undefined) | — | Classes added to the row element (or { className, style }). Added on top of classNames.labelRow. |
sticky | boolean | false | While scrolling vertically, pins the current section's label row right below the column headers. When the next label row arrives it pushes it up and takes over (clientSide only). When showing a row above with the keyboard / scrollToRow / scrollToCell, it is placed below the pinned heading (not hidden behind it). |
sortMode | 'section' | 'follow' | 'hide' | 'section' | How they are handled when sorting / filtering (below). |
keepEmptySections | boolean | false | Keeps label rows of sections whose content becomes 0 rows after filtering. |
exportText | (row: L) => string | Array<string | number | null | undefined> | getLabel in the first column | Output values when exporting (includeLabelRows: true). A string goes in the first column (other columns empty), and an array goes in column order as is. |
- Separate row types (TypeScript): when data rows and label rows have different types and
rowsis a union (type Row = Sale | Month), writingisLabelRowas a type guard ((row): row is Month => row.kind === 'label') makes therowofgetLabel/render/height/className/exportTextMonth(no need to narrow again inside). With TypeScript 5.5 or later,(row) => row.kind === 'label'is inferred as a type guard too. When writing type arguments, write both:<SpreadsheetGrid<Row, Month>>(writing only one,<SpreadsheetGrid<Row>>, leavesrowasRoweven with a type guard, givingProperty 'label' does not existinsidegetLabel). In a variable, useLabelRowOptions<Row, Month>. - Sections: from a label row up to right before the next label row counts as one section. Rows before the first label row are "a section without a label".
- Sort / filter (
sortMode):'section'(default) = sorting happens only within each section, and label rows don't move. Sections that become 0 rows after filtering disappear along with their labels (keep them withkeepEmptySections).'follow'= the whole is sorted, and label rows move to right before "the data row of the original section that comes first" (labels of sections that were empty to begin with line up right before the label of the following section; they disappear only when filtering makes them 0 rows, andkeepEmptySectionskeeps them).'hide'= label rows aren't shown while sorting / filtering. With no sort or filter, all three modes show the order ofrowsas is. - Display: bands are drawn in all 3 panes, and the content (the
getLabeltext / therenderelement) is placed in the center pane withposition: sticky, staying at the viewport's left edge (right next to the left pinned pane) even when scrolling horizontally (the same mechanism as expandable row cards). The row header "#" is blank, and data row numbers are sequential, skipping label rows. The default look is a left accent line + bold (tokens--ssg-label-row-bg/--ssg-label-row-text/--ssg-label-row-accent). - Not covered by interactions: label rows have no cells, so they aren't covered by cell selection / editing / copy / clear / checkbox row selection / hover / the context menu. Arrow keys (↑ / ↓) skip label rows instead of stopping on them, and paste skips label rows and continues into the next data row (no rows are lost). Counts (the bar's "行 X / Y" (row X / Y), the row selection count) count data rows only. Range selection fills are drawn passing over label rows (the same as group rows).
- With row drag: data rows can move across sections (they then belong to the target section). Label rows themselves can't be grabbed. The rule that it is disabled while sorting / filtering is as before.
- With expandable rows: works. Label rows can't expand (data rows only).
- serverSide (
dataSource): the server returns label rows in thegetRowsresult (counting them intotalRowCounttoo), andisLabelRowidentifies them. Section sorting /sectionRowCount/ sticky pinning (sticky) / label rowheightaren't applied in the server row model, and counts stay the server's total. - Export: not included in output by default (not even as data rows with scope
'raw'). WithincludeLabelRows: trueinexportCsv/getExportDatathey are output as one row each, andgetExportDatareturns row kinds inrowKinds(see the recipes in "Excel / spreadsheet export (getExportData)"). They aren't included in copy (Ctrl/Cmd+C). - Limit: when
heightis set, they are drawn with variable-row-height geometry, so in setups where the logical total height exceeds 15,000,000px (8,000,000px in Firefox), the override is given up androwHeightis used.
The label row descriptor is exported from the barrel as GridLabelRow<T> ({ kind: 'label', row, sourceIndex, label, sectionRowCount }) (as are LabelRowOptions<T> / LabelRowRenderContext<T> / LabelRowSortMode).
Total row (totalRow)
The totalRow prop shows a total row pinned at the bottom of the table. Which columns are aggregated and how is decided by the column's aggFunc (the same built-in aggregates / custom functions as row grouping), and with a filter it recomputes over the visible rows only.
const columns: GridColumn<Order>[] = [
{ key: 'product', title: 'Product', width: 160 },
{ key: 'qty', title: 'Qty', width: 90, align: 'right', aggFunc: 'sum' },
{ key: 'price', title: 'Unit price', width: 110, align: 'right', aggFunc: 'avg', valueFormatter: yen },
{ key: 'amount', title: 'Amount', width: 120, align: 'right', aggFunc: 'sum', valueFormatter: yen },
];
<SpreadsheetGrid rows={rows} columns={columns} totalRow />
// change the heading / pass values for some columns
<SpreadsheetGrid rows={rows} columns={columns} totalRow={{ label: 'Grand total', values: { product: `${rows.length} items` } }} />TotalRowOptions<T> (when passing an object to totalRow):
| Name | Type | Default | Description |
|---|---|---|---|
label | string | localeText's totalRowLabel ('合計') | The heading. Shown in the first column excluding the row drag / expand toggle synthetic columns (in the row number cell when that column has a value). |
values | Record<string, unknown> | — | Column key → the value to show. Listed columns aren't computed and show this value (takes priority over aggFunc; the only option in serverSide). |
renderCell | (ctx: TotalRowCellContext<T>) => ReactNode | — | Replaces the content of cells that have a value. ctx = { column, value, kind, text, caption } (kind is 'sum' | 'avg' | 'min' | 'max' | 'count' | 'custom' | 'value', text is the default display text, and caption is the kind's heading). |
height | number | rowHeight | Height of the total row (px). |
className | GridSlotProps | — | Classes added to the row element (or { className, style }). Added on top of classNames.totalRow. |
- What is aggregated: data rows after filtering / sorting. Label rows (
labelRow) aren't counted, and during row grouping rows in collapsed groups are counted too. What counts as a number is the same as row grouping aggregates (only numbers and numeric strings), andcountis the number of target rows. sum / avg / min / max with 0 numeric values give an empty cell. - Display: built-in aggregates other than sum (average / min / max / count) show their kind in small text before the value. Values are formatted with the column's
valueFormatter(as with group rows, the total row has no source row, sorowisundefined; for columns whose formatter readsrow, format withrenderCellorvalues). Strings (from custom aggregates /values) show as is.countand numbers in columns withoutvalueFormatteruse the same format as the bottom bar's selection aggregates (with separators, up to 4 decimals, floating-point errors rounded). The column'srenderCell/cellClassNamearen't used for the total row (there is no row data). Replace content withtotalRow.renderCell. Column auto-fit (column menu / boundary double click / auto-fit all columns) makes the width fit the total row display (kind + value) too, and values cut off by the column width show in full in a tooltip on hover. - Position: stays at the bottom of the table while scrolling vertically, and comes right after the last row when there are few rows. It follows horizontal scrolling and left / right pinned columns like normal rows. Scrolled to the end, the last row sits right above the total row, and showing a row with the keyboard /
scrollToRowdoesn't hide it behind the total row (also when the total row is turned on while scrolled to the end, the last row stays visible). Moving the pointer over the total row during range selection / row drag / fill handle drag treats it as the body's last visible row, and auto-scrolling starts at the total row's top edge. - Display only: not covered by cell selection / editing / paste / copy / clear / row selection / the context menu (pressing it doesn't move the selection). Not counted in counts (the bar's Rows) or view row indexes.
- Export: not included by default. With
includeTotalRow: trueinexportCsv/getExportData, one row is output at the end only for scope'view'(raw values; the heading goes in the first column only when it has no value).getExportDatatells it apart with'total'inrowKinds. - serverSide (
dataSource): it doesn't have all rows, so nothing is computed. Pass values aggregated on the server withvalues. - Accessibility: read as the table's last row (
role="row") (one row is added toaria-rowcount). - Look: the row is
.ssg-total-row, cells.ssg-body-cell.ssg-total-cell, and the kind heading.ssg-total-caption. Tokens--ssg-total-row-bg/--ssg-total-row-text/--ssg-total-row-border(the separator line on top).
Pinned rows (pinnedTopRows / pinnedBottomRows)
Passing an array of rows to pinnedTopRows / pinnedBottomRows pins them right below the column headers / at the bottom of the table. Use them for rows you want to compare with the body rows, such as targets, last year's results and averages. They are an array separate from the body rows (rows) and aren't in the body's counts, sorting or filters.
const target: Sale = { id: 'target', region: 'Target', q1: 1200, q2: 1300, q3: 1400, q4: 1500 };
const lastYear: Sale = { id: 'last-year', region: 'Last year', q1: 980, q2: 1110, q3: 1240, q4: 1320 };
<SpreadsheetGrid
rows={rows}
columns={columns}
rowKeyGetter={(row) => row.id}
pinnedTopRows={[target]}
pinnedBottomRows={[lastYear]}
totalRow
/>- Display: cells are drawn with the same rules as body rows (the column's
valueFormatter/renderCell/cellClassName/getRowClassName, the mark ofeditor: { type: 'checkbox' }, name chips of multiple selection (multiple), conditional formatting colors and chips; conditional formatting min / max are decided by body rows). The ctx ofrenderCell/cellClassNameand ofgetRowClassNamegetspinned('top'/'bottom'),rowIndex/sourceRowIndexare the position within the pinned rows (from 0),isActive/isSelected/isEditingarefalse, andreadOnlyistrue.setValueinrenderCelldoes nothing. Even with expandable rows (detailRow),renderCell's ctx has nodetail(pinned rows don't expand). Validation marks (validate) and notes (cellNote) aren't shown. Cells of the row drag handle / expand toggle / auto group columns are empty. Row height isrowHeight, andautoHeightcolumns don't grow either (one line, truncated). The row header is a pin mark. - Position: top pinned rows stay below the column headers and bottom pinned rows at the bottom of the table (right above the total row if there is one; below it with
pinnedBottomRowsPlacement: 'belowTotal'), and body rows flow between them. With few rows, bottom pinned rows come right after the last row. They follow horizontal scrolling and left / right pinned columns like normal rows. Showing a row with the keyboard /scrollToRow/scrollToCelldoesn't hide it behind pinned rows (rows shown upward go below the top pinned rows, rows shown downward above the bottom pinned rows). - Display only: not covered by cell selection / editing / paste / copy / clear / row selection / the context menu / row hover / find in cells (
find) / the flash of changed values (highlightChanges) (pressing them doesn't move the selection). Not counted in counts (the bottom bar's row count), view row indexes,getRowNumber, selection aggregates or total row aggregates. To change values, build a new array and pass it. - Export: not included by default. With
includePinnedRows: trueinexportCsv/getExportData, top pinned rows are output before the body rows and bottom pinned rows after them (before the total row; after it withpinnedBottomRowsPlacement: 'belowTotal') (not for a range selection (scope'selection')). The value rules are the same as body rows, andgetExportDatatells them apart with'pinned'inrowKinds. - Column auto-fit: makes the width fit pinned row values too.
- serverSide (
dataSource): works as is (pinned rows are drawn from the array you pass, so they aren't refetched from the server). - Accessibility: read as table rows (
role="row") and counted inaria-rowcount(top pinned rows after the header row, bottom pinned rows after the data rows; the order with the total row is the same as on screen). Row header names are "上に固定 1" (pinned top 1) / "下に固定 1" (pinned bottom 1) (localeText'spinnedTopRow/pinnedBottomRow). - Look: the top / bottom containers are
.ssg-pinned-rows(.ssg-pinned-rows--top/.ssg-pinned-rows--bottom), rows.ssg-pinned-row(data-ssg-pinned="top"/"bottom"), and cells.ssg-body-cell.ssg-pinned-cell. The background is the token--ssg-pinned-row-bg, and the line at the boundary with the body--ssg-pinned-row-border. /lite: the feature part ispinnedRowsFeature(createSpreadsheetGrid({ features: { pinnedRows: pinnedRowsFeature } })).
Row drag to reorder (enableRowDrag)
With enableRowDrag, grabbing the handle column (⋮⋮) at the start moves rows up and down (like AG Grid's managed row dragging). The reordered result comes back as a new array through onRowsChange, the same as normal edits, so you just replace rows.
const [rows, setRows] = useState(initialRows);
<SpreadsheetGrid
rows={rows}
onRowsChange={setRows}
columns={columns}
rowKeyGetter={(row) => row.id}
enableRowDrag
isRowDraggable={(row) => !row.locked}
onRowMove={({ rowKey, fromIndex, toIndex, rows }) => saveOrder(rows)}
/>-
Interaction: press the handle and drag up or down; a horizontal guide line shows at the insertion point. Dropping commits, and affected rows slide to their new positions (instant with
prefers-reduced-motion).Escape/ focus leaving the window during the drag cancels. When released outside the grid's frame, the default'ghost'cancels androwDragMotion: 'live'commits at the last visible position. Approaching the top / bottom edge auto-scrolls (you can carry rows to virtualized rows off screen). -
Ghost: during the drag, a pill following the pointer shows the displayed value (after
valueFormatter) of the first shown (non-synthetic) column. Columns that don't show values as text (renderCellcolumns withoutvalueFormatter, checkbox editor columns, data bar columns withshowValue: false) are skipped. If empty, "行 N" (row N). -
Data contract: on commit, "a new array with one element moved" (unchanged rows share references) is passed to
onRowsChange, andonRowMoveis called right after. Releasing right above / below the grabbed row (a position that doesn't move it) calls neither. It goes through the history wrapper, soCtrl/Cmd+Z/undo()undo it. -
When it works: clientSide (
rows+onRowsChange) only. WithdataSource(serverSide) / during row grouping / withoutonRowsChange, the handle column isn't inserted.readOnlydoesn't matter (reordering isn't a cell edit). To stop reordering too when read-only, passenableRowDrag={!readOnly}. -
While sorting / filtering: display order and the order of
rowsdon't match, so the handle is faded (.ssg-row-drag-handle--disabled) + a tooltip with the reason, and can't be used (the column stays, so the layout doesn't jump). It comes back when they are cleared. -
With expandable rows: an expanded master row moves together with its detail panel (with
rowDragMotion: 'live'too, the grabbed row's panel follows the pointer and the panels of rows moving out of the way move with them. When dragging down, the drop position is decided by the bottom edge of the panel so the opening gap overlaps the grabbed row + panel). Drop position detection includes the detail panel's height, and the area over a panel is treated as "below the master row". -
Handle column: a synthetic column, so it isn't covered by the column menu / sort / column DnD / autoSize / export / the sort manager panel. With left pinned columns it goes on the left pinned side, even before the expand toggle column.
-
Deciding where rows can be dropped (
canDropRow; since 1.2.0): to limit where rows can go, such as moving only within a group of label rows, returnfalsefromcanDropRow. Atfalsepositions no guide line shows (the ghost has the same faded look as outside the frame), and releasing doesn't move anything. WithrowDragMotion: 'live'it stays at the last droppable position, and releasing there moves it there.rowAbove/rowBelowinparamsare the rows that would be right above / below the grabbed row after the drop.// move only within the group of a label row (category) const sectionOf = useMemo(() => { const map = new Map<string, string>(); let section = ''; for (const row of rows) { if (isLabel(row)) section = row.id; else map.set(row.id, section); } return map; }, [rows]); <SpreadsheetGrid enableRowDrag canDropRow={({ row, rowAbove }) => rowAbove !== undefined && (isLabel(rowAbove) ? rowAbove.id : sectionOf.get(rowAbove.id)) === sectionOf.get(row.id) } ... /> -
Imperative API:
moveRow(rowKey, toIndex)moves within the source array regardless of display state (sort / filter) (onRowsChange→onRowMove;canDropRowdoesn't apply). -
Display style: with
rowDragMotion: 'live', the grabbed row follows the pointer during the drag and surrounding rows move out of the way in real time (slot resolution is shared with'ghost'). -
Styles:
.ssg-row-drag-handle(+--disabled) /.ssg-body-cell--row-drag-handle/.ssg-row-drop-indicator/ the row being dragged.ssg-body-row[data-ssg-row-dragging]. Colors are tokens (--ssg-drop-indicator/--ssg-glyph-*/--ssg-ghost-*).
Typing directly with the IME on (imeDirectInput)
By default, if you type with the IME on while a cell is selected, conversion doesn't start and the typed characters are lost (because while not editing, focus is on an element that isn't an input field. The IME works fine after starting an edit with F2 / Enter / a double click). Setting imeDirectInput to true lets you start typing with the IME on, as in Excel / SPREAD.
<SpreadsheetGrid rows={rows} columns={columns} onRowsChange={setRows} imeDirectInput />-
How it works: while not editing, grid focus is on a transparent input field (the input receiver) over the active cell. When you start typing Japanese, the text being converted shows over the cell with the same look as the editor, and when you confirm the conversion (
Enter/ choosing a candidate), editing starts with the confirmed string as the initial value. You can keep typing, and anotherEntercommits the cell and moves (where to iseditorEnterMove). Canceling the conversion (emptying it withEscape) doesn't start an edit. -
Targets: editable data cells with the text editor (no
editor/type: 'text'), the number editor, custom editors withimeDirectInput: true, the searchable select editor (search/loadOptions/allowFreeText; opens with the list filtered by the confirmed text; since 1.7.0), time / datetime / calendar date (picker: 'calendar'; opens with the confirmed text as what you started typing) and multiple selection (columns with search open the list filtered by the confirmed text; columns without it open with the candidate found by that text highlighted; all since 1.11.0). Other selects (single choice without search) / date with the browser's date input / checkbox / custom columns without the flag, read-only cells, group rows / label rows and SSRM rows not yet loaded discard the conversion (nothing is entered, as before). -
number columns: when you confirm a conversion, editing starts with full-width digits, signs, decimal points and thousands separators turned into half-width (「12.5」→
12.5, 「ー5」→-5, 「1,234」→1234; 「12。5」, which IMEs with the punctuation setting 「、。」 produce, also becomes12.5). A conversion of only a sign or decimal point (「ー」「。」) starts an edit as if you typed-/.(you can type digits after it). Conversions that can't be read as numbers, such as kana or kanji, are discarded. The IME itself isn't turned off (a browser can't turn the IME back on; Chrome / Edge don't support CSSime-modeeither). -
custom editors (since 1.2.0): adding
imeDirectInput: trueto the editor definition opens it with the confirmed text inctx.initialText(the same as how a key typed with letters goes intoinitialText). Make the editor useinitialTextas the input's initial value. Text being converted shows over the cell with the same look as the text editor. Custom columns without it discard the conversion as up to 1.1 (so confirmed text doesn't seem to vanish with editors not built to useinitialText).editor: { type: 'custom', imeDirectInput: true, render: (ctx) => <CityInput defaultValue={ctx.initialText} onCommit={(v) => ctx.commit(v, 'down')} onCancel={ctx.cancel} />, } -
What doesn't change: arrows /
Tab/Enter/F2/Delete/Ctrl+C/ paste / undo and other keys, starting an edit with a character key without the IME (that one character is the initial value), and leaving the grid withTabon the edge column. Keys during conversion (choosing candidates and so on) aren't handled by the grid. -
Clicking during conversion: if you click another cell or outside the grid during conversion, the text being converted isn't entered (confirm it before moving). Focus isn't taken from where you clicked.
-
Focus: while on,
document.activeElementis the input receiver (input[data-ssg-ime-input]). Checking whether the grid has focus withgridElement.contains(document.activeElement)works as before, but shortcuts that are "off while an input has focus" (such as the default of Mantine'suseHotkeys) stop working over the grid. This is why it is off by default. -
Touch-first devices (phones / tablets): the input receiver gets
inputmode="none"so tapping a cell doesn't open the on-screen keyboard (as before). -
Testing status: checked in Chromium (the same engine as Chrome / Edge / WebView2) with DevTools Protocol composition events (
Input.imeSetComposition/Input.insertText). Do the final check with the OS IME itself (MS-IME on Windows and so on) on real devices.
Motion (motion)
Grid motion (the active cell frame following, popovers appearing, rows moving on sort, the shimmer while loading and so on) is controlled all at once with the motion prop (default 'auto').
| Value | Behavior |
|---|---|
'auto' | 'off' when the OS / browser "reduce motion" (prefers-reduced-motion: reduce) is on, otherwise 'on'. Follows changes of the setting too. |
'on' | Animates regardless of the OS setting. |
'off' | Stops everything (the result looks the same and switches instantly). |
- It is built on CSS tokens:
--ssg-motion-fast(140ms) /--ssg-motion-base(260ms) /--ssg-motion-slow(600ms) /--ssg-motion-ease(easing). Every effect references only these tokens. With'off',.ssg-motion-offgoes on the root and every portal root, drag ghost and tooltip, and durations become 0. - You can change speeds by overriding the tokens (
.ssg-root { --ssg-motion-base: 180ms; }). The.ssg-motion-offvalues are defined with:where(specificity 0), so you can bring back specific effects even while stopped. - In SSR,
'auto'first renders as'on'and is resolved again on the client after hydration (the same astheme='auto'). - Effects that used to look at
prefers-reduced-motiondirectly (the tool panel flash / the filter candidates spinner / the scroll position indicator fade) now use the effective value ofmotiontoo (the same as before with'auto').
List of effects
| Effect | Default | Token | Notes |
|---|---|---|---|
| Active cell frame / selection following | On | --ssg-motion-fast | The frame slides to its new position on keyboard moves / clicks. While scrolling and while dragging a range with the pointer it follows instantly (to avoid looking like it drifts). |
| Popovers / menus appearing | On | --ssg-motion-fast | The column menu / context menu / filter / tool panel / select candidates / date panel fade in from 4px above. Appearing only (closing is instant). |
| Rows moving on sort / filter / group open and close | On (animateRows) | --ssg-motion-base | Rendered rows slide to their new positions (FLIP-like; a transition on the row element's transform). Off automatically with auto-height / SSRM. |
| Fade-in of rows that appear without scrolling | On (animateRows) | --ssg-motion-base | Rows that enter the window on sort, child rows of an expanded group and rows of replaced rows fade in from 3px below, top to bottom (about 23ms apart). Rows entering and leaving by scrolling aren't included. Rows that appear less than a second after rows last appeared (tables re-sorting with often-changing values and the like) show at once without fading (since 1.0.2, to avoid flicker). |
| Marching dotted line on the copied range | On (showCopyRange) | — | After Ctrl/Cmd+C, a dotted line flows around the copied range (0.6s cycle). With motion 'off', a still dotted line. |
| Hover crosshair | opt-in (hoverHighlight: 'cross') | — | Besides the pointer's row, lightly tints the column header, the row number and other cells in the same column (no motion; a static highlight). |
| Changed cell flash + number tween | opt-in (highlightChanges) | --ssg-motion-slow / --ssg-motion-base | Cells whose value changed fade from the accent color over 600ms, and numbers count up over 260ms. |
| Per-cell save status | On (showSaveStatus, when SSRM writes back) | --ssg-motion-base / --ssg-motion-slow | Stripes + spinner while saving → ✓ badge; failures shake + red flash + ✕ and a chip. With motion 'off', static marks only. |
| Live make-way for row drag | opt-in (rowDragMotion: 'live') | fixed 160ms | The grabbed row follows the pointer and rows it passes move out of the way on the spot. After dropping it settles with a slide as before. |
| Live make-way for column drag | opt-in (columnDragMotion: 'live') | fixed 160ms | The grabbed column follows the pointer and columns it passes move left / right on the spot. When crossing pinned panes, a copy of the column (the floating column) follows, the original pane closes up, and the target is shown with a vertical line + a header icon (pin / move arrow). After dropping it settles with a slide as before (when it crossed panes, the floating column slides into the new position). |
| Loading shimmer and fade-in of arriving rows | On | --ssg-motion-base | While SSRM fetches, a band of light flows over skeletons, and cells of rows replaced when a block arrives fade in from 3px below, top to bottom (about 23ms apart). Rows entering and leaving by scrolling aren't included. Doesn't happen in clientSide. |
| Small transitions | On | --ssg-motion-fast | Fades of header action icons, checkboxes, tab indicators, tooltips, the scroll position indicator. |
Find in cells (find)
With find, Ctrl/Cmd+F while the grid has focus (or handle.openFind()) shows a find bar at the top right of the grid (off by default). Separate from "narrowing (filters)", it is an operation that finds places without hiding rows, and it also covers virtualized rows the browser's Ctrl+F can't find.
<SpreadsheetGrid find ... />
// find={{ shortcut: false, caseSensitive: true }}- What it searches: view rows (after filtering / sorting) × the displayed text of visible columns (after
valueFormatter= the text you see on screen). Columns withrenderCellare searched by their displayed text too (valueFormatterorString(value)), but the<mark>highlight is only on default cells (moving to the current match works the same). Cells whose text is changed by thelabelof a status chip (conditionalFormat.chips) are searched by thelabelshown on screen (since 1.0.2; the chip function gets cell states such asisActiveas false). Among columns withoutrenderCell, checkbox editor columns and data bar columns withshowValue: false(columns that show no text on screen) are excluded. Rows inside collapsed groups, group source columns hidden by grouping (values that show only in group row labels) and label row (labelRow) text aren't searched either (only rows that are shown. The global filter can narrow by group source column values). - Scanning: time-sliced (10ms per chunk) so it doesn't block input or rendering. While scanning, the count shows "検索中…" (searching…). It scans again when the query / case sensitivity /
rows(edits, replacement) / sort / filters / columns change, and keeps the current match if the same match remains (without moving). - Stepping:
Enter/↓for the next,Shift+Enter/↑for the previous (wrapping). The current match gets a single selection like a click + a scroll into view (the same asselectCell(row, col, { scrollIntoView: true })). Retyping the query moves to the first match. - Closing:
Esc/ × clear the query and matches, and focus goes back to the grid body. Settingfindtofalsecloses it even if open. - Match limit: stops at 10,000 (
+in the count). With SSRM, only loaded ranges are searched (rows not yet loaded are skipped). - Styles: matches are
.ssg-find-mark, the current one.ssg-find-mark--current(tokens--ssg-find-mark-bg/--ssg-find-mark-current-bg). The bar isclassNames.findBar. - Shortcut:
Ctrl/Cmd+Fis taken over only when the grid body has focus (not in filter inputs / editors).shortcut: falseleaves it to the browser's own find, and you can open it only withhandle.openFind(). WhereCtrl/Cmd+Fcan't be pressed, such as on smartphones, there is no way to open the find bar, so put a button that callshandle.openFind()in a toolbar or similar.
Find and replace (find.replace)
With find={{ replace: true }}, the find bar gets a replace row (since 1.12.0; off by default). ▸ at the left end of the find bar opens and closes it, and Ctrl+H (when the grid has focus, including inside the find input) opens the bar with the replace row open. Ctrl/Cmd+F opens a closed find bar with the replace row closed.
<SpreadsheetGrid find={{ replace: true }} rows={rows} onRowsChange={setRows} ... />
// open the replace row and search for "Osaka"
gridRef.current?.openFind({ query: 'Osaka', replace: true });- Replace: replaces the current match's cell with the replacement text and moves to the next match after that cell (
Enterin the replacement field does the same). All matches within one cell are replaced. Replace all replaces every current match (regardless of find's 10,000 limit, it checks every row in time slices; meanwhile the button is disabled and shows "置換中…" (replacing…)). Either way the write is oneonRowsChangeand one undo (Ctrl/Cmd+Z) (trackChangesmarks appear too). Replace all writes only after it finishes checking, so if you close the find bar midway, "selection only" gets cleared, or the table keeps changing (it rechecks every timerowsis replaced from outside and, if it can't finish in 3 tries, says so in the notice row), it stops without writing anything (replaceAllresolves to{ replaced: 0, skipped: 0 }). For tables that keep updating rows from outside at short intervals, pause the updates during replace all. Case sensitivity follows find'scaseSensitive. Regular expressions aren't used. - Cells replaced: text columns (the value is a string and the text on screen is the same as the value) and select (
select) columns. For select columns the on-screen name (label) is replaced, and the value is written only when the result is a candidate's name or value (allowFreeTextcolumns write the replaced text). Written values follow the same rules as paste (the column'sparseClipboardValue, thevalidationMode: 'reject'checks). - Cells skipped: cells that can't be changed (
readOnlycolumns /editable: false/canEditCellfalse), number, date, time, date-time, checkbox, custom editor and multiple selection columns, text columns whose display is changed byvalueFormatter(except select columns), computed columns (getValueonly), values rejected byvalidationMode: 'reject', select columns that would get a name not among the candidates, and cells whose value wouldn't change by replacing (select columns ending on the same candidate and so on). Skipped matches keep the same mark (matches left after replace all = skipped cells), and the notice row shows counts such as "4 件を置換、1 件は置換できないため飛ばしました" (replaced 4, skipped 1 that couldn't be replaced). When a one-by-one replace skips, a sentence per reason (a cell that can't be changed, a column that can't be replaced, a name not among the candidates, the validation message, the value doesn't change). Label rows, group rows, the total row, pinned rows, the entry row and tree data aggregate cells are excluded, as with find. - Selection only: searches and replaces only within the selection at the time you check it (two or more cells; a row selection covers all columns, a column selection all rows) (counts, marks and ↑↓ also stay in the range = the same as Excel). Even if you check it after typing the search text after selecting a range (after the selection became one cell by moving to the first match), the range selected before typing is used. The range is remembered by the rows at the time it was set (even if replaced rows drop out of the filter, rows outside the range don't come in; if all rows in the range drop out, the range stays with 0 matches). The range shows in a light color (
.ssg-find-scope-overlay). It is cleared when sorting, filtering, opening / closing groups or reordering columns changes the view (if it is cleared during replace all, it stops there). Rows hidden by filtering and rows inside collapsed groups aren't replaced (the same as find; with tree data, rows inside closed parents are replaced). - Tables where it isn't available: read-only tables (
readOnly, or noonRowsChange) don't show the replace row (find only). It isn't available inserverSide(dataSource) tables (a development warning, find only). - Imperative API:
openFind({ query, replace: true })/replaceNext(text)(replaces the current match and moves to the next; returns{ replaced, skipped }) /replaceAll(text)(Promise<{ replaced, skipped }>). In tables where replace isn't available,openFindopens only find, andreplaceNext/replaceAlldo nothing (0). Right afteropenFind({ query })there are no matches until the search finishes, so callreplaceNextafter the search finishes (afteronFindChangereports the count) (replaceAllcan be called right away). WhereCtrl+Hcan't be pressed, such as on touch devices, put a button that callsopenFind({ replace: true })in a toolbar or similar. /lite:findReplaceFeature(findFeatureis needed too).
Entry row (newRow)
Shows an empty entry row at the end of the table, and typing there adds a row (since 1.10.0; like the last row of an Excel table or Airtable).
<SpreadsheetGrid
rows={rows}
onRowsChange={setRows}
rowKeyGetter={(row) => row.id}
createRow={() => ({ id: crypto.randomUUID(), name: '', qty: null })}
newRow
/>
<SpreadsheetGrid {...props} newRow={{ placeholder: 'Type a product name to add' }} /> // text in the first editable column
<SpreadsheetGrid {...props} newRow={{ placeholder: (column) => (column.key === 'qty' ? '0' : null) }} /> // per column
<SpreadsheetGrid {...props} newRow={{ placeholder: '' }} /> // no text
<SpreadsheetGrid {...props} newRow={{ onDraftChange: (draft) => setHasDraft(draft !== null) }} /> // get whether there is a draft- When it shows: in clientSide (
rows+onRowsChange) withcreateRowandrowKeyGetter, when notreadOnly. When something is missing, in serverSide and with row grouping (rowGroup) it doesn't show, with one development warning per grid. It is always the last row, even while sorting and filtering. - Empty entry row: the row number is "*" (accessible name
localeText.newRowHeader, "新しい行" (new row)). The first editable column showslocaleText.newRowPlaceholder("ここに入力して行を追加" (type here to add a row)) in faint text. Passing text tonewRow.placeholderuses that text, passing a function sets it per column (columns returningnull/undefined/''show nothing), and''shows nothing. Until a value is written, your functions (renderCell/cellClassName/cellNote/getRowClassName/validate/ conditional formatting) aren't called. - Typing: starting an edit in an entry row cell by typing /
F2/ double click callscreateRowonce at that point to make the row and opens the editor (closing without writing reuses the row, so it is called only once until a row is added). Writing a value makes a draft: the row number becomes "✎" (accessible namenewRowDraftHeader, "新しい行(下書き)" (new row, draft)), and cells are drawn from the draft row (from hererenderCell/getRowClassNameand the like are called;ctx.rowKeyis the draft row'srowKeyGettervalue andctx.sourceRowIndexis-1). Editability, parsers, validation andfillRoware the same as other rows. - When it becomes a row:
Enterin the draft's editor (to the same column of the next entry row; wheneditorEnterMoveisn't'down', it stays a draft) /Tabin the draft's last column (a column with no editable column to its right; when a read-only column such as an ID column is last, the one before it) (to the first editable column of the next entry row) / the active cell leaves the entry row / focus leaves the grid (when you press outside the grid, at release = before thatclick; moving to the top / bottom bar also counts as outside) / the entry row stops being in effect (switched toreadOnly,createRowremoved and so on) / undo or redo (typing the draft is the last action, so undo first removes that row and redo brings it back). It appends to the end ofrowsand callsonRowsChangeonce (one undo removes it). The added row is an ordinary row, so it takes its place in the sort order and disappears if it doesn't match the filter. - Discarding:
Escapeon the entry row while not editing discards the draft (the created row is reused next time; it isn't added to the history, so it can't be undone). Removing the grid while there is a draft discards it too (onRowsChangeisn't called). When you clear every value and it is back to thecreateRowrow (empty =null/undefined/''are treated alike), it goes back to an empty entry row (moving to another row doesn't add it). - Paste: pasting from the entry row adds as many rows as you paste (the first is the entry row's row, the rest come from
createRow; oneonRowsChange). - Selection: only the active cell can be on the entry row. Range selection, select all (
Ctrl+A), row and column selection and row checkboxes don't include the entry row (a range extended from data rows to the entry row stops at the last data row).Ctrl+End/Ctrl+↓stop at the last data row (go to the entry row with↓orfocusNewRow()). It isn't in counts, selection aggregates, copy, find or exports either. The context menu doesn't open on the entry row, andonCellClick/onCellDoubleClickaren't called. - Checkbox columns: the empty entry row is before
createRowis called, so checkbox columns draw nothing either (the default value of the row to be made isn't known). They draw once you toggle withSpace, or type in another column to make a draft. - To the entry row with the keyboard: the handle's
focusNewRow()moves to the first editable cell of the entry row, scrolls to it and moves focus to the grid (falsewhen there is no entry row or no editable column). - Making the row before saving: when you press a button outside the grid, it becomes a row at release (before
click). When you save with an action that keeps focus in the grid (keys likeCtrl+S), call the handle'scommitNewRow()first (the draft isn't ingetChanges()). If you disable the save button by the unsaved count, a draft alone can't press it, so get whether there is a draft withnewRow.onDraftChangeand include it in the condition (the draft row ornull; called after rendering). - Look: entry row cells have a background lightly mixed with the accent color, and the row number mark is the accent color.
.ssg-body-row--newanddata-ssg-new-row("empty"/"draft") on the row,.ssg-row-header-cell--newon the row number, and.ssg-new-row-placeholderon the empty entry row text (color:--ssg-readonly-textmoved slightly toward the body text color;GrayTextin high contrast). The entry row's row drag grip and expand toggle columns are empty, and row drag can't drop below the entry row. /lite: the feature part isnewRowFeature(createSpreadsheetGrid({ features: { newRow: newRowFeature } })). In setups without it,newRowhas no effect, with one development warning.
Excel keys (excelShortcuts)
Cut, copy down / right, fill a selection, today's date and row / column selection with the same keys as Excel (since 1.10.0). Only cut works by default; the other six work only in tables that set them in excelShortcuts (key behavior of existing tables doesn't change).
<SpreadsheetGrid excelShortcuts /> // all seven
<SpreadsheetGrid excelShortcuts={{ fillDown: false }} /> // leave only Ctrl+D out (keep it for browser bookmarks)
<SpreadsheetGrid excelShortcuts={false} /> // stop cut too| Key | Name (GridExcelShortcutsOptions) | Behavior |
|---|---|---|
Ctrl / ⌘+X | cut | Copies the selected range and surrounds it with a dotted line (values don't change yet). When the same text is pasted into this grid, the source cells are emptied along with the paste (one change, one undo; moving to an overlapping position works too). Source cells that can't be edited and cells that reject empty with 'reject' stay. If even one target cell can't be written (read-only, rejected by 'reject') or any text runs past the table with nowhere to go, the source isn't emptied and it becomes a plain paste (no value is lost; cells that couldn't be written go to onPasteSkipped). The same when a source value doesn't come back to the same value from text (arrays, objects, Date, values reshaped by formatClipboardValue). If the dotted line is gone (Escape / an edit started / sorting, filtering, column reordering), a source cell's value changed or different text is pasted, it is a plain paste (the source stays). Pasting into another app is the same as copy. With readOnly, copy only. On by default. |
Ctrl / ⌘+D | fillDown | Copy down. With two or more rows selected, writes the range's first row into the remaining rows; with one row, writes the row above (skipping label rows and group rows) into the selected row. Values are copied as is. |
Ctrl / ⌘+R | fillRight | Copy right. With two or more columns selected, writes the range's leftmost column into the remaining columns; with one column, writes the column to the left (skipping synthetic columns) into the selected column. Since the columns differ, the source's displayed text is read with the target column's parser (the same as paste). |
Ctrl+Enter (⌘+Enter on Mac; inside the editor) | fillSelection | Fill the selection. Select a range, start typing (the active cell is in the range) and commit with Ctrl+Enter to write the same value to every cell in the range (the selection stays and the active cell doesn't move). For one cell it commits like Enter without moving. In the multiline text editor it stays a line break. Custom editors aren't covered. |
Ctrl / ⌘+; | today | Writes today's date (YYYY-MM-DD from the device's date) into the active cell (only the active cell even with a range selected = the same as Excel; to fill the whole range, type the date and press Ctrl+Enter). Number, checkbox and select columns aren't written. Does nothing while editing. |
Shift+Space | selectRow | Selects the selected rows as whole rows (the same range selection as clicking the row number; row selection checkboxes don't change). |
Ctrl+Space | selectColumn | Selects the selected columns as whole columns (the same as clicking the column header). Ctrl on Mac too (⌘+Space is Spotlight). |
- Writes follow the same rules as paste (cells that can't be edited, label rows, group rows and tree data aggregate cells are skipped, and
'reject'columns don't write values that fail validation). If nothing changes, nothing is written. One key press is one change (oneonRowsChange, one undo), and in serverSide it is sent todataSource.updateRowsat once (a cut-paste sends the cells to empty and the cells to paste together). - On the entry row (
newRow),Ctrl+D/Ctrl+R/Ctrl+;work too and write into the draft (Ctrl+Dcopies from the last data row,Ctrl+Rfrom the column left of the draft; it doesn't become a row yet). - The grid calls
preventDefault()on keys it takes. Tables that handledCtrl+X/Ctrl+Dand the like themselves up to 1.9 should checkevent.defaultPreventedand stop their own handling, or remove it (otherwise both run and write twice). Ctrl/⌘+Dis the browser's bookmark key andCtrl/⌘+Rthe reload key. The grid takes them only when it has focus and the key is on in that table (writefalsefor keys you want to leave to the browser).Ctrl+Spacemay be used to switch the IME on Windows or the input source on Mac, and then it doesn't reach the page.- In
/lite(createSpreadsheetGrid), cut is in the core and the other six work only when you addexcelShortcutsFeature(setting them without it warns once in development).
Formatted copy (copyFormat / copyHeaders)
With copyFormat="rich", copy and cut write a formatted table (text/html) to the clipboard along with TSV (text/plain) (since 1.12.0; the default is 'text' = as before). Pasting into Excel, Google Sheets, Word, Gmail or Outlook gives a table with borders, alignment and colors. copyHeaders also includes a row of column names.
<SpreadsheetGrid copyFormat="rich" copyHeaders rows={rows} columns={columns} ... />- Rows and columns: the same as text copy (the selected range; synthetic columns aren't included, and rows where
isRowExportableisfalseare left out; tree data rows with children are aggregate values). - Cell text: the formatted table has the same text as the screen (the
valueFormattertext if any, otherwise text decided by the editor type; multiple selection joins names with the separator). TSV has values as before (columns withformatClipboardValue/clipboard: 'label'get that text).renderCellcolumns are text only, and data bars are text only too (no bar). Aggregate cells of tree data rows with children are the same aggregate text as the screen. Status chips (conditionalFormat.chips) get the chip name and color (only on cells that draw chips on screen = not onrenderCellcolumns, checkboxes or multiple selection cells), and color scales (colorScale) the cell background color. Leading and consecutive spaces may collapse into one depending on where you paste (an HTML rule; TSV keeps them). - Look: borders on every cell, headers bold with a background color, alignment from the column's
align(headersheaderAlign). Colors are computed at copy time (#rrggbb) and written for both background and text; the table background and text colors aren't written (they stay the target's defaults). Even when the table is dark, light colors are written (most targets have a white background). Colors changed with themes (--ssg-*tokens) are used as is for a light table. - Text columns: text of columns other than number, date, time, date-time and checkbox, and header names, are written with the "text" format (
mso-number-format) so Excel doesn't read "00123" or "1-2" as numbers or dates. If an exception happens while building the table (valueFormatteror a chip function threw and so on), only TSV is written (in development, an error in the console). - Headers (
copyHeaders): puts a row of column names (keyfor emptytitle) first. With column groups (columnGroups), the levels of groups over the copied columns go on top too (TSV writes the group name in the first column and leaves the rest empty = the same shape as CSV export; the formatted table merges the cells). Works withcopyFormat="text"too. Not included in cut or single-cell copies (copying one value into a chat or an input). When header-included text copied from this grid is pasted back into this grid as is, the header rows are skipped (even after the dotted line is gone or after sorting; text copied again in another app, or pasted into another grid, includes the headers as values). - Size: ranges over 20,000 cells write only TSV (large HTML makes the clipboard and the target heavy).
- Browsers: writes with
navigator.clipboard.write(ClipboardItem), and in browsers without it (Firefox up to 126) or when refused, with thecopyevent. If neither works, only TSV (as before). /lite:richCopyFeature. SettingcopyFormat="rich"without it gives only TSV (one development warning). The TSV forcopyHeadersis in the core.
Keyboard
Operations while the grid body has focus (not editing). They don't work while a form element such as a filter input has focus.
| Key | Action |
|---|---|
Arrows (+ Shift to extend the range) / Tab / Shift+Tab | Move the active cell (with labelRow, ↑ / ↓ skip label rows instead of stopping on them). Tab on the last column / Shift+Tab on the first column aren't stopped by the grid; the browser's default focus movement goes to the next / previous element outside the grid (avoiding a keyboard trap). Column header ⋮, group row open / close buttons and expand toggles aren't in the Tab order (tabindex="-1"), so one Tab enters or leaves the grid (open the column menu with Alt+↓ on the active cell. Tab on the last column leaves the grid without passing buttons or links placed in cells, headers or label rows (renderCell / renderHeader / labelRow.render) (1.0.2; reach them by clicking or with Shift+Tab from after the grid, and Tab after that follows DOM order). The first column is the first column after synthetic columns such as the row drag handle column (1.0.2). With expandable rows, Tab on the last column enters the first input or similar in that row's card if it is open, and another Tab on the card's last element leaves the grid (other rows' cards and buttons in cells aren't passed). Shift+Tab is the reverse: from the card's first element it goes back to that row's last-column cell, and coming back from after the grid it enters the last element of the active cell's row card. Add tabIndex={-1} to parts in cells, headers or cards you don't want it to stop on). |
Ctrl/Cmd+arrow (+ Shift) | To the edge row / column in that direction (the edge of the table; it doesn't stop at gaps in values). |
Home / End (+ Shift) | To the first / last column of the row. |
Ctrl/Cmd+Home / Ctrl/Cmd+End (+ Shift) | To the first cell / last cell. |
PageUp / PageDown (+ Shift) | To the row one visible body height above / below (at least one row). |
Shift+F10 / Menu key | Opens the active cell's context menu (when enableContextMenu is on and getContextMenuItems returns items; opens at the cell's bottom left and focuses the first item; since 1.1.0). Inside it works as in "Context menu", and Escape / Tab close it and go back to the grid. |
Alt+↓ (Option+↓ on Mac) | Opens the column menu of the active cell's column (with enableColumnMenu; opens below the header and focuses the first item). Inside the menu, ↓ / ↑ / Home / End move between items, Enter / Space run them, and Escape / Tab close it and go back to the grid (the same when opened with the mouse). "列の固定" (pin column) opens its submenu with → / Enter / Space and moves to its first item; ← in the submenu closes it and goes back to "列の固定" (opens with a tap on touch; since 1.0.1). On synthetic columns without a column menu (such as the auto group column) it is a plain ↓. |
Enter / F2 / typing a printable key | Start editing (a printable key becomes the initial value; in select editors it jumps to the first candidate starting with that character (columns with search: true filter by it); date editors open with a text input). Whether editing is allowed follows readOnly / the column / canEditCell. |
Enter / Space (on a group row / expand toggle column cell) | Opens / closes that group / expandable row (doesn't start editing). |
Alt+Shift+↓ / Alt+Shift+↑ (Option on Mac; on a cell of the tree column in tree data) | Opens / closes that row (treeData; since 1.9.0; Enter isn't used because it edits). |
Escape | Clears the selection (when a range is selected; a dialog containing the grid doesn't close on this Escape. When only one cell is selected nothing visible changes and Escape reaches the dialog). |
Ctrl/Cmd+C / paste (Ctrl/Cmd+V) | TSV copy of the selection (when there is no range selection (after clearing it with Escape and so on), the active cell alone; since 1.3.0; with isRowExportable, rows that return false are left out) / paste (no-op with readOnly). Paste starts from the top left of the selection (for a column selection, the column's first data row; for a row selection, the start of the row; when the active cell is outside the selection, from the active cell). A one-cell copy (and a range that is a multiple of the copy's size) repeats to fill the selected cells (the same as Excel; since 1.2.0; once only with pasteFillsSelection={false}). Label rows and group rows are skipped and the paste goes to the next data row. TSV is compatible with Excel / Google Sheets (cells containing line breaks, tabs or " are wrapped in "…" with " doubled as ""; paste interprets these quotes and keeps blank lines in the middle as rows. If every cell in the last row is empty, one line break is added to the end of the copied text = the same shape as Excel's copy, so the last empty row isn't lost on paste; since 1.0.2). Synthetic columns (the row drag handle column, the expand toggle column, the auto group column) aren't counted as copy columns (no empty columns in the TSV) and are skipped on paste (pasting from a synthetic column cell writes from the data column to its right). With copyFormat="rich" a formatted table (text/html) is written too, and copyHeaders puts a row of column names first (since 1.12.0; see "Formatted copy (copyFormat / copyHeaders)"). |
Ctrl/Cmd+X | Cut (since 1.10.0; on by default). Copies the selected range and surrounds it with a dotted line; when the same text is pasted into this grid, the source cells are emptied (see "Excel keys (excelShortcuts)"). excelShortcuts={false} or { cut: false } makes it do nothing (the same as up to 1.9). |
Ctrl+D / Ctrl+R / Ctrl+; / Shift+Space / Ctrl+Space | Copy down / copy right / today's date / select rows / select columns (only in tables that set them in excelShortcuts; since 1.10.0; see "Excel keys (excelShortcuts)"). In tables that don't, as before (the grid doesn't take them). |
Ctrl/Cmd+F | Opens the find bar (when find is on; otherwise the browser's own find). |
Ctrl+H | Opens the find bar with the replace row open (when replace is available with find={{ replace: true }}; since 1.12.0. Cmd+H isn't used because it hides the app on macOS). |
Ctrl/Cmd+A | Select all (pressing again clears). |
Delete / Backspace | Clears the values of the selected cells (or the active cell if none). Cells that can't be edited are left alone. The clear value follows the same rule as "pasting an empty string" (through parseClipboardValue(''), '' when undefined). A no-op when nothing changes (nothing is added to the undo history). |
Ctrl/Cmd+Z / Ctrl/Cmd+Shift+Z / Ctrl/Cmd+Y | undo / redo (details in the imperative API's "undo / redo (edit history)" section). |
Edge rows / columns skip label rows, and the first column is the first column after the operational synthetic columns (the row drag handle column, the expand toggle column) (← can still move onto them; it stops on the auto group column). When extending the range with Shift, it moves from the end of the current range (ranges selected by dragging or Shift+click extend as is too; ranges extended only with keys behave as before). When there is no active cell (right after entering the grid with Tab and so on), the first arrow / Tab / Enter / PageUp / PageDown stops on the first cell (the first row after label rows × the first column above) (it doesn't start editing; Shift+Tab leaves the grid; Ctrl/Cmd+End and the like go to the edge even without one). When the active cell is moved with the keyboard, besides the grid, scrolling parents around the grid and the page also scroll as little as needed to show the active cell (when the bottom of the grid is outside the window and so on; since 1.0.2. Not when pressing with the mouse, or for imperative API calls while focus is outside the grid).
In tables with pagination (pagination), key navigation and range selection stay within the current page (Ctrl/Cmd+End goes to the last cell of that page, Ctrl/Cmd+A selects that page's rows; since 1.15.0). There is no key to change pages (use the pager buttons or the handle's setPage).
Mouse: pressing a cell makes it the active cell, and dragging from there selects a range. Shift+pressing a cell selects from the anchor of the current range (the active cell if there is no range) to the pressed cell (the active cell stays at the anchor; the same anchor as Shift+arrow; with enableRangeSelection={false} only the pressed cell). Row numbers work the same: Shift+pressing a row number selects from the anchor of the current row range (the active cell's row if none) to the pressed row (in tables with enableRowSelection, a range of checkbox row selection). Pressing a column header selects that column, but Shift+pressing a column header adds that column to the sort instead of extending the range (each press cycles ascending → descending → off; other columns' sorts stay. With enableSorting={false} it selects the pressed column).
Inside an editor: Enter = commit and move down (the direction can be changed with editorEnterMove; default 'down'), Tab / Shift+Tab = commit and move right / left, Escape = cancel, focus out = commit. In the multiline text editor (editor: { type: 'text', multiline: true }), Alt+Enter and Ctrl / ⌘+Enter insert a line break (columns with enterKey: 'newline' insert a line break with Enter and commit with Ctrl / ⌘+Enter). PageUp / PageDown don't scroll the grid (select editors move 8 candidates at a time; inside the multiline text editor, move with the wheel or arrow keys / Ctrl+Home / Ctrl+End). Home / End move the caret in text / number, go to the first / last candidate in select, and do nothing in date (none of them scroll the grid). In tables where fill selection is on with excelShortcuts, Ctrl / ⌘+Enter writes to every cell of the selected range (since 1.10.0; see "Excel keys (excelShortcuts)"). Committing without changing the value (F2 → Enter and so on) writes nothing (onRowsChange / dataSource.updateRows aren't called and nothing is added to the undo history; moving after the commit works as usual). During IME conversion (isComposing, including keydown with keyCode 229 that Safari sends on confirming a conversion), Enter / Escape / Tab are handled only as IME operations and aren't used to commit / cancel the cell edit.
Focus after commit / cancel: committing or canceling with Enter / Tab / Escape returns focus to the grid (to the input receiver with imeDirectInput). When an edit is committed by focus leaving, if focus moved to an element outside the grid (an input of a form above the grid / the top bar's global filter and so on), it stays there and isn't taken back by the grid (you can type straight into the input you clicked). When another cell in the grid was clicked, or there is nowhere focus moved (a click on space that takes no focus and so on), focus returns to the grid. Focus inside an expandable row card isn't taken.
Grids inside dialogs (for where popups are drawn, see "Grids inside dialogs (popupContainer)"): Escape presses the grid uses (canceling an edit, closing the grid's menus or popovers, clearing a range selection, removing the copy range's dotted line, stopping a row / column / fill handle drag (1.0.2)) don't close a modal containing the grid (Radix / Headless UI / Mantine / HeroUI Modal / Dialog, plain <dialog>) (while shown, the grid listens for Escape in window capture and calls preventDefault(), temporarily adds data-mantine-stop-propagation, which Mantine's Modal looks at, to that element, and stops propagation at the grid root). Escape presses the grid doesn't use (only one cell selected, inputs in the top bar and so on) reach the dialog as is. Listeners attached to window capture before the grid (dialogs opened after the grid and so on) may close first.
When a row moves or disappears during an edit (since 1.3.0): when the row being edited moves because of sorting, rows added above and so on, the editor follows (what you typed stays; custom editors aren't re-created either). When the row drops out of the filter (but is still in rows), what you typed is committed and written to that row (text / number / date; for custom, the value if the input's onBlur calls ctx.commit. However, when filtering reduces the table's rows and no row remains at the edited position, the editor may be removed before onBlur and nothing is written. select is canceled), and focus stays in the grid. Rows that can't be written (canEditCell is false; canEditCell gets the position before dropping out) and values rejected by validation aren't written. When rows is replaced with other rows and the edited row is gone, and in serverSide, it is canceled. Up to 1.2.x it ended the edit silently (what you typed was discarded), and focus fell to body so keys didn't work.
Active cell after commit: after a commit with no direction (focus out / clicking a select candidate / a custom editor's commit(value) / Enter with editorEnterMove: 'none'), the edited cell becomes a single selection. However, when the commit was caused by pressing another cell, row or column header in the grid, the press (activating that cell / range selection by dragging / row or column selection) wins and the selection doesn't go back to the edited cell. Commits with a direction such as Enter / Tab move to the neighboring cell as before.
To start typing Japanese with the IME on (on a cell that isn't being edited), turn on imeDirectInput (off by default; when off, conversion doesn't start and the first input is lost; see "Typing directly with the IME on (imeDirectInput)").
Where it moves after a commit is clamped by the row and column counts "after the re-render that reflects the commit". So for consumers that add an empty row at the end in onRowsChange (the standard pattern for Excel-like entry grids), committing the last row with Enter moves straight to "the added row". When no row is added, it stays on the last row as before.
Accessibility
Following the WAI-ARIA grid pattern, the table, rows and cells get roles and states (for assistive technology; ariaLabel names the table).
| Element | Role / attributes |
|---|---|
Table body (.ssg-scroll-container) | role="grid". aria-label (ariaLabel) / aria-rowcount (shown rows including the header row; also pinned rows (pinnedTopRows / pinnedBottomRows) and the total row (totalRow) if present) / aria-colcount (columns including the row number column) / aria-multiselectable (with enableRangeSelection) / aria-readonly (with readOnly). |
Element that takes focus (.ssg-shell) | role="group". aria-activedescendant is the id of the active cell, only while that cell is rendered (moving between cells with the keyboard makes assistive technology read that cell). |
| Header row / data rows | role="row". aria-rowindex is 1 for the header row and display order + 2 for data rows (plus the number of top pinned rows if any; with column group levels, both header and data rows come that many later). aria-selected when there are row selection checkboxes. Rows not yet loaded (SSRM skeletons) get aria-busy. |
| Column headers | role="columnheader". aria-colindex (the row number column is 1). aria-sort (ascending / descending) only on the column of the first sort key. Headers of the row drag handle and expand toggle columns (synthetic columns) stay visually empty but have names in hidden text ("移動" (move), "詳細" (details); localeText's rowDragColumnName / detailColumnName; since 1.3.0. Up to 1.2 they were headers with no text, which gave axe empty-table-header). |
| Row numbers / top left corner | role="rowheader" / role="columnheader". |
Column group levels (columnGroups) | role="row" per level (aria-rowindex is 1, 2, … from the top level, and the column header row and data rows come after). Group headers are role="columnheader" + aria-colindex (the first column) + aria-colspan (the number of columns spanned). The open / close button has aria-expanded and aria-label (localeText's expandColumnGroup / collapseColumnGroup) and tabindex="-1" (with the keyboard, open / close it with the item of the same name at the top of the column menu (Alt+↓)). The grip is hidden from screen readers like column header grips (aria-hidden), with dragColumnGroup in its tooltip. The tool panel's "列" (Columns) tab groups columns with role="group" per group (named by the group's title), and the group's check is aria-pressed (all shown true / some mixed / all hidden false). Headers of columns not in a group sit in the column header row and only visually extend into the levels above (since 1.6.0). |
Label rows (labelRow) | The row is role="row" with aria-label set to the row's heading text (the getLabel value). The visible content cell with the heading text is role="rowheader" (aria-colindex="1"). The row number cell on the left and bands in panes with no content (pinned column panes) are aria-hidden (since 1.1.0; 1.0.2 made the text-less row number cell role="rowheader" + aria-label, and axe reported an empty header (empty-table-header)). |
Tree data (treeData) | The table body is role="treegrid" (since 1.9.0). Data rows get aria-level (top = 1) / aria-setsize / aria-posinset (the number of siblings and the position among them), and rows with visible children aria-expanded. The open / close mark is a button (tabindex="-1", aria-label "(row name)を開く / 閉じる" (open / close (row name)) = localeText's expandTreeRow / collapseTreeRow); with the keyboard, Alt+Shift+↓ / Alt+Shift+↑ on a cell of the tree column. |
Entry row (newRow) | role="row" (after the table's last data row). The row number is role="rowheader", its mark ("*" / "✎" for a draft) is visual only (aria-hidden), and the name is aria-label ("新しい行" (new row) / "新しい行(下書き)" (new row, draft) = localeText's newRowHeader / newRowDraftHeader). No row checkbox and no aria-selected (since 1.10.0). |
| Top bar filter summary / filter chips | Pressable buttons. The accessible name is the visible text followed by a description of the action (aria-labelledby; e.g. 絞り込み: 1 列 フィルター管理パネルを開閉, 単価 >= 1000 単価 のフィルターを編集; since 1.0.2. Up to 1.0.1 only the action description). They can also be found with the action description alone, as in getByLabelText('単価 のフィルターを編集'). |
| Tool panel "列" (Columns) tab | Column show / hide buttons are aria-pressed (true when shown; present even when they can't be pressed; since 1.0.2). In tables without onColumnsChange, the scrolling list gets tabindex="0" (because the items inside can't be pressed; since 1.0.2). |
Column header ⋮ / group row open / close buttons / expand toggles | tabindex="-1" (not in the Tab order; grid key handling happens on the element that takes focus, and one Tab enters or leaves the grid). The aria-label of ⋮ is "<column name> の列メニュー" (column menu; a half-width space after the column name, e.g. 数量 の列メニュー; the tooltip is "列メニュー"). With the keyboard, Alt+↓ on the active cell opens that column's column menu. Open / close buttons and toggles have aria-expanded and aria-label, and with the keyboard open / close with Enter / Space on the active cell. The expand toggle's aria-label is "行 N の詳細を開く" / "行 N の詳細を閉じる" (open / close details of row N; N is the same number as the row header = label rows aren't counted; localeText's showDetails / hideDetails; since 1.3.0. Up to 1.2, "詳細を開く" without the row number). |
| Cells | role="gridcell". aria-colindex / aria-selected (in the selection) / aria-readonly (cells that can't be edited) / aria-invalid (cells failing validation; not added with showValidationMarks={false}) / aria-description (the validation message and the note (cellNote); the same text as the tooltip; 1.0.1. Unsaved cells of change tracking (trackChanges) continue with "未保存(変更前: 120)" (unsaved, was 120); since 1.8.0). Row numbers of rows with unsaved cells get aria-description "未保存の変更あり" (has unsaved changes) (since 1.8.0). |
| Row selection checkboxes | role="checkbox". aria-checked (mixed for partial selection) / aria-label ("すべての行を選択" (select all rows), "行 N を選択" (select row N)). When checkboxes show, the (empty) row number cell of group rows is visual only (aria-hidden; since 1.2.0; the group's name is in the auto group column cell). |
Cells with editor: { type: 'checkbox' } | role="checkbox". aria-label is the column's title (key if none). |
| The editor while editing | role="group", aria-label "<column name> を編集" (edit; a half-width space after the column name, e.g. 数量 を編集). Built-in editors' inputs get the same aria-label (1.0.1). Because it is drawn over the row, outside it, the cell being edited owns the editor as a child with aria-owns (assistive technology sees the editor inside the cell). The select editor's input is role="combobox" (choose only; aria-expanded / aria-controls / aria-activedescendant point at the highlighted candidate), the candidate list is role="listbox" (same name), and candidates are role="option" + aria-selected (1.0.1). The searchable select editor's (search) input also has aria-autocomplete="list", and candidates tell the total and position with aria-setsize / aria-posinset (since 1.7.0). For values that can't be committed (validationMode: 'reject'), the input gets aria-invalid and the message role="alert". |
| Column menu | role="menu" (aria-label is the column name; since 1.1.0). Items are role="menuitem", sort ascending / descending are role="menuitemradio" + aria-checked (the current order), and dividers role="separator". The "列の固定" (pin column) submenu is also role="menu", with role="menuitemradio" + aria-checked items (the explanation when pinning isn't possible is aria-describedby). The column header ⋮ has aria-haspopup="menu" / aria-expanded. Opened with the mouse, focus moves to the panel (↓ to the first item); opened with Alt+↓, to the first item. |
Context menu (enableContextMenu) | role="menu" + aria-label ("セルのメニュー" (cell menu) when opened on a cell, "行のメニュー" (row menu) when opened on a row number; localeText's contextMenuCell / contextMenuRow; since 1.2.0), items role="menuitem", dividers role="separator". Opened with a right click, focus moves to the panel; opened with Shift+F10 / the Menu key, to the first item (since 1.1.0). |
| Tool panel | role="dialog" (not modal), aria-label is localeText.toolPanelLabel (default ツールパネル, English Tool panel). Opening moves focus to the selected tab, and Tab / Shift+Tab cycle inside (after the last comes the first). Closing with Escape / × / pressing the opener again returns focus to the opener (the top bar filter summary, your own button and so on) (to the grid when opened from a column menu item). The top bar filter summary has aria-haspopup="dialog" / aria-expanded. Focus moves to the "列" (Columns) tab's search box only when you switch to that tab while the panel is open (not on touch-first devices). Tabs are role="tablist" / role="tab" + aria-selected, and the content role="tabpanel" (since 1.1.0; up to 1.0.2 there were no roles or names, and opening didn't move focus). |
| Column filter popover | role="dialog" (not modal), aria-label "列フィルター: <column name>" (column filter). The search box has an aria-label too. Tab / Shift+Tab cycle inside (after the last comes the first), and Escape closes it and goes back to the grid (1.0.1). |
Total row (totalRow) | role="row" (the table's last row; aria-rowindex = shown rows + 2 + the number of pinned rows). The heading ("合計" (total)) cell is role="rowheader" and the cells role="gridcell". When the heading goes in the first data column, that cell is the row header and the row number cell is visual only (aria-hidden; since 1.2.0; no text-less row headers). |
Pinned rows (pinnedTopRows / pinnedBottomRows) | role="row". Top pinned rows come after the header row (aria-rowindex from 2), bottom pinned rows after the data rows (before the total row; after it with pinnedBottomRowsPlacement: 'belowTotal'). The row header is role="rowheader", and the pin mark (role="img") has aria-label ("上に固定 1" (pinned top 1), "下に固定 2" (pinned bottom 2); localeText's pinnedTopRow / pinnedBottomRow). The row header's name comes from this mark (since 1.2.0; 1.1.0 put aria-label on the row header, which axe reported as a text-less row header, empty-table-header). Cells are role="gridcell" + aria-readonly. |
Fill handle (fillHandle) | The handle is aria-hidden (pointer only; with the keyboard, use copy / paste). The button after filling has aria-haspopup="menu" / aria-expanded / aria-label ("オートフィル オプション(連続データ)" (auto fill options, series) and so on), the menu is role="menu", and items role="menuitemradio" + aria-checked. |
Find bar (find) | role="search", aria-label is localeText.findLabel (default セル内検索). The input has an aria-label too. The count and replace notices are aria-live="polite" (the text element is re-created for every notice so repeated identical notices still get through). The replace row's (find={{ replace: true }}) ▸ has aria-expanded, and the replace / replace all buttons get aria-disabled="true" when unavailable (focus stays on a pressed button). Opening moves focus to the search field (also on Ctrl/Cmd+F / Ctrl+H / openFind() while open), and Esc (from anywhere in the bar) closes it and goes back to the grid. The Tab order is search field → ↑ ↓ × → replacement field → replace → replace all → "選んだ範囲だけ" (selection only). Since 1.12.0 (the bar since 1.0). |
Pagination (pagination) | <nav> (aria-label is localeText.paginationLabel, default ページ). Number buttons are named like 「ページ 3」 (goToPage), and the current page has aria-current="page". The ‹ › buttons are disabled on the end pages. When the page changes, the row range (「51–100 / 1234 行」) is read out with aria-live (not on the first render). The table's aria-rowcount and the rows' aria-rowindex count across all pages (since 1.15.0). |
Loading (loading) | aria-busy="true" on the table. Skeleton rows shown while there are no rows are aria-hidden (not counted as rows). The default bottom bar shows 「読み込み中」 where the counts are (since 1.15.0). |
- Rows and columns not rendered due to virtualization aren't in the DOM, so positions within the whole table are conveyed with
aria-rowindex/aria-colindex/aria-rowcount/aria-colcount. - Limitations: with pinned columns (
pinned), one row is split into arole="row"per left / center / right pane (all with the samearia-rowindex; reading order is DOM order, pane by pane). Expandable row (detailRow) bands have noaria-rowindex(so data row numbers don't shift). The empty element right after the table (a marker for leaving the table from an expandable row card withTab) hasaria-hiddenremoved only while there is a card in theTaborder (since 1.3.0; when focus arrives it moves straight to the next element outside the table). Label rows duplicated for sticky display (labelRow.sticky) arearia-hidden, and buttons inside aretabindex="-1"(Tab doesn't stop on them; they can be clicked; the real label rows are unchanged). - While editing, checkers such as axe may report
aria-required-childrenon the table (role="grid"). The editor is drawn outside the row and linked from the cell being edited witharia-owns; in the browser's accessibility tree it is a child of the cell (checked in Chrome), but checkers also count elements moved witharia-ownsas children of their original parent.
Grids inside dialogs (popupContainer)
Popups (the column menu / column filter / context menu / select editor candidates / tool panel / the fill handle menu and value tooltip / tooltips / drag ghosts) are drawn outside the table. By default (popupContainer="auto"), inside a dialog around the grid, or directly under document.body if there is none (since 1.1.0; up to 1.0.2 always directly under document.body, so inside modals they sometimes couldn't be clicked or were hidden behind).
| Value | Where they are drawn |
|---|---|
'auto' (default) | Inside the nearest dialog around the grid (<dialog> / an element with the popover attribute / aria-modal="true" / role="dialog" / role="alertdialog"). If none, when the grid is in a Shadow root, inside the element wrapping the grid directly under that Shadow root (since 1.3.0; see "Grids inside Shadow DOM"), otherwise directly under document.body. When that dialog clips with overflow and is also the containing block for position: fixed because of transform and the like (the content of Mantine's Modal), inside the nearest position: fixed ancestor outside it (Mantine's .mantine-Modal-inner) (<dialog> / popover aren't left). |
'body' | Always directly under document.body (the same as up to 1.0). |
| An element | Inside that element. |
| A function | Receives the grid's element (.ssg-shell) and returns where to draw (document.body for null / undefined). Called on every render while a popup is open (not while closed). |
- Plain
<dialog>showModal()andpopoverare in the top layer, so elements directly under body are hidden behind them. Radix (shadcn/ui) / React Aria (HeroUI) / Headless UI modals block outside pointers (pointer-events: noneon body), trap focus inside and close on outside presses, so popups directly under body can't be clicked or typed into. Radix's Dialog and Popover don't addaria-modal, so they are found byrole="dialog". - The place is decided every time a popup opens (even if a
<dialog>containing the grid is opened later withshowModal(), popups appear inside it). They are added as the dialog's last child and removed on close. - When an ancestor of the target has
transform/translateand the like (shadcn/ui's DialogContent is centered withtranslate), that element becomes the containing block forposition: fixed. The grid measures that offset and cancels it with the popup'stranslate(on open and whenever the position is recomputed; tooltips and drag ghosts each time they show). Scaling (scale) isn't canceled. - When that element clips its content with
overflowand is also the containing block forposition: fixedbecause oftransformand the like, popups are clipped by the dialog's frame too.'auto'goes out to an outerposition: fixedancestor if there is one (the table above; this is why Mantine's Modal doesn't clip). When there is none (such as Radix's DialogContent, which is itselfposition: fixedwithoverflow-y: auto), they get clipped, so pass a place that doesn't clip as an element or function ('body'is fine too if the dialog doesn't block pointers and focus outside it). With onlyoverflow(notransform), fixed popups aren't clipped. The popup root ispointer-events: auto(it can be clicked even when drawn inside an element withpointer-events: none). - CSS tokens (
--ssg-*) set on the table are copied to popups when they open, as before (see "CSS tokens"). ForEscape, see "Grids inside dialogs" in "Keyboard". - Popups you show yourself inside a custom editor (
editor.type: 'custom') orrenderCell(candidate lists and so on) aren't covered bypopupContainer. Portaled todocument.body, they are hidden behind a modal<dialog>and can't be clicked. Like the grid, put them inside the surrounding dialog (createPortal(list, anchor.closest('dialog') ?? document.body), whereanchoris the editor's input or similar; for modals like Radix, pass the same element to that library's Portalcontainer).
Grids inside Shadow DOM
You can put the grid inside a Shadow root (attachShadow({ mode: 'open' })) such as in Web Components (since 1.3.0; up to 1.2.x tooltips, confirming conversions with imeDirectInput, ↑↓ in the column menu and context menu and focus when opening the tool panel didn't work, and popups appeared directly under document.body without styles).
import { createRoot, type Root } from 'react-dom/client';
import { SpreadsheetGrid } from '@ishibashi0112/spreadsheet-grid';
import css from '@ishibashi0112/spreadsheet-grid/style.css?inline'; // Vite. Any way of reading the CSS as a string works
class InventoryGrid extends HTMLElement {
#root: Root | null = null;
connectedCallback() {
const shadow = this.attachShadow({ mode: 'open' });
const style = document.createElement('style');
style.textContent = css;
const container = document.createElement('div'); // wrap the grid in an element (popups appear inside it)
shadow.append(style, container);
this.#root = createRoot(container);
this.#root.render(<SpreadsheetGrid rows={rows} columns={columns} />);
}
disconnectedCallback() {
this.#root?.unmount(); // the Solid version calls the dispose returned by render()
}
}- CSS: CSS outside the Shadow root doesn't reach inside, so put
style.css(andthemes/*.cssif you use a theme) inside the Shadow root (<style>oradoptedStyleSheets). - Popups: the default
'auto'draws them inside the element wrapping the grid directly under the Shadow root (a dialog around the grid comes first if there is one). If you put the grid directly under the Shadow root (the direct child is.ssg-root), they go todocument.body, so wrap it in an element, or pass an element inside the Shadow root topopupContainer. If the wrapping element hasoverflowtogether withtransform/containand the like, popups are clipped by its frame (the same as inside dialogs; then pass an element that doesn't clip withpopupContainer). theme="class":class="dark"/data-theme="dark"outside the Shadow root aren't visible to selectors of the CSS inside. Put it on the element wrapping the grid inside the Shadow root, or pass'light' \| 'dark'.- Use an open Shadow root: with closed (
mode: 'closed'), elements inside aren't visible from events received on window, so closing popups by pressing outside,Escapeand the like may not work. - Text size: inherited CSS (
font-size/line-height/font-family/color) crosses the Shadow root boundary. Text in cells, bars and popups inherits the page's settings, while column headers, label rows, menu items and so on are set in px (row height is set byrowHeight, so large page text clips cell content and doesn't match the headers). To keep the page's settings from pulling it along, set them on the grid, as in.ssg-root { font-size: 13px; line-height: normal; }(the same without Shadow DOM). - iframes: rendering the grid in a page inside an iframe is fine (set the height inside the iframe; with
height="100%", givehtml/bodyinside the iframe a height). Rendering from the parent page into a same-origin iframe'sdocument(as react-frame-component does) isn't supported (the grid listens for presses and keys on thewindowof the script that rendered it, so column width dragging, the fill handle, tooltips, ↑↓ in menus andEscapedon't work).
Per-part slots (classNames / GridSlotProps)
Every className-style entry point (classNames.* / cellClassName / getRowClassName / detailRow.className / labelRow.className / totalRow.className) accepts GridSlotProps (GridSlotProps / GridClassNames are exported from the barrel).
type GridSlotProps = string | { className?: string; style?: CSSProperties };- Strings are added as a class as before. The object form has the same shape as the return value of StyleX's
stylex.props(...)and can be passed as is (StyleX's dynamic styles arrive as CSS variables on thestyleside, so this shape is needed). styleis applied inline to the root element of that part. Coordinates / dimensions the grid uses for positioning (left/top/width/height/transformand so on) are overwritten by the grid last, so the layout can't be broken.- Inline styles also beat state classes (backgrounds for selection / hover and so on). Do decorations that switch by state on the className side.
- You may pass a new object to
classNamesevery render (it is memoized by a signature of its contents, and row / header re-renders don't increase). The style returned bygetRowClassNameis also memoized by content comparison. tooltip/dragGhostare imperative DOM (outside the table;popupContainer), so numeric style values are set unitless as they are (write values that need px as strings like'12px').
| Slot | Applied to |
|---|---|
root | The root element .ssg-root (the same element as the className / style props) |
toolbar / statusBar | The default top bar .ssg-bar--top / the default bottom bar .ssg-bar--bottom (not applied when renderTopBar / renderBottomBar is given) |
headerRow / headerCell | The header row / column header cells (not including the corner or row header cells) |
rowHeaderCell / cornerCell | The row header "#" cells and the corner cell (rowHeaderCell covers both, cornerCell only the corner) |
bodyRow / bodyCell | Body rows (data / skeleton / group rows) / data cells |
groupRow / groupCell | Group rows / cells of group rows (added on top of bodyRow / bodyCell) |
detailBand / detailCard | The band / card of expandable rows (added on top of detailRow.className) |
labelRow / labelRowContent | The row element of label rows (heading / separator rows) .ssg-body-row[data-ssg-label-row] (added on top of bodyRow / labelRow.className; also on the vertically pinned copy) / the content container .ssg-label-row-content |
totalRow / totalCell | The row element of the total row .ssg-total-row (for the 3 panes; added on top of totalRow.className) / cells of the total row .ssg-total-cell (added on top of bodyCell) |
iconButton | Icon buttons in the header .ssg-icon-btn |
popover | The root of portal panels (column menu / filter / context menu / select editor options / tool panel; outside the table = popupContainer) |
menuItem | Menu items .ssg-menu-item (column menu / context menu) |
tooltip | The custom tooltip .ssg-tooltip (a singleton outside the table. With several grids, the value of the grid that updated last) |
dragGhost | The ghost of column / row drags [data-grid-drag-ghost] |
checkbox | The checkbox glyph of row selection / checkbox columns .ssg-row-checkbox |
cellEditor | The frame of cell editors .ssg-cell-editor |
emptyState | The empty state with 0 rows .ssg-empty-state |
filterChipBar | The filter chip bar .ssg-filter-chip-bar |
errorBar | The SSRM error bar .ssg-ssrm-error-bar |
scrollHint | The scroll position indicator .ssg-scroll-hint |
activeCellOverlay / selectionOverlay | The active cell frame / range selection fill |
copyRangeOverlay | The marching dotted line of the copied range .ssg-copy-range-overlay |
findBar | The find-in-cells bar .ssg-find-bar |
Using with StyleX
import * as stylex from '@stylexjs/stylex';
import { vars } from './tokens.stylex'; // stylex.defineVars({ accent: '#7c3aed', danger: '#dc2626' })
const s = stylex.create({
grid: { '--ssg-accent': vars.accent, borderRadius: 8 }, // bridge to the grid's tokens
cell: { fontVariantNumeric: 'tabular-nums' },
negative: { color: vars.danger },
width: (w: number) => ({ maxWidth: w }), // dynamic style (arrives on the style side)
});
<SpreadsheetGrid
classNames={{ root: stylex.props(s.grid), bodyCell: stylex.props(s.cell) }}
columns={[{ key: 'amount', title: 'Amount', cellClassName: (ctx) => stylex.props(typeof ctx.value === 'number' && ctx.value < 0 && s.negative, s.width(120)) }]}
/>- StyleX can't write descendant selectors (it can decorate only through an element's own classes), so adjust internal elements not in the slots above (buttons / inputs inside popovers and so on) with the design tokens (
--ssg-*). - StyleX's atomic classes and the grid's base classes have the same specificity (0,1,0). For the same property the one loaded later wins, so load the grid CSS first and StyleX's output CSS after it, or use
style.layer.css(@layer ssg-base). IfuseLayersis enabled on the StyleX side, the unlayered grid CSS always beats what is in layers, sostyle.layer.cssis required.
Using with Astryx
It works as is inside Astryx (Meta's design system, built with StyleX). The grid's CSS isn't in a layer, so it isn't broken by Astryx's reset (@layer reset) or component CSS (@layer astryx-base), and Astryx components placed in cells (Button / Badge and so on returned from renderCell) look the same as outside. To match colors, use themes/astryx.css below.
Design system themes (themes/*.css)
CSS that connects a design system's color variables to the grid's tokens (--ssg-*). Loading one after style.css makes the grid's colors follow that design system's theme (including custom themes) and light / dark switching (no added JS). Also pass light / dark to the grid's theme.
| File | Target (version checked) | Scope | What to pass to theme |
|---|---|---|---|
themes/astryx.css | Astryx (@astryxdesign/core 0.7) | Every grid on a page with <Theme> (decided by data-astryx-theme, which the top-level <Theme> syncs to <html>. Applies to portals too) | useTheme().mode (required. Astryx's colors use light-dark(), and depending on the build, light or dark is chosen on the side of the grid's color-scheme) |
themes/mantine.css | Mantine (@mantine/core 9.7) | Every grid on a page with MantineProvider (decided by data-mantine-color-scheme, which MantineProvider puts on <html>) | useComputedColorScheme('light') |
themes/heroui.css | HeroUI v3 (@heroui/react 3.2) | Every grid on the page that loads it | 'class' (follows the dark class on <html>) |
themes/shadcn.css | shadcn/ui (shadcn 4.22; the color variables for Tailwind CSS v4) | Every grid on the page that loads it | Same as above |
import '@ishibashi0112/spreadsheet-grid/style.css';
import '@ishibashi0112/spreadsheet-grid/themes/astryx.css'; // load after style.css
import { useTheme } from '@astryxdesign/core/theme';
// use inside <Theme theme={...}>
function Grid(props: SpreadsheetGridProps<Row>) {
const { mode } = useTheme(); // 'light' | 'dark' (mode="system" is also the resolved value)
return <SpreadsheetGrid {...props} theme={mode} />;
}- Every theme maps the design system's variables to the same 16 inputs (surfaces / text / borders / accent / danger, success and warning colors and the text color on them / corner radius), and from those decides the grid's tokens with the same mix (how strong row hover is, how the selection is blended and so on). Parts with no matching design system variable, such as tooltips / the ghost while dragging / conditional formatting colors, stay as the preset passed to
theme. - The selectors are
:where(specificity 0). Loaded afterstyle.css, they beat the defaults and the dark preset (loaded before, they don't apply). Your overrides like.ssg-root { --ssg-cell-bg: ... }(CSS not in a layer) beat the theme regardless of load order. Colors such as the selection are decided from the design system's accent, so to change the accent across the board, change it on the design system's side. - When
style.cssis in a layer (layer(components)/style.layer.css), put the theme in the same layer afterstyle.csstoo (e.g.@import '@ishibashi0112/spreadsheet-grid/themes/shadcn.css' layer(components);). Token overrides in a layer lose to a theme that isn't in a layer. - HeroUI's and shadcn/ui's variables have no marker attribute, so those themes apply to every grid on the page that loads them. Loading them on a page without those variables drops the colors. HeroUI v2 (the form that puts HSL components in
--heroui-*) and shadcn/ui's way of writing for Tailwind CSS v3 (values that are HSL components like222.2 84% 4.9%) aren't supported. - shadcn/ui has no success / warning color variables, so the saved mark and the note mark are Tailwind's green-600 / amber-500.
- With Tailwind CSS alone there are no color variables, so write the tokens (
--ssg-*) directly (they can be generated with the theme builder). - When your own StyleX output is in layers (
useLayers) and you want to override the grid's base with those classes, usestyle.layer.css, as in the StyleX note above. - When a design system's variable names change, the themes follow on their side.
Styling state classes (public contract)
Classes returned by cellClassName / getRowClassName can be combined with the internally added classes below in compound selectors (e.g. .ssg-body-cell.my-diff to win over the base, and .ssg-body-cell.my-diff.ssg-body-cell--row-hovered to switch the color on hover). The following are a public contract, and changes to them are treated as breaking.
- The 2 tables below (classes and attributes) and the tokens in the next section (
--ssg-*) are the public scope of the CSS. Removing or renaming a name, or changing the elements or conditions it is added to, is a breaking change (the policy is in the docs: Versions and compatibility). ssg-*classes not in the tables, the nesting of the DOM, and inline styles the grid sets are private implementation details and can change without notice. Don't depend on them in selectors.- Classes / attributes named in the docs must always be in these tables (
packages/react/src/cssContract.test.tschecks this).
Classes
| Class | Applied to / condition |
|---|---|
.ssg-root | The grid's root element (where the className prop goes). |
.ssg-root--fill-height | The root when height is given a value containing % (flex column). |
.ssg-root--refetching | The root while the previous rows are shown during a refetch with serverSideRefetch="keep" (the visible part of the body is then dimmed to the strength of --ssg-refetch-row-opacity). |
.ssg-root--loading | The root while loading (loading) (both with skeleton rows while there are no rows and when the rows are dimmed; since 1.15.0). |
.ssg-root--filling | The root while dragging the fill handle (fillHandle) (fixes the cursor to a crosshair). |
.ssg-theme-dark | On the root and each portal (popover / menu / panel / tooltip) with theme="dark" (or 'auto' resolved to dark). |
.ssg-theme-class | On the root, each portal (popover / menu / panel / tooltip / drag ghost) and GridAskBar with theme="class". With .dark or [data-theme="dark"] on an ancestor, it becomes the dark preset (defined with :where). |
.ssg-motion-off | On the root, each portal, the drag ghost and the tooltip when motion is 'off' (or 'auto' + reduced motion). The motion tokens become 0 (defined with :where). |
.ssg-shell | The element that takes focus (role="group"). |
.ssg-scroll-container | The scroll element of the table body (role="grid"). |
.ssg-bar--top / .ssg-bar--bottom | The default top bar / default bottom bar (not added when renderTopBar / renderBottomBar is given). |
.ssg-filter-chip-bar | The filter chip bar. |
.ssg-empty-state | The empty state with 0 rows. |
.ssg-ssrm-error-bar | The SSRM load error bar. |
.ssg-refetch-bar | The moving line under the column headers while the previous rows are shown with serverSideRefetch="keep" and while loading (loading) with rows (colors --ssg-refetch-bar / --ssg-refetch-bar-track). |
.ssg-scroll-hint | The scroll position indicator (scrollHint). |
.ssg-find-bar | The find bar of find in cells (find). |
.ssg-find-mark / .ssg-find-mark--current | A match / the current match of find in cells (<mark>). |
.ssg-find-scope-overlay | The light tint of the range for "selected range only" in find and replace (find={{ replace: true }}; since 1.12.0). |
.ssg-icon-btn | Icon buttons in the header. |
.ssg-col-hover-overlay | The column band of hoverHighlight="cross". |
.ssg-col-drop-indicator | The vertical line at the insertion point of a column drag. |
.ssg-col-drag-float / .ssg-col-drag-pin | The floating column / the pin and arrow in the header when crossing pinned panes with columnDragMotion="live". |
.ssg-body-row | The row container (one of the places getRowClassName goes). |
.ssg-body-cell | The base of data cells (unlayered, specificity (0,1,0)). |
.ssg-row-header-cell | The row header "#" cells. |
.ssg-body-cell--readonly | Read-only cells (when not in the range selection. Always added, independent of dimReadOnlyCells). |
.ssg-body-cell--invalid | Cells showing a validation mark. |
.ssg-body-cell--has-note | Cells with a cell note (cellNote) (the top-right mark is ::before; color --ssg-note-indicator). |
.ssg-body-cell--changed | Cells whose value changed with highlightChanges (while glowing). |
.ssg-body-cell--unsaved | Unsaved cells in change tracking (trackChanges) (the top-left triangle is the child element .ssg-unsaved-mark; color --ssg-unsaved-indicator). |
.ssg-unsaved-mark | The top-left triangle of unsaved cells (the last child element of .ssg-body-cell--unsaved). |
.ssg-body-row--unsaved | Rows with unsaved cells (the row container per pane). |
.ssg-row-header-cell--unsaved | The row number of rows with unsaved cells (the dot on the left is ::before). |
.ssg-body-row--added | Rows added in the grid with trackChanges={{ rows: true }} (the row container per pane; since 1.10.0). |
.ssg-row-header-cell--added | The row number of the same (the vertical line on the left is ::after; since 1.10.0). |
.ssg-bar-chip--unsaved | 「未保存 2 行・3 セル」 (Unsaved: 2 rows, 3 cells) in the default bottom bar (the dot on the left is ::before). |
.ssg-root--diff | The root while the diff view (trackChanges's baseline) is in effect (unsaved marks and fills use the diff colors; since 1.13.0). |
.ssg-body-row--removed | Removed rows shown in the table with the diff view's showRemoved (the row container per pane; since 1.13.0). |
.ssg-row-header-cell--removed | The row number of the same ("−"; since 1.13.0). |
.ssg-body-row--change-target | A removed row reached with goToNextChange() / goToPrevChange() (removed when the active cell moves; since 1.13.0). |
.ssg-diff-original | The baseline value shown next to changed cells with the diff view's showOriginal (strikethrough; since 1.13.0). |
.ssg-bar-chip--diff | The diff counts in the default bottom bar, 「追加 1 行・削除 2 行・変更 3 セル(2 行)」 (Added 1 row, removed 2 rows, changed 3 cells (2 rows)) (since 1.13.0). |
.ssg-bar-diff-nav-btn | The ▲ ▼ buttons next to it that go around changes (since 1.13.0). |
.ssg-pager | The pager of pagination (pagination) (<nav>). .ssg-pager--bar at the right of the default bottom bar, .ssg-pager--band inside the band below tables without a bottom bar (.ssg-pager-band) (since 1.15.0). |
.ssg-pager-button | The pager's buttons (‹ is .ssg-pager-button--prev, › is .ssg-pager-button--next, numbers are .ssg-pager-button--page, and the current page has [aria-current="page"]). |
.ssg-pager-range / .ssg-pager-size | The pager's row range text / rows-per-page choice (<label>; the <select> inside is .ssg-pager-size-select). |
.ssg-range-decoration | The frame of a range decoration (rangeDecorations) (per pane. The fill is .ssg-range-decoration--fill, the dashed line .ssg-range-decoration--dashed; since 1.13.0). |
.ssg-range-decoration-label | The name tag of a range decoration (since 1.13.0). |
.ssg-body-cell--cf-bar | Cells with a conditional formatting data bar (the bar is the child element .ssg-cf-bar; negative values .ssg-cf-bar--negative). |
.ssg-body-cell--cf-scale | Cells whose background is tinted by a conditional formatting color scale. |
.ssg-multi-select-chips / .ssg-multi-select-chip | The row of chips / a single chip in cells of multiple-selection columns (the select editor's multiple) (chips inside the editor also get .ssg-multi-select-chip; since 1.11.0). |
.ssg-chip | Status chips of conditional formatting (tones .ssg-chip--neutral / .ssg-chip--info / .ssg-chip--good / .ssg-chip--warning / .ssg-chip--critical, any color .ssg-chip--custom; contents .ssg-chip-icon / .ssg-chip-label). |
.ssg-body-cell--row-hovered | Cells of the hovered row (when enableRowHover is on). |
.ssg-body-cell--autoheight | Cells of auto-height columns (the box is the row height. The content goes in the child element .ssg-autoheight-content, whose height is measured for the row height). |
.ssg-body-cell--valign-top | Cells whose content is aligned to the top in rows stretched by auto-height (verticalAlign; the default for autoHeight columns). |
.ssg-body-cell--align-center / .ssg-body-cell--align-right | Horizontal alignment from column.align. |
.ssg-header-cell--align-center / .ssg-header-cell--align-right | Horizontal alignment of column headers (column.headerAlign; column.align if not written). Right alignment mirrors the order (the state and hover controls go on the left). |
.ssg-body-cell--row-drag-handle | Cells of the handle column for row dragging (enableRowDrag). |
.ssg-row-drag-handle / .ssg-row-drag-handle--disabled | The row drag handle / when it can't be used (while sorted / filtered). |
.ssg-row-drop-indicator | The line at the insertion point of a row drag. |
.ssg-row-checkbox | Checkboxes of row selection / checkbox columns. |
.ssg-cell-editor | The frame of cell editors. |
.ssg-copy-range-overlay | The marching dotted line of the copied range (showCopyRange). |
.ssg-save-indicator | The save status mark of SSRM write-back (the state is the cell's data-ssg-save). |
.ssg-detail-card | The card of expandable rows (detailRow). |
.ssg-label-row-content | The content container of label rows (labelRow) (the row is .ssg-body-row[data-ssg-label-row]). |
.ssg-tree-cell | Cells of the tree column of tree data (treeData) (indented for the depth, holding the open / close mark .ssg-tree-toggle; since 1.9.0). |
.ssg-tree-toggle | The open / close mark of tree data (a button on rows with visible children; aria-expanded="true" when open). |
.ssg-body-row--tree-unmatched | Parent rows that don't match the tree data filter (the parents up to matching rows; text --ssg-tree-unmatched-text). |
.ssg-body-cell--tree-aggregate | Aggregate cells on tree data rows with children (columns with an aggregate = aggFunc. The value is the aggregate of the rows below and can't be edited. A marker that doesn't change the look). |
.ssg-body-row--new | The row element of the entry row (newRow) (.ssg-body-row; the state is the attribute data-ssg-new-row. Its cells have a background lightly mixed with the accent color; since 1.10.0). |
.ssg-row-header-cell--new | The row number of the entry row (「*」 when empty, 「✎」 for a draft; the mark is in the accent color; since 1.10.0). |
.ssg-new-row-placeholder | The text in cells of an empty entry row (「ここに入力して行を追加」 (Type here to add a row); color --ssg-readonly-text; since 1.10.0). |
.ssg-total-row / .ssg-total-cell | The row / cells of the total row (totalRow) (cells also get .ssg-body-cell. The kind heading is .ssg-total-caption, and its text .ssg-total-label). |
.ssg-pinned-rows / .ssg-pinned-row / .ssg-pinned-cell | The top and bottom containers of pinned rows (pinnedTopRows / pinnedBottomRows) (.ssg-pinned-rows--top / .ssg-pinned-rows--bottom) / rows / cells (cells also get .ssg-body-cell). |
.ssg-col-group-cell | Header cells of column groups (columnGroups) (also get .ssg-header-cell; the group's key is the attribute data-ssg-col-group). Closed groups get .ssg-col-group-cell--closed, and name alignment (headerAlign) .ssg-col-group-cell--align-center / .ssg-col-group-cell--align-right (since 1.6.0). |
.ssg-fill-handle / .ssg-fill-preview / .ssg-fill-options / .ssg-fill-menu / .ssg-fill-tooltip | The fill handle (fillHandle) handle / dotted line while dragging / button after filling / menu / value tooltip. |
.ssg-menu-panel / .ssg-menu-item | The panel / items of the column menu / context menu / fill handle menu. |
.ssg-tooltip | The custom tooltip (a singleton outside the table; popupContainer). |
.ssg-ask | The root of GridAskBar (the /ai entry). Inside are .ssg-ask-form (the input row) / .ssg-ask-input (the input) / .ssg-ask-examples (example sentences) / .ssg-ask-chips / .ssg-ask-chip (chips of applied conditions) / .ssg-ask-note (notes and errors). |
Attributes
| Attribute | Element / meaning |
|---|---|
[data-grid-drag-ghost] | The ghost of column / row drags (outside the table; popupContainer; classNames.dragGhost). |
[data-ssg-col-dragging="live"] | Cells of the column being held with columnDragMotion="live". |
[data-ssg-row-dragging] | The row being dragged (.ssg-body-row). |
[data-ssg-label-row] | The row element of label rows (.ssg-body-row). |
[data-ssg-new-row="empty" | "draft"] | The row element of the entry row (newRow) (.ssg-body-row--new). No values written / a draft (since 1.10.0). |
[data-ssg-tree-level] | Row elements of tree data (treeData) (.ssg-body-row). The value is the depth (top = 0; since 1.9.0). |
[data-ssg-pinned="top" | "bottom"] | Row elements of pinned rows (.ssg-pinned-row). Top / bottom. |
[data-ssg-col-group] | Header cells of column groups (.ssg-col-group-cell). The value is the group's key (since 1.6.0). |
[data-ssg-range-decoration] | The frame of a range decoration (.ssg-range-decoration). The value is the decoration's id (since 1.13.0). |
[data-pane="left" | "center" | "right"] | The pane a row (.ssg-body-row) or header row belongs to (left pinned / center / right pinned). Rows are drawn in the left and right pinned panes too, and the row number "#" is in the rows of the left pane (since 0.63.0, even in tables without left-pinned columns). To count rows in tests, use [data-pane="center"].ssg-body-row. |
[data-ssg-save="pending" | "ok" | "failed"] | Cells being saved / saved / not saved in SSRM write-back. |
[data-ssg-detail] | The card of expandable rows (.ssg-detail-card). Keyboard / clipboard / context menu / drag-start events inside it don't reach the grid. |
input[data-ssg-ime-input] | The input receiver of imeDirectInput (where focus goes while it is on). |
[data-ssg-tooltip-overflow] | Cells that show their full text when truncated, with showCellOverflowTooltip. |
data-ssg-tooltip="text" | Put on your own elements to show the text in the grid's tooltip (see "Tooltips"). |
data-ssg-filter-keep-open | Put on your own element (or an ancestor) so pointerdown inside it doesn't close the column filter popover. |
CSS tokens (--ssg-*) (public contract)
The main way to change the look. style.css defines them with :where (specificity 0) on .ssg-root, each portal (popover / menu / drag ghost / tooltip) and GridAskBar's .ssg-ask, so your overrides beat the defaults, the dark preset (.ssg-theme-dark) and themes/*.css regardless of load order.
Parts shown outside the table (directly under document.body by default, or inside a dialog that surrounds the grid if any; popupContainer) (column menu / column filter / context menu / select editor options / tool panel / fill handle menu and value tooltip / tooltips / drag ghost) aren't inside the table, so tokens written on the table or its ancestors don't reach them by inheritance. When the grid shows a part, it copies the token values resolved on the table's root inline onto that part's root.
-
.ssg-root { … }/ classes fromclassName/ ancestor selectors like.card .ssg-root { … }/ values using ancestors' variables (--ssg-panel-bg: var(--card-head)) also show in the parts with the same values. -
Values decided on the part's side aren't copied (the style of
classNames.popover/classNames.tooltip/classNames.dragGhost, and rules applied only to the parts like.ssg-menu-panel { … }/.ssg-tooltip { … }, work as they are). However, if the value of CSS applied only to a part is the same as the default, it can't be told apart and the table's value is copied (to keep a part at the default color, write it in the style ofclassNames.popoverand so on; the style stays even when equal to the default). -
Density dimensions (
--ssg-cell-pad-x/--ssg-bar-pad-x/--ssg-bar-pad-y/--ssg-icon-btn-size) aren't copied (parts aren't affected bydensity; values written on the table aren't copied either). -
Copying happens when a part is shown (when a menu or panel opens, a tooltip appears, or a drag starts) and when
theme/motionchange. While a menu or panel is open, it copies again when attributes of<html>/<body>(dark mode classes and so on), the class / style of the table's root, or the OS color scheme (prefers-color-scheme) change. When you swap your CSS in other ways, it catches up the next time a part is shown. -
The workarounds suggested in earlier versions (passing the same class to
classNames'popover/tooltip/dragGhosttoo, writing on:root) still work as they are (the part's values equal the table's, so nothing is copied). -
The names in the table below are the public contract; removing, renaming or changing their meaning is a breaking change. Default values (colors, dimensions) may be adjusted in a minor (written in the CHANGELOG).
-
--ssg-*not in the table (variables used internally per element, and the relay--ssg-ds-*inthemes/*.css) are internal. -
Among the default colors, the panel's secondary text (
--ssg-panel-text-faint/--ssg-panel-text-muted) doesn't reach WCAG AA's 4.5:1. To meet the standard, override with--ssg-panel-text-muted: #475569/--ssg-panel-text-faint: #64748bin light and--ssg-panel-text-faint: #909296in dark (.ssg-theme-dark) (the default colors aren't changed because it would change the look). Since 1.3.0, the text of conditional formatting chips (--ssg-cf-*) has a contrast of 5:1 or more against the background in all 5 colors (--ssg-cf-good/--ssg-cf-warning/--ssg-cf-criticalup to 1.2 were#15803d/#b45309/#dc2626). -
When adding tokens to
style.css, add them to this table too (packages/react/src/cssContract.test.tschecks this).
| Part | Tokens |
|---|---|
| Base colors | --ssg-accent / --ssg-accent-strong (accent), --ssg-line / --ssg-line-strong / --ssg-divider (rules and dividers), --ssg-glyph / --ssg-glyph-hover / --ssg-glyph-faint (icons), --ssg-danger / --ssg-danger-bg (actions such as delete) |
| Body cells | --ssg-cell-bg / --ssg-cell-text, --ssg-readonly-bg / --ssg-readonly-text / --ssg-readonly-hover-bg (read-only), --ssg-row-hover-bg (row hover), --ssg-row-selected-bg (row selection), --ssg-selection-fill (range selection fill), --ssg-col-hover-bg (the column band of hoverHighlight="cross") |
| Header | --ssg-header-bg / --ssg-header-text / --ssg-header-hover-bg, --ssg-select-bg / --ssg-select-bg-hover (headers inside the selection), --ssg-icon-hover-bg / --ssg-icon-active-bg / --ssg-icon-active-bg-hover / --ssg-icon-active-border (icon buttons) |
| Row kinds | --ssg-group-row-bg / --ssg-group-row-hover-bg (group rows), --ssg-label-row-bg / --ssg-label-row-text / --ssg-label-row-accent (label rows), --ssg-total-row-bg / --ssg-total-row-text / --ssg-total-row-border (the total row), --ssg-pinned-row-bg / --ssg-pinned-row-border (pinned rows' background / the line between them and the body) |
| Checkboxes | --ssg-checkbox-border / --ssg-checkbox-bg / --ssg-checkbox-checked-bg / --ssg-checkbox-checked-mark / --ssg-checkbox-hover-border |
| Dimensions | --ssg-radius, --ssg-tree-indent (the indent per depth level of tree data; default 16px), --ssg-icon-btn-size / --ssg-cell-pad-x / --ssg-bar-pad-x / --ssg-bar-pad-y (switched by density) |
| Panels (popover / menu / tool panel) | --ssg-panel-bg / --ssg-panel-border / --ssg-panel-separator, --ssg-panel-text-strong / --ssg-panel-text / --ssg-panel-text-sub / --ssg-panel-text-muted / --ssg-panel-text-faint / --ssg-panel-text-disabled (text, strongest first), --ssg-panel-hover-bg / --ssg-panel-hover-bg-subtle, --ssg-panel-accent / --ssg-panel-accent-bg / --ssg-panel-accent-text / --ssg-panel-accent-contrast, --ssg-seg-track-bg / --ssg-seg-indicator-bg / --ssg-seg-indicator-shadow (the tool panel's tab switcher) |
| Shadows and pinned panes | --ssg-root-shadow / --ssg-panel-shadow / --ssg-popover-shadow / --ssg-overlay-chip-shadow, --ssg-pane-border / --ssg-pane-shadow-left / --ssg-pane-shadow-right (the edge of pinned column panes) |
| Dark chips and dragging | --ssg-pill-bg / --ssg-pill-text / --ssg-pill-shadow (the display while measuring column widths / the scroll position bubble / the SSRM error bar and so on), --ssg-ghost-bg / --ssg-ghost-text / --ssg-ghost-border / --ssg-ghost-shadow (the drag ghost), --ssg-tooltip-bg / --ssg-tooltip-text / --ssg-tooltip-shadow (tooltips), --ssg-drop-indicator (the line at a drag's insertion point) |
| Input checks and notes | --ssg-invalid / --ssg-invalid-bg / --ssg-invalid-contrast (the error color / cell background / bubble text), --ssg-note-indicator (the note mark), --ssg-unsaved-indicator (the unsaved mark of change tracking), --ssg-tree-unmatched-text (text of parents that don't match the tree data filter) |
| Multiple selection | --ssg-multi-select-chip-bg / --ssg-multi-select-chip-text (the background / text of chips in cells and the editor of multiple-selection columns) |
| Save marks (SSRM write-back) | --ssg-save-pending / --ssg-save-ok / --ssg-save-ok-contrast / --ssg-save-failed |
| Find and the fill handle | --ssg-find-mark-bg / --ssg-find-mark-current-bg, --ssg-fill-line / --ssg-fill-handle-ring |
| Diff view and range decorations | --ssg-diff-added / --ssg-diff-removed / --ssg-diff-changed (the colors of added rows / removed rows / changed cells in the diff view; fills mix these lightly), --ssg-range-decoration / --ssg-range-decoration-contrast (the default color of range decorations / the name tag text; since 1.13.0) |
| Conditional formatting | --ssg-cf-bar / --ssg-cf-bar-negative (data bars), --ssg-cf-seq-min / --ssg-cf-seq-max / --ssg-cf-div-negative / --ssg-cf-div-mid / --ssg-cf-div-positive (color scales), --ssg-cf-neutral / --ssg-cf-neutral-bg / --ssg-cf-info / --ssg-cf-info-bg / --ssg-cf-good / --ssg-cf-good-bg / --ssg-cf-warning / --ssg-cf-warning-bg / --ssg-cf-critical / --ssg-cf-critical-bg (chips) |
| Loading and scroll position | --ssg-skeleton-bar / --ssg-skeleton-bar-hi (SSRM skeletons), --ssg-refetch-row-opacity / --ssg-refetch-bar / --ssg-refetch-bar-track (the strength of the previous rows / the moving line / the line's track with serverSideRefetch="keep" and while loading (loading)), --ssg-scrollhint-track-bg / --ssg-scrollhint-thumb / --ssg-scrollhint-thumb-active (scrollHint) |
| Motion | --ssg-motion-fast / --ssg-motion-base / --ssg-motion-slow / --ssg-motion-ease |
Helper types (shapes referenced by props)
GridRowKey = string | numberGridColumnPinned = 'left' | 'right'GridSelectFilterOption = { label: string; value: string }GridSelectEditorOption = GridSelectFilterOption & { description?: string; searchText?: string; data?: unknown }(options of the select editor.descriptionis a note shown faintly on the right in the list (only in the searchable select editor's list; not shown in the list of selects withoutsearch),searchTextis text used only for searching, anddatais any value you like forfillRow. All since 1.7.0)GridFindOpenOptions = { query?: string; replace?: boolean }(options of the handle'sopenFind) /GridFindReplaceResult = { replaced: number; skipped: number }(the result ofreplaceNext/replaceAll; both are numbers of matches). Both since 1.12.0 (see "Find and replace (find.replace)")GridNewRowOptions<T> = { placeholder?: string | ((column: GridColumn<T>) => string | null | undefined) }(options of the entry rownewRow; since 1.10.0. See "Entry row (newRow)")GridTrackChangesOptions = { rows?: boolean }(the object form oftrackChanges;rows: truealso tracks adding and removing rows; since 1.10.0),GridAddedRow<T> = { rowKey, row }/GridRemovedRow<T> = { rowKey, row }(one row ofgetChanges()'sadded/removed. See "Tracking added and removed rows (trackChanges={{ rows: true }})")GridSelectLoadOptionsParams<T> = { query, row, rowKey, column, signal }(the argument of the select editor'sloadOptions) /GridSelectFillRowContext<T> = { row, rowKey }(the second argument offillRow). Both since 1.7.0. Exported from the barrel (see "Searchable select editor (search/loadOptions/fillRow)")CellRenderContext<T> = { row, rowIndex, sourceRowIndex, rowKey, colIndex, value, column, isActive, isSelected, isEditing, readOnly, setValue, detail?, pinned?, tree? }pinned?: GridPinnedRowPosition('top' | 'bottom') is present only for cells of pinned rows (pinnedTopRows/pinnedBottomRows) (see "Pinned rows (pinnedTopRows/pinnedBottomRows)").tree?: CellTreeContext = { level, hasChildren, open, aggregate, setOpen }is present only on tree data (treeData) rows (depth, whether it has visible children, whether it is open, whether it is an aggregate cell of a row with children, open / close; since 1.9.0. See "Tree data (treeData)"). In cells of aggregated columns (aggFunc) on rows with children,valueis the aggregate.setValuewrites without looking atreadOnly/canEditCell(it does go through thevalidatecheck). To disable it while read-only, checkreadOnlyand branch. Undo is off duringreadOnly, so this write can't be undone.detail?: CellDetailContext = { expanded, expandable, toggle, setExpanded }is defined only when thedetailRowprop is on (see "Expandable rows (master/detail) (detailRow)").
DetailRowOptions<T>/DetailRowRenderContext<T> = { row, rowKey, rowIndex, sourceRowIndex, collapse }/CellDetailContext(expandable rows; exported from the barrel)LabelRowOptions<T>/LabelRowRenderContext<T> = { row, rowKey, rowIndex, sourceRowIndex, label, sectionRowCount }/GridLabelRow<T> = { kind: 'label', row, sourceIndex, label, sectionRowCount }/LabelRowSortMode = 'section' | 'follow' | 'hide'(label rows; exported from the barrel. See "Label rows (headings / separators) (labelRow)")FillHandleOptions<T> = { getFillValue? }/GridFillValueParams<T> = { column, row, rowIndex, sourceValues, index, direction, kind, defaultValue }/GridFillDirection = 'down' | 'up' | 'right' | 'left'/GridFillKind = 'series' | 'copy'(the fill handle; exported from the barrel. See "Fill handle (fillHandle)")RowDragContext = { rowKey, sourceRowIndex }(the second argument ofisRowDraggable) /RowMoveParams<T> = { rowKey, fromIndex, toIndex, rows }(the argument ofonRowMove) /RowDropParams<T> = { row, rowKey, fromIndex, toIndex, rowAbove, rowBelow, rows }(the argument ofcanDropRow; since 1.2.0. All exported from the barrel)GridCellRef<T> = { row, rowKey, rowIndex, sourceRowIndex, column, columnKey, colIndex, value }(the argument ofonActiveCellChange) /GridCellEventParams<T> = GridCellRef<T> & { event: MouseEvent }(the argument ofonCellClick;eventis the DOM standardMouseEvent) /GridCellDoubleClickParams<T> = GridCellEventParams<T> & { preventDefault(): void }(the argument ofonCellDoubleClick; for a touch double tap,eventis thePointerEventof the release). All exported from the barrel. Indexes follow the same basis asCellStyleContext(see "Cell event callbacks (onCellClick/onCellDoubleClick/onActiveCellChange)").CellStyleContext<T>= the read-only version of the above withoutsetValue(passed to thecellClassNamefunction). There is nodetail, andtreeisCellTreeState = { level, hasChildren, open, aggregate }withoutsetOpen(since 1.9.0). Exported from the barrel (index.ts) (import type { CellStyleContext } from '@ishibashi0112/spreadsheet-grid')rowIndexis the view row index (the display position after sort / filter),sourceRowIndexis the index in the originalrows, androwKeyis the row key (fromrowKeyGetter; the source index by default). To match source-based data such as "the set of error row indexes" on a screen with sort / filter on, usesourceRowIndex/rowKey(the same basis as thesourceRowIndex/rowKeyreturned bygetInvalidCells()). In serverSide the view order is canonical, sosourceRowIndexequals the view index.
CanEditCellContext = { sourceRowIndex, rowKey }(the fifth argument ofcanEditCell. The same basis asCellStyleContext. Exported from the barrel)RowStyleContext<T> = { row, rowIndex, sourceRowIndex, rowKey, isSelected, pinned? }(the third argument ofgetRowClassName;pinnedonly for pinned rows. Exported from the barrel)GridPinnedRowPosition = 'top' | 'bottom'(the position of pinned rows; exported from the barrel)GridSlotProps = string | { className?: string; style?: CSSProperties }(the value ofclassNames.*/cellClassName/getRowClassName/detailRow.className. Exported from the barrel along withGridClassNames)GridFrameworkTypes = { node: unknown; style: object }/ReactGridTypes = { node: ReactNode; style: CSSProperties }(exported from the barrel). The public types themselves live in the React-independent core (taking the types of render nodes / styles through the bundled typeF), andGridColumn<T>and the others users normally use are aliases of the core fixed withReactGridTypes. The number and names of type parameters are as before, so you normally don't need to think about it.- The basis of
rowIndex/sourceRowIndex/rowKeyis the same asCellStyleContext.isSelectedis the selection state of checkbox row selection (enableRowSelection) (separate from range selection). Group rows (when grouping is on) are drawn specially, so they aren't covered bygetRowClassName.
- The basis of
GridScrollPosition = { top: number; left: number }(the return value ofgetScrollPosition/ the basis ofsetScrollPosition)GridScrollEventParams = { top: number; left: number; source: 'user' | 'api'; atBottom?: boolean }(the argument ofonScroll. For the meaning ofsource, see theonScrollrow of the props table.atBottomis whether it is at the end = the grid always sets it; since 1.2.0)HeaderRenderContext<T> = { colIndex, width, column, filterValue?, isFiltered? }SpreadsheetGridSlotContext<T> = { rows, filteredRows, columns, visibleColumns, globalFilterText, columnFilterValues, sortState, setGlobalFilterText, activeCell, selection, derivedSummary, globalFilterStatus, globalFilterProgress, selectionAggregates, unsavedChanges, pagination, loading }derivedSummaryisSpreadsheetGridDerivedSummary(containing summary strings for rows / columns / filters / sort, selection stats and so on). Usable in the top / bottom bars without importing helpers.- Note for development builds: passing
ctxorrows/filteredRowsstraight to child components' props (<MyBar ctx={ctx} />/<MyBar {...ctx} />/<MyBar rows={ctx.filteredRows} />) makes development builds of React 19.2 and later diff the props for the Performance Track, walking the large arrays, and at the scale of a million rows one sort can take tens of seconds. Pass children only the values they use (ctx.filteredRows.lengthorderivedSummaryfor counts). Production builds aren't affected. The built-in top / bottom bars also receive only the values they need. globalFilterStatus: GlobalFilterStatus('idle' | 'filtering' | 'ready') /globalFilterProgress: number(0..1). When the number of rows is large (threshold 50,000 rows; the condition isrows.length > 50000), the global text filter applies the input split over time without blocking the main thread. While applying,status='filtering'andprogressis the progress (0..1). Empty / off is'idle', and settled is'ready'(progress=1). At 50,000 rows or fewer it applies synchronously, so it is'ready'right away (without going through'filtering'). The loading display is done by a built-in overlay the grid lays over the body (the same approach as the autosize measuring overlay), so the top bar or custom UI usually doesn't need to handle it. These 2 values are exposed for reference when you want custom UI such as disabling inputs or your own indicator. In serverSide it is basically'idle'/'ready'(row skeletons handle the loading display).selectionAggregates?: GridSelectionAggregates | null(the grid always sets it). The aggregates of the selection when 2 or more cells are selected,{ status: 'computing' | 'ready'; progress; cellCount; count; numericCount; sum; average; min; max; partial }(count= the number of non-empty cells,numericCount= the number of cells counted as numbers; with no numbers,sum/average/min/maxareundefined;partial= unloaded rows were skipped in SSRM).nullfor selections of 1 cell or fewer /showSelectionAggregates={false}/ when there is nowhere to show it (the bottom bar is hidden and there is norenderTopBar). Selections scanning more than 50,000 cells are computed split over time, withstatus: 'computing'meanwhile (values not settled;progressis 0..1 in 5% steps). When only the values change with the same selection, the previous result (status: 'ready') stays while recomputing and is replaced when done. The default bottom bar shows average / count / sum (min / max can be read only from this value).unsavedChanges?: GridChangesSummary | null(the grid always sets it; since 1.8.0). The numbers of unsaved rows and cells in change tracking (trackChanges),{ rowCount, cellCount }(withtrackChanges={{ rows: true }}, alsoaddedCount/removedCount; since 1.10.0).nullwhentrackChangesisn't in effect.pagination?: GridPaginationContext | null(the grid always sets it; since 1.15.0). The current page and its operations with pagination (pagination) (GridPageInfopluspageSizeOptions/setPage/setPageSize).nullwhen pagination isn't in effect. Tables that replace the bottom bar withrenderBottomBardon't get a pager from the grid, so draw one with this ("Pagination (pagination)").loading?: boolean(the grid always sets it; since 1.15.0). The value of theloadingprop.
GridPaginationOptions = { pageSize?: number; pageSizeOptions?: readonly number[] | false; autoPageSize?: boolean }(the object form ofpagination) /GridPageInfo = { page, pageCount, pageSize, rowCount, firstRow }(the argument ofonPageChangeand the value ofgetPageInfo()) /GridPaginationContext = GridPageInfo & { pageSizeOptions, setPage, setPageSize }(ctx.paginationofrenderBottomBar). All since 1.15.0, exported from the barrel.