UNPKG

905 BTypeScriptView Raw
1import * as React from "react";
2import { HotkeyConfig } from "./hotkeyConfig";
3export interface UseHotkeysOptions {
4 /**
5 * A custom document to reference when binding global event handlers.
6 * This can be useful when using iframes in an application.
7 *
8 * @default window.document
9 */
10 document?: Document;
11 /**
12 * The key combo which will trigger the hotkeys dialog to open.
13 *
14 * @default "?"
15 */
16 showDialogKeyCombo?: string;
17}
18export interface UseHotkeysReturnValue {
19 handleKeyDown: React.KeyboardEventHandler<HTMLElement>;
20 handleKeyUp: React.KeyboardEventHandler<HTMLElement>;
21}
22/**
23 * React hook to register global and local hotkeys for a component.
24 *
25 * @param keys list of hotkeys to configure
26 * @param options hook options
27 */
28export declare function useHotkeys(keys: HotkeyConfig[], options?: UseHotkeysOptions): UseHotkeysReturnValue;