TanStack
Hotkey Recorder API Reference

HotkeyChordRecorderOptions

Defined in: hotkey-recorder.ts:194

Options for recording a single chord. This is the default (maxSteps: 1).

Extends

  • HotkeyRecorderBaseOptions

Properties

cancelOnBlur?

ts
optional cancelOnBlur?: boolean;

Defined in: hotkey-recorder.ts:164

Whether to cancel recording when the window loses focus, as when the user switches apps or tabs, opens browser devtools, or clicks into an iframe. Keys pressed elsewhere never reach the page. Focus moving to another element on the page doesn't cancel. Default: true

Inherited from

ts
HotkeyRecorderBaseOptions.cancelOnBlur

detectConflicts?

ts
optional detectConflicts?: boolean | HotkeyConflictOptions;

Defined in: hotkey-recorder.ts:85

Opt in to live-registry conflicts, including sequence prefixes. Default: false.

Inherited from

ts
HotkeyRecorderBaseOptions.detectConflicts

ignoreInputs?

ts
optional ignoreInputs?: boolean;

Defined in: hotkey-recorder.ts:183

Whether to ignore keyboard events from input-like elements (text inputs, textarea, select, contenteditable) while recording. When true, typing in inputs passes through normally (Escape still cancels). Defaults to true.

Inherited from

ts
HotkeyRecorderBaseOptions.ignoreInputs

maxSteps?

ts
optional maxSteps?: 1;

Defined in: hotkey-recorder.ts:196

Maximum number of chords to record. Default: 1


onCancel?

ts
optional onCancel?: () => void;

Defined in: hotkey-recorder.ts:157

Optional callback when recording is cancelled: Escape, Tab without recordTab, or the window losing focus with cancelOnBlur

Returns

void

Inherited from

ts
HotkeyRecorderBaseOptions.onCancel

onClear?

ts
optional onClear?: () => void;

Defined in: hotkey-recorder.ts:177

Optional callback when the recording is cleared: Backspace/Delete with no modifiers and no recorded steps

Returns

void

Inherited from

ts
HotkeyRecorderBaseOptions.onClear

onRecord

ts
onRecord: (hotkey, context) => void;

Defined in: hotkey-recorder.ts:206

Callback when a chord is successfully recorded. context is the one validate received, with the key press that recorded the chord.

Parameters

hotkey

HotkeyChord

context

HotkeyChordRecorderValidationContext

Returns

void


onReject?

ts
optional onReject?: (rejection) => void;

Defined in: hotkey-recorder.ts:87

Rejected candidates leave recording active.

Parameters

rejection

RecorderRejection

Returns

void

Inherited from

ts
HotkeyRecorderBaseOptions.onReject

platform?

ts
optional platform?: HotkeyPlatform;

Defined in: hotkey-recorder.ts:83

Platform used for Mod and AltGraph handling. Defaults to platform detection.

Inherited from

ts
HotkeyRecorderBaseOptions.platform

recordBy?

ts
optional recordBy?: RecorderKeyMode;

Defined in: hotkey-recorder.ts:81

How the pressed key is written. Default: 'auto'.

Inherited from

ts
HotkeyRecorderBaseOptions.recordBy

recordTab?

ts
optional recordTab?: boolean;

Defined in: hotkey-recorder.ts:190

Whether to record Tab and Shift+Tab. By default they cancel recording and move focus, so keyboard users can leave the recorder. Tab with Control, Alt, or Meta isn't affected. When true, tell users that Escape cancels. Default: false

Inherited from

ts
HotkeyRecorderBaseOptions.recordTab

target?

ts
optional target?: Window | Document | null;

Defined in: hotkey-recorder.ts:172

The window to record key presses in, or its document, such as a Picture-in-Picture window that holds the recorder's button. Recording listens only there, and cancelOnBlur follows that window. Closing the window cancels, and a closed window doesn't start recording. Read when recording starts. Default: the page's window

Inherited from

ts
HotkeyRecorderBaseOptions.target

validate?

ts
optional validate?: (hotkey, context) => string | boolean;

Defined in: hotkey-recorder.ts:198

Return true to accept, or false or a message to reject while staying in recording mode. The message is passed to onReject.

Parameters

hotkey

HotkeyChord

context

HotkeyChordRecorderValidationContext

Returns

string | boolean