Hotkeys
Hotkeys are a series of one or several keys that trigger an action when pressed.
Props
useHotkeys Params
useHotkeys
accepts a string
or array of strings string[]
and a callback function (e: KeyboardEvent) => void
useHotkeysShortcut Params
useHotkeysShortcut
accepts a string
with the shortcut or a key combination and a callback function (e: KeyboardEvent) => void
Hotkey Props
Prop | Type | Default | Description |
---|---|---|---|
callbackrequired | () => void | Callback to be called when the key combination is pressed | |
childrenrequired | type ONLY_FOR_FORMAT =
| string
| ReactElement<any, string | JSXElementConstructor<any>>
| ((props: {
keys: string | string[]
ariaKeyshortcuts?: string | undefined
}) => ReactNode) | A single child or render prop function | |
commandrequired | string | string[] | The key combination. Supports shorthands: ⌥ ⇧ ⌃ ⌘ Shifted keys like ? and + are handled automatically | |
hotkeyOptions | UseHotkeysOptions | Options for the useHotkeys hook |
HotkeysList Props
Prop | Type | Default | Description |
---|---|---|---|
hotkeysrequired | HotkeysConfig |
Was this helpful?