@tanstack/react-hotkeys
Version:
React adapter for TanStack Hotkeys
13 lines • 1.03 kB
TypeScript
import { HeldModifierOptions, IfTypeParameter, KnownHotkey } from "@tanstack/hotkeys";
import { AdapterHotkeyInput, AdapterWrapperHotkey } from "@tanstack/hotkeys/adapter";
/**
* Returns a boolean indicating whether held modifiers reveal this shortcut.
* The hint shows only while the hotkey can fire: some registration of it is
* enabled and in an active scope. An app hotkey matches its registrations by
* id and uses its effective hotkey (false while unbound). No hotkey
* (`undefined`, `null`, or `''`) returns false.
* Uses the nonempty-subset/AltGr rules of `matchesHeldModifiers`; `exact`
* requires every modifier. A sequence reveals its hint from its first step.
* Only visibility changes cause a rerender. This helper does not register a shortcut. A hotkey on an element counts only while focus is inside it.
*/
export declare function useHotkeyHint<const T extends AdapterHotkeyInput>(hotkey: IfTypeParameter<T, AdapterWrapperHotkey, KnownHotkey<T, T | null | undefined>>, options?: HeldModifierOptions): boolean;