reakeys
Version:
React Hotkeys Hooks
15 lines (14 loc) • 456 B
TypeScript
import { RefObject } from 'react';
import type { Callback } from 'ctrl-keys';
export interface HotkeyShortcuts {
name: string;
keys: string | string[];
ref?: RefObject<HTMLElement | null>;
disabled?: boolean;
callback: Callback;
action?: 'keypress' | 'keydown' | 'keyup';
description?: string;
category?: string;
hidden?: boolean;
}
export declare const useHotkeys: (shortcuts?: HotkeyShortcuts[]) => HotkeyShortcuts[];