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#

PropTypeDefaultDescription
callbackrequired() => voidCallback to be called when the key combination is pressed
childrenrequiredtype ONLY_FOR_FORMAT = | string | ReactElement<any, string | JSXElementConstructor<any>> | ((props: { keys: string | string[] ariaKeyshortcuts?: string | undefined }) => ReactNode)A single child or render prop function
commandrequiredstring | string[]The key combination. Supports shorthands: ⌥ ⇧ ⌃ ⌘ Shifted keys like ? and + are handled automatically
hotkeyOptionsUseHotkeysOptionsOptions for the useHotkeys hook

HotkeysList Props#

PropTypeDefaultDescription
hotkeysrequiredHotkeysConfig

Was this helpful?