UNPKG

975 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 * @see https://blueprintjs.com/docs/#core/hooks/use-hotkeys
26 * @param keys list of hotkeys to configure
27 * @param options hook options
28 */
29export declare function useHotkeys(keys: readonly HotkeyConfig[], options?: UseHotkeysOptions): UseHotkeysReturnValue;