UNPKG

@mirawision/reactive-hooks

Version:

A comprehensive collection of 50+ React hooks for state management, UI interactions, device APIs, async operations, drag & drop, audio/speech, and more. Full TypeScript support with SSR safety.

21 lines (20 loc) 659 B
import { RefObject } from 'react'; export interface Shortcut { combo: string; handler: (e: KeyboardEvent) => void; } export interface ShortcutsOptions { target?: Window | Document | HTMLElement | RefObject<Element>; } /** * A hook that sets up keyboard shortcuts with modifier key support. * @param shortcuts Array of shortcuts with combo strings and handlers * @param opts Options for target element * * @example * useShortcuts([ * { combo: 'Ctrl+S', handler: (e) => save(e) }, * { combo: 'Ctrl+Shift+Z', handler: (e) => redo(e) } * ]); */ export declare function useShortcuts(shortcuts: Shortcut[], opts?: ShortcutsOptions): void;