Interface KeyboardShortcutProps

Props of the useKeyboardShortcut hook.

interface KeyboardShortcutProps {
    containerRef?: RefObject<Element>;
    isDisabled?: boolean;
    onAction?: (() => void);
    shortcut: readonly (
        | number
        | KeyCode
        | "Ctrl"
        | string & {})[];
}

Properties

containerRef?: RefObject<Element>

A container inside which a shortcut is applied. By default, a shortcut is document-wide.

isDisabled?: boolean

If true then shortcut isn't captured.

false
onAction?: (() => void)

A handler that is called when all keys from a shortcut are pressed.

shortcut: readonly (
    | number
    | KeyCode
    | "Ctrl"
    | string & {})[]

An array of keys that must be simultaneously pressed to call an action.