TanStack
Hotkey Recorder API Reference

createHotkeyRecorder

Call Signature

ts
function createHotkeyRecorder(options): SolidHotkeyRecorder<HotkeyChord>;

Defined in: createHotkeyRecorder.ts:45

Solid primitive for recording keyboard shortcuts. Options may be an accessor.

With the default maxSteps: 1, the first valid chord is recorded. With a larger maxSteps, each chord adds a step; the recording commits on Enter (unless commitKeys: 'none'), after idleTimeoutMs, or at maxSteps, and onRecord receives a chord (one step) or a sequence.

Parameters

options

HotkeyChordRecorderOptions

Returns

SolidHotkeyRecorder<HotkeyChord>

Example

tsx
const recorder = createHotkeyRecorder({ onRecord: setShortcut })
const sequenceRecorder = createHotkeyRecorder({ maxSteps: 3, onRecord: setShortcut })

Call Signature

ts
function createHotkeyRecorder(options): SolidHotkeyRecorder;

Defined in: createHotkeyRecorder.ts:48

Solid primitive for recording keyboard shortcuts. Options may be an accessor.

With the default maxSteps: 1, the first valid chord is recorded. With a larger maxSteps, each chord adds a step; the recording commits on Enter (unless commitKeys: 'none'), after idleTimeoutMs, or at maxSteps, and onRecord receives a chord (one step) or a sequence.

Parameters

options

HotkeySequenceRecorderOptions

Returns

SolidHotkeyRecorder

Example

tsx
const recorder = createHotkeyRecorder({ onRecord: setShortcut })
const sequenceRecorder = createHotkeyRecorder({ maxSteps: 3, onRecord: setShortcut })

Call Signature

ts
function createHotkeyRecorder(options): SolidHotkeyRecorder;

Defined in: createHotkeyRecorder.ts:53

Solid primitive for recording keyboard shortcuts. Options may be an accessor.

With the default maxSteps: 1, the first valid chord is recorded. With a larger maxSteps, each chord adds a step; the recording commits on Enter (unless commitKeys: 'none'), after idleTimeoutMs, or at maxSteps, and onRecord receives a chord (one step) or a sequence.

Parameters

options

() => HotkeySequenceRecorderOptions

Returns

SolidHotkeyRecorder

Example

tsx
const recorder = createHotkeyRecorder({ onRecord: setShortcut })
const sequenceRecorder = createHotkeyRecorder({ maxSteps: 3, onRecord: setShortcut })

Call Signature

ts
function createHotkeyRecorder(options): SolidHotkeyRecorder<HotkeyChord>;

Defined in: createHotkeyRecorder.ts:56

Solid primitive for recording keyboard shortcuts. Options may be an accessor.

With the default maxSteps: 1, the first valid chord is recorded. With a larger maxSteps, each chord adds a step; the recording commits on Enter (unless commitKeys: 'none'), after idleTimeoutMs, or at maxSteps, and onRecord receives a chord (one step) or a sequence.

Parameters

options

() => HotkeyChordRecorderOptions

Returns

SolidHotkeyRecorder<HotkeyChord>

Example

tsx
const recorder = createHotkeyRecorder({ onRecord: setShortcut })
const sequenceRecorder = createHotkeyRecorder({ maxSteps: 3, onRecord: setShortcut })

Call Signature

ts
function createHotkeyRecorder(options): SolidHotkeyRecorder;

Defined in: createHotkeyRecorder.ts:59

Solid primitive for recording keyboard shortcuts. Options may be an accessor.

With the default maxSteps: 1, the first valid chord is recorded. With a larger maxSteps, each chord adds a step; the recording commits on Enter (unless commitKeys: 'none'), after idleTimeoutMs, or at maxSteps, and onRecord receives a chord (one step) or a sequence.

Parameters

options

() => HotkeyRecorderOptions

Returns

SolidHotkeyRecorder

Example

tsx
const recorder = createHotkeyRecorder({ onRecord: setShortcut })
const sequenceRecorder = createHotkeyRecorder({ maxSteps: 3, onRecord: setShortcut })