function createHotkeys(hotkeys, commonOptions): void;
Defined in: createHotkeys.ts:67
SolidJS primitive for registering multiple keyboard hotkeys at once.
Uses the singleton HotkeyManager for efficient event handling. Accepts a dynamic array of hotkey definitions, making it safe to use with variable-length lists.
Options are merged in this order: HotkeysProvider defaults < commonOptions < per-definition options
Array of hotkey definitions, or accessor returning them
CreateHotkeyDefinition[] | () => CreateHotkeyDefinition[]
Shared options applied to all hotkeys, or accessor
CreateHotkeyOptions | () => CreateHotkeyOptions
void
function Editor() {
createHotkeys([
{ hotkey: 'Mod+S', callback: () => save() },
{ hotkey: 'Mod+Z', callback: () => undo() },
{ hotkey: 'Escape', callback: () => close() },
])
}
function MenuShortcuts(props) {
createHotkeys(
() => props.items.map((item) => ({
hotkey: item.shortcut,
callback: item.action,
options: { enabled: item.enabled },
})),
{ preventDefault: true },
)
}