Cheatsheets and messages
Hooks A to Z
Find a gridcn hook by name, see what it returns or does, and open the page that explains it.
Each table lists the hooks of one source. Every row links to the page that explains the hook.
Store hooks
Call these hooks inside a DataGridProvider. useDataGridStoreProps runs outside it and creates the store. createDataGridSelector builds such a hook. Import them from @/components/data-grid/data-grid.
| Hook | Purpose | Page |
|---|---|---|
createDataGridHooks | Returns useDataGridApi, useDataGridRow, the column hooks, and useDataGridSelector typed for one row type. | Store hooks |
createDataGridSelector | Builds a typed hook that reads any slice of the store. | Store hooks |
useDataGridActions | Returns the stable actions object. | Store hooks |
useDataGridActiveCell | Returns the active cell as a ViewCoord. | Store hooks |
useDataGridActiveColumn | Returns the view column of the active cell. | Store hooks |
useDataGridAllColumns | Returns every column, hidden ones included. | Store hooks |
useDataGridApi | Returns the imperative handle. | Store hooks |
useDataGridCellEditingError | Returns the live validation error of the cell in edit. | Store hooks |
useDataGridCellErrors | Returns the map of server errors. | Store hooks |
useDataGridCellState | Returns the state of one cell. | Store hooks |
useDataGridCellTypes | Returns the resolved cell type registry. | Store hooks |
useDataGridClipboard | Returns copy, cut, and pasteFromClipboard. | Store hooks |
useDataGridColumnWidth | Returns the width override of a column. | Store hooks |
useDataGridColumnWidths | Returns the width overrides of a list of columns. | Store hooks |
useDataGridEditing | Returns the edit in progress. | Store hooks |
useDataGridFilterState | Returns the filter tree. | Store hooks |
useDataGridGatePending | Returns the set of gate names whose promise has not settled. | Gate cancellation and timeouts |
useDataGridGetSelectionValues | Returns a callback that reads the values of the main range. | Store hooks |
useDataGridKeymap | Returns the effective keymap without bindings that never match. | Store hooks |
useDataGridLabels | Returns the merged labels. | Store hooks |
useDataGridLiveAnnouncement | Returns the current live region announcement, or null. | Live region messages |
useDataGridPendingSaveCount | Returns the count of pending saves. | Store hooks |
useDataGridReadOnly | Returns the readOnly flag. | Store hooks |
useDataGridRow | Returns the row at a view index. | Store hooks |
useDataGridRowCellState | Returns the state of the cells of one row. | Store hooks |
useDataGridRowId | Returns the row id at a view index. | Store hooks |
useDataGridRowIds | Returns the row ids for a list of view indexes. | Store hooks |
useDataGridRowIdToViewRow | Returns a map from row id to view index. | Store hooks |
useDataGridRowSaveStatus | Returns the save status of a row. | Store hooks |
useDataGridScrollToCell | Returns a function that scrolls to a CellRef. | Store hooks |
useDataGridScrollToCellAt | Returns a function that scrolls to a ViewCoord. | Store hooks |
useDataGridSearchText | Returns the quick-search text. | Store hooks |
useDataGridSelectedRows | Returns the checked rows for a bulk action. | Store hooks |
useDataGridSelection | Returns the selection in view indexes. | Store hooks |
useDataGridSortState | Returns the active sorts. | Store hooks |
useDataGridStoreProps | Creates the store outside the provider. | Store hooks |
useDataGridViewIndex | Returns the view index array. | Store hooks |
useDataGridViewStale | Returns whether rows keep an old view index. | Store hooks |
useDataGridVisibleColumns | Returns the visible columns. | Store hooks |
useShortcutLabel | Returns the key labels of a binding: word names during server rendering, glyphs on macOS after hydration. | Shortcut remapping |
SDK exports
Import them from @/components/data-grid/data-grid-sdk.
| Export | Purpose | Page |
|---|---|---|
sortCollator | Returns the collator of locale, or of the sortLocale in scope when locale is omitted, or the "en-US" collator outside a scope. A custom text compare calls it synchronously. | CellType contract |
useDataGridStoreApi | Returns the read-only store view for exportGrid and the import helpers. | Export options |
useOptionalDataGridLabels | Returns the labels of the enclosing DataGridProvider, or null outside one. | Store hooks |
withSortLocale | Runs a synchronous function with a sortLocale in scope. A function that returns a promise leaves the scope at its first await, with one development warning. Wrap a sort or text compare that runs outside the view build. | Sorting |
Cell editor hooks
| Hook | Purpose | Page |
|---|---|---|
useCellEditor | Gives a text editor its draft state and key bindings. | CellType contract |
useCommitGuard | Guards a one-shot commit against Enter then blur. | CellType contract |
useSeedFocus | Focuses an editor input with the caret at the end. | CellType contract |
Add-on hooks and factories
Import an add-on hook from the barrel of its item, such as @/components/data-grid-history/data-grid-history. The Source column names the item.
| Hook | Source | Purpose | Page |
|---|---|---|---|
aggregateRow | data-grid-pinned-rows | Declares a totals row for useDataGridPinnedRows. | Pinned rows options |
serverAggregateRow | data-grid-pinned-rows | Declares a totals row that your server computes. | Pinned rows options |
useDataGridAggregate | data-grid-pinned-rows | Reads an aggregate inside the provider. | Pinned rows options |
useDataGridComments | data-grid-comments | Adds comments to cells, with a marker and a popover. | Add comments to cells |
useDataGridExport | data-grid-io | Exports the grid to a file. | Export options |
useDataGridFill | data-grid-fill | Mounts the fill handle plugin. | Fill handle |
useDataGridFindReplace | data-grid-find-replace | Mounts find and replace. | Find and replace |
useDataGridHistory | data-grid-history | Mounts undo and redo on a state you own. | Undo and redo |
useDataGridImportPreview | data-grid-io | Parses a file into a preview. | Import options |
useDataGridKeybindings | data-grid-keybindings | Mounts the dialog that lists the effective keymap. | Shortcut remapping |
useDataGridPager | data-grid-pagination | Returns the pager of the provider. | Client pagination |
useDataGridPagination | data-grid-pagination | Returns pageData and the pager for a list outside the grid. | Client pagination |
useDataGridPinnedRows | data-grid-pinned-rows | Mounts pinned rows. | Pinned rows |
useDataGridPresence | data-grid-presence | Shows the cells that other users select. | Show presence |
useDataGridPresenceHighlights | data-grid-presence | Returns the current highlights from the storeApi of useDataGridPresence. | Presence options |
useDataGridPrint | data-grid-io | Prints the grid. | Export options |
useDataGridRowOps | data-grid-context-menu | Returns canCreateRow and canDuplicateRow. | Context menu options |
useDataGridSelectionStats | data-grid-status-bar | Returns statistics of the selection. | Status bar |
useDataGridServerAggregate | data-grid-pinned-rows | Returns the totals of a server result. | Show totals from a server |
useDataGridServerPager | data-grid-pagination | Builds the pager for rows you fetch yourself. | Load rows by page |
useDataGridServerRows | data-grid-server | Fetches rows from your backend. | Server rows options |
useDataGridState | data-grid-history | Holds the data and the history together. | Undo and redo |
useDataGridUrlPagination | data-grid-url-state | Keeps page and pageSize in the URL. | Keep pages in URL |
useDataGridUrlState | data-grid-url-state | Keeps the sort, filter, and search in the URL. | URL state |
useDataGridViews | data-grid-views | Saves, applies, and manages named views. | Saved views |
useStashedPager | data-grid-pagination | Returns the pager that a server hook stashed on the grid. | Find and replace options |
Utility hooks
| Hook | Purpose | Page |
|---|---|---|
useDebounce | Delays a value until it stops changing. | useDebounce |
useDebouncedInput | Debounces the commit of a text input. | useDebouncedInput |