UNPKG

@supunlakmal/hooks

Version:

A collection of reusable React hooks

20 lines (19 loc) 857 B
interface KeyComboOptions { /** Target element for the listener (default: document) */ target?: EventTarget | null | (() => EventTarget | null); /** Prevent default behavior (default: false) */ preventDefault?: boolean; /** Stop propagation (default: false) */ stopPropagation?: boolean; /** Trigger on keyup instead of keydown (default: false) */ event?: 'keydown' | 'keyup'; } /** * Detects specific keyboard combinations (shortcuts) being pressed. * * @param combo The key combination string (e.g., 'ctrl+s', 'alt+shift+k'). Case-insensitive. * @param callback The function to call when the combo is detected. * @param options Optional configuration for the event listener. */ export declare const useKeyCombo: (combo: string, callback: (event: KeyboardEvent) => void, options?: KeyComboOptions) => void; export {};