The Keyboard shortcuts panel lets the user change the keys of the grid's built-in commands. It opens from File › Options in the ribbon, from Shortcuts in the compact ribbon's tab row, or from your own menu. Excel's keys stay the defaults: a user who changes nothing gets exactly the keys on Selection and keyboard.
Shortcuts are a user preference, not part of the workbook. The grid applies each change at once and emits key-bindings-change; you store the bindings and pass them back through config.keyboard.bindings.
bindings holds only the commands whose keys differ from Excel's defaults, so it is {} after Reset all. Its shape is the one config.keyboard.bindings takes, and the grid checks it for conflicts as it does any host binding.
What the user can do
In the panel
What happens
Type in the search box
The list shows the commands whose name, group or keys match: fill, or ctrl+shift+l.
Press keys in the search box
The list shows the command those keys run. Ctrl+A, C, V, X, Z and Y and the arrows still edit the search text.
Show changed only
The list shows only the commands with keys other than Excel's.
Click a key, or +
Recording starts and is announced. The next keys pressed become the command's keys. Escape stops recording.
× beside a key
The command loses those keys.
Reset
The command gets Excel's keys back. Reset all does it for every command.
Undo
Restores the keys from before the last change.
Export / Import…
Saves the bindings as a JSON file, or loads one. An import is one change.
Each column has a job:
Command: the name the ribbon uses, grouped as in the ribbon.
Keys: what the command runs on now, shown as Ctrl, Shift and Alt, or as ⌘ ⇧ ⌥ ⌃ on a Mac.
Excel default: the keys Excel uses, so the user always sees what they moved away from.
Keys are saved as Mod+… when the user holds Ctrl, or ⌘ on a Mac, so one binding works on both.
Proposals beyond Excel
Excel has no general shortcut editor. Each of these sits on top of Excel's keys and changes nothing for a user who doesn't use it:
Press keys to search: answers "what does Ctrl+Shift+L do?" with one key press, without knowing the command's name.
Excel's default beside each binding: the user can always see what they changed, and Reset is one click away.
Undo after every change: a wrong key press costs nothing, so trying keys out is safe.
Show changed only: reviewing a setup, or sharing it, means reading a short list instead of every command.
Export and import: the user's keys move between machines, and a team can share one setup.
When the keys are taken
If the new keys already belong to another command, the panel names it, for example "Ctrl+I is assigned to Italic.", and offers three choices:
Swap: the other command takes the keys you replaced. This is offered when you changed a key, not when you added one.
Replace: the other command loses the keys.
Cancel: nothing changes.
Each choice is one change and one key-bindings-change event.
The panel refuses keys it can't use, and says why:
Keys without Ctrl, ⌘ or Alt type into the cell. Only function keys, Delete and Insert can stand alone.
Keys that move or edit in the sheet, such as arrows, Enter, Tab, Space, Page Up and F2, keep their Excel meaning.
F6 and Shift + F6 move the focus to the next or previous part of the window and out of the grid, as in Excel, so they stay free. The panel's hint says so.
Keys the browser or the operating system keeps never reach the page.
The keys the browser or the operating system keeps:
Chromium passes its reserved keys to the page in full screen and in installed-app windows, but the panel still refuses them, because they don't work in an ordinary tab. Safari publishes no list of reserved keys, so in Safari the panel refuses only the macOS keys.
Excel's own defaults stay, even where they never arrive. On a Mac, ⌘⇧3 takes a screenshot, so the Date row says so and the user can choose other keys.
Lock commands
Pass locked to show some commands read-only. A swap or a replace never changes a locked command either; the panel then offers only Cancel.
If config.keyboard is false or a function, your app handles the keys itself, and the panel shows every command read-only.
Open it from your own menu
grid.openKeyboardSettings() opens the panel when keyboardSettings is set, and does nothing otherwise. The panel's code loads the first time it opens, so a grid that never opens it doesn't download it. Keys pressed while it loads are not lost.
The dialog: a modal labeled "Keyboard shortcuts". Tab and Shift+Tab stay inside it, and the search box has focus when it opens.
Recording: the key being recorded is a button with focus. The status line announces "Recording keys for Bold. Press the new keys, or Escape to cancel."
Escape stops recording, and a second Escape closes the dialog.
Tab stops recording and moves on, so the keyboard is never trapped.
Conflicts: the conflict choices are a labeled group, and the first choice takes focus.
Status line: results, refusals and undo are announced there.
Closing: focus returns to the element that opened the panel.
const saved: string | nullconst saved:string|nullconst saved:string|nullvar localStorage: Storagevar localStorage:Storagevar localStorage:StorageMDN ReferenceStorage.getItem(key: string): string | nullStorage.getItem(key: string): string |nullStorage.getItem(key: string): string |nullThe getItem() method of the Storage interface, when passed a key name, will return that key's value, or null if the key does not exist, in the given Storage object. MDN Referenceconst grid: Gridconst grid:Gridconst grid:GridAPI referenceGrid.setConfig(config: GridConfig | undefined): voidGrid.setConfig(config: GridConfig |undefined): voidGrid.setConfig(config: GridConfig |undefined): voidReconfigure built-in chrome and keyboard handling without replacing the Grid or clearing selection/history. Construction-bound GridOptions are not accepted here.API referenceGridConfig.keyboardSettings?: boolean | KeyboardSettingsOptions | undefinedinterfaceGridConfig{keyboardSettings?:boolean|KeyboardSettingsOptions|undefined;}interfaceGridConfig{keyboardSettings?:|boolean|KeyboardSettingsOptions|undefined;}Let the user change the built-in keys in a Keyboard shortcuts dialog (default false). It opens from File › Options in the ribbon, from Shortcuts in the compact ribbon's tab row, and from grid.openKeyboardSettings(). Pass an object to lock some actions. See KeyboardSettingsOptions.API referenceGridConfig.keyboard?: boolean | KeyboardOptions | ((e: KeyboardEvent, grid: Grid) => boolean) | undefinedinterfaceGridConfig{keyboard?:|boolean|KeyboardOptions|((e:KeyboardEvent, grid:Grid)=>boolean)|undefined;}interfaceGridConfig{keyboard?:|boolean|KeyboardOptions|((e:KeyboardEvent,grid:Grid,)=>boolean)|undefined;}Built-in keyboard handling. true (default) keeps Excel's default bindings. An object replaces individual action bindings; omitted actions keep their defaults, and null disables an action's keys. For example: { bindings: { copy: { key: "c", mod: true, shift: true } } }. Menu hints and toolbar titles use these same bindings. false disables all built-in keys. A function intercepts each keydown before the defaults; return true to consume it, false to let the built-in handler continue.API referenceKeyboardOptions.bindings?: Partial<Record<KeyboardAction, readonly KeyShortcut[] | KeyShortcut | null>> | undefinedinterfaceKeyboardOptions{bindings?:|Partial<Record<KeyboardAction,readonlyKeyShortcut[]|KeyShortcut|null>>|undefined;}interfaceKeyboardOptions{bindings?:|Partial<Record<KeyboardAction,|readonlyKeyShortcut[]|KeyShortcut|null>>|undefined;}Shortcut overrides by action name; actions you leave out keep their default keys.API referencevar JSON: JSONvar JSON:JSONvar JSON:JSONAn intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.JSON.parse(text: string, reviver?: (this: any, key: string, value: any) => any): anyJSON.parse(text: string, reviver?:(this:any, key:string, value:any)=> any): anyJSON.parse(text: string, reviver?:(this:any, key:string, value:any)=> any): anyConverts a JavaScript Object Notation (JSON) string into an object.Parametertext A valid JSON string.Parameterreviver A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is.Throws{SyntaxError} If text is not valid JSON.const saved: stringconst saved:stringconst saved:stringGrid.on<"key-bindings-change">(evt: "key-bindings-change", fn: (e: {
bindings: KeyBindings;
}) => void): () => voidGrid.on<"key-bindings-change">(evt: "key-bindings-change", fn: (e:{bindings:KeyBindings;})=>void): ()=>voidGrid.on<"key-bindings-change">(evt: "key-bindings-change", fn: (e:{bindings:KeyBindings;})=>void): ()=>voidListen for a grid event; returns the function that removes the listener.API referencebindings: Partial<Record<KeyboardAction, readonly KeyShortcut[] | KeyShortcut | null>>let bindings:Partial<Record<KeyboardAction,readonlyKeyShortcut[]|KeyShortcut|null>>let bindings:Partial<Record<KeyboardAction,|readonlyKeyShortcut[]|KeyShortcut|null>>Shortcut overrides by action name; actions you leave out keep their default keys.API referenceStorage.setItem(key: string, value: string): voidStorage.setItem(key: string, value: string): voidStorage.setItem(key: string, value: string): voidThe setItem() method of the Storage interface, when passed a key name and value, will add that key to the given Storage object, or update that key's value if it already exists. MDN ReferenceJSON.stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): stringJSON.stringify(value: any, replacer?:(this:any, key:string, value:any)=> any, space?: string | number): stringJSON.stringify(value: any, replacer?:(this:any, key:string, value:any)=> any, space?: string | number): stringConverts a JavaScript value to a JavaScript Object Notation (JSON) string.Parametervalue A JavaScript value, usually an object or array, to be converted.Parameterreplacer A function that transforms the results.Parameterspace Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.Throws{TypeError} If a circular reference or a BigInt value is found.bindings: Partial<Record<KeyboardAction, readonly KeyShortcut[] | KeyShortcut | null>>let bindings:Partial<Record<KeyboardAction,readonlyKeyShortcut[]|KeyShortcut|null>>let bindings:Partial<Record<KeyboardAction,|readonlyKeyShortcut[]|KeyShortcut|null>>function createGrid(host: HTMLElement, opts: GridOptions): GridfunctioncreateGrid(host:HTMLElement,opts:GridOptions,):GridfunctioncreateGrid(host:HTMLElement,opts:GridOptions,):GridCreates and mounts an imperative Grid in the supplied host element.Parameterhost - Element the grid renders into. The grid fills it and follows its size, so give it a height.Parameteropts - The workbook, its data or datasource, and the grid's settings and callbacks.See alsoGrid, GridOptions·ExampleAPI referencefunction initSheetwrite(options?: InitSheetwriteOptions): Promise<void>functioninitSheetwrite(options?:InitSheetwriteOptions,):Promise<void>functioninitSheetwrite(options?:InitSheetwriteOptions,):Promise<void>Load one WASM engine and install add-ons before createGrid.See also/docs/start/choose-an-engine/, createGrid·ExampleAPI referenceinterface WorkbookinterfaceWorkbookinterfaceWorkbookLive workbook schema containing ordered sheets and the active sheet ID.API referenceconst host: HTMLElement | nullconst host:HTMLElement|nullconst host:HTMLElement|nullvar document: Documentvar document:Documentvar document:Documentwindow.document returns a reference to the document contained in the window. MDN ReferenceParentNode.querySelector<HTMLElement>(selectors: string): HTMLElement | nullParentNode.querySelector<HTMLElement>(selectors: string): HTMLElement |nullParentNode.querySelector<HTMLElement>(selectors: string): HTMLElement |nullThe Document method querySelector() returns the first Element within the document that matches the specified CSS selector, or group of CSS selectors. If no matches are found, null is returned. MDN Referenceinterface HTMLElementinterfaceHTMLElementinterfaceHTMLElementThe HTMLElement interface represents any HTML element. Some elements directly implement this interface, while others implement it via an interface that inherits it. MDN Referencevar Error: new (message?: string, options?: ErrorOptions) => Errorvar Error:new(message?:string,options?:ErrorOptions,)=>Errorvar Error:new(message?:string,options?:ErrorOptions,)=>Errorconst host: HTMLElementconst host:HTMLElementconst host:HTMLElementElementCSSInlineStyle.style: CSSStyleDeclarationinterfaceElementCSSInlineStyle{style:CSSStyleDeclaration;}interfaceElementCSSInlineStyle{style:CSSStyleDeclaration;}MDN ReferenceCSSStyleProperties.height: stringinterfaceCSSStyleProperties{height:string;}interfaceCSSStyleProperties{height:string;}The height CSS property specifies the height of an element. By default, the property defines the height of the content area. If box-sizing is set to border-box, however, it instead determines the height of the border area. MDN ReferenceWorkbook.activeSheet: stringinterfaceWorkbook{activeSheet:string;}interfaceWorkbook{activeSheet:string;}Active sheet ID and initial tab presented when the grid is created.API referenceWorkbook.sheets: Sheet[]interfaceWorkbook{sheets:Sheet[];}interfaceWorkbook{sheets:Sheet[];}Sheets in display/tab order.API referenceSheet.id: stringinterfaceSheet{id:string;}interfaceSheet{id:string;}Stable identifier, unique within the workbook and used by every cell address.API referenceSheet.name: stringinterfaceSheet{name:string;}interfaceSheet{name:string;}User-facing sheet name shown in tabs and workbook exports.API referenceSheet.rowCount: numberinterfaceSheet{rowCount:number;}interfaceSheet{rowCount:number;}Row count for both in-memory and datasource-backed sheets.API referenceSheet.columns: Column[]interfaceSheet{columns:Column[];}interfaceSheet{columns:Column[];}Ordered schema; array positions are the zero-based column coordinates.API referenceColumn.key: stringinterfaceColumn{key:string;}interfaceColumn{key:string;}Non-empty key, unique within the sheet, used to map input and datasource values.API referenceColumn.header: stringinterfaceColumn{header:string;}interfaceColumn{header:string;}Schema label used by table exports and data-grid presentation headers.API referenceColumn.type: CellFormatinterfaceColumn{type:CellFormat;}interfaceColumn{type:CellFormat;}Controls cell input parsing and default value formatting for this column.API referenceColumn.width: numberinterfaceColumn{width:number;}interfaceColumn{width:number;}Unzoomed column width in CSS pixels.API referenceGridOptions.workbook: WorkbookinterfaceGridOptions{workbook:Workbook;}interfaceGridOptions{workbook:Workbook;}Live workbook schema adopted by the store and updated by document operations.GridOptions.config?: GridConfig | undefinedinterfaceGridOptions{config?:GridConfig|undefined;}interfaceGridOptions{config?:GridConfig|undefined;}Built-in UI controls; providing an object enables the toolbar unless toolbar is false.API referenceGridConfig.ribbon?: boolean | RibbonConfig | undefinedinterfaceGridConfig{ribbon?:boolean|RibbonConfig|undefined;}interfaceGridConfig{ribbon?:|boolean|RibbonConfig|undefined;}Replace the built-in toolbar with an Excel-style ribbon (Home, Insert, Data and View tabs). Pass an object to choose its initial full, compact or automatic layout. A custom toolbar item list still renders the toolbar instead.API referenceconst stop: () => voidconststop:()=>voidconststop:()=>voidvar window: Window & typeof globalThisvar window:Window&typeof globalThisvar window:Window&typeof globalThisThe window property of a Window object points to the window object itself. MDN ReferenceaddEventListener: <"pagehide">(type: "pagehide", listener: (this: Window, ev: PageTransitionEvent) => any, options?: boolean | AddEventListenerOptions) => voidletaddEventListener:<"pagehide">(type:"pagehide",listener:(this:Window, ev:PageTransitionEvent)=>any, options?:boolean|AddEventListenerOptions)=>voidletaddEventListener:<"pagehide">(type:"pagehide",listener:(this:Window, ev:PageTransitionEvent)=>any, options?:boolean|AddEventListenerOptions)=>voidThe addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target. MDN ReferenceGrid.destroy(): voidGrid.destroy(): voidGrid.destroy(): voidFree everything this grid owns: its DOM, listeners, timers, renderer, worker and caches, and the store that it created. Call it when the host view is removed; a second call does nothing.API referenceKeyboardSettingsOptions.locked?: readonly KeyboardAction[] | undefinedinterfaceKeyboardSettingsOptions{locked?:readonlyKeyboardAction[]|undefined;}interfaceKeyboardSettingsOptions{locked?:|readonlyKeyboardAction[]|undefined;}Actions the dialog shows read-only. A swap or a replace never changes them either.API referenceParentNode.querySelector<Element>(selectors: string): Element | nullParentNode.querySelector<Element>(selectors: string): Element |nullParentNode.querySelector<Element>(selectors: string): Element |nullThe Document method querySelector() returns the first Element within the document that matches the specified CSS selector, or group of CSS selectors. If no matches are found, null is returned. MDN ReferenceElement.addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void | undefinedElement.addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void|undefinedElement.addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void|undefinedThe addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target. MDN ReferenceGrid.openKeyboardSettings(): voidGrid.openKeyboardSettings(): voidGrid.openKeyboardSettings(): voidOpen the Keyboard shortcuts dialog, for a host's own menu. Does nothing unless config.keyboardSettings is set. The dialog's code loads on first use; focus returns to the element that had it when the dialog closes.API referenceconst SheetwriteGrid: <Id extends RowBridgeId = RowBridgeId>(props: SheetwriteGridProps<Id> & {
ref?: ForwardedRef<Grid>;
}) => ReactElementconstSheetwriteGrid:<IdextendsRowBridgeId=RowBridgeId,>(props:SheetwriteGridProps<Id>&{ref?:ForwardedRef<Grid>;},)=>ReactElementconstSheetwriteGrid:<IdextendsRowBridgeId=RowBridgeId,>(props:SheetwriteGridProps<Id>&{ref?:ForwardedRef<Grid>;},)=>ReactElementRenders a workbook or datasource you own; use Sheetwrite for plain row objects.See alsoSheetwrite, /docs/frameworks/react/·ExampleAPI referenceGridOptions.workbook: WorkbookinterfaceGridOptions{workbook:Workbook;}interfaceGridOptions{workbook:Workbook;}Live workbook schema adopted by the store and updated by document operations.API referenceconst workbook: Workbookconst workbook:Workbookconst workbook:WorkbookAPI referenceKeyboardOptions.bindings?: Partial<Record<KeyboardAction, readonly KeyShortcut[] | KeyShortcut | null>> | undefinedinterfaceKeyboardOptions{bindings?:|Partial<Record<KeyboardAction,readonlyKeyShortcut[]|KeyShortcut|null>>|undefined;}interfaceKeyboardOptions{bindings?:|Partial<Record<KeyboardAction,|readonlyKeyShortcut[]|KeyShortcut|null>>|undefined;}Shortcut overrides by action name; actions you leave out keep their default keys.SheetwriteGridProps<RowBridgeId>.onKeyBindingsChange?: ((event: GridEvents["key-bindings-change"]) => void) | undefinedinterfaceSheetwriteGridProps<RowBridgeId>{onKeyBindingsChange?:|((event:GridEvents["key-bindings-change"])=>void)|undefined;}interfaceSheetwriteGridProps<RowBridgeId,>{onKeyBindingsChange?:|((event:GridEvents["key-bindings-change"],)=>void)|undefined;}Receives the user's key bindings after each change in the Keyboard shortcuts dialog.API referenceevent: {
bindings: KeyBindings;
}let event:{bindings:KeyBindings;}let event:{bindings:KeyBindings;}API referenceconst setBindings: (bindings: KeyBindings) => voidconstsetBindings:(bindings:KeyBindings)=>voidconstsetBindings:(bindings:KeyBindings,)=>voidAPI referenceconst SheetwriteGrid: Component<SheetwriteGridProps<RowBridgeId>, {}, "grid">const SheetwriteGrid:Component<SheetwriteGridProps<RowBridgeId>,{},"grid">const SheetwriteGrid:Component<SheetwriteGridProps<RowBridgeId>,{},"grid">Advanced framework component for workbook data or datasource input.API referenceworkbook: Workbooklet workbook:Workbooklet workbook:WorkbookAPI referencekeyboardSettings: booleanlet keyboardSettings:booleanlet keyboardSettings:booleankeyboard: {
bindings: Partial<Record<KeyboardAction, readonly KeyShortcut[] | KeyShortcut | null>>;
}let keyboard:{bindings:Partial<Record<KeyboardAction,readonlyKeyShortcut[]|KeyShortcut|null>>;}let keyboard:{bindings:Partial<Record<KeyboardAction,|readonlyKeyShortcut[]|KeyShortcut|null>>;}interface GridEventsinterfaceGridEventsinterfaceGridEventsPayload map for events emitted by a Grid.API referencelet bindings: Partial<Record<KeyboardAction, readonly KeyShortcut[] | KeyShortcut | null>>let bindings:Partial<Record<KeyboardAction,readonlyKeyShortcut[]|KeyShortcut|null>>let bindings:Partial<Record<KeyboardAction,|readonlyKeyShortcut[]|KeyShortcut|null>>