Docs
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
Hotkeys API Reference
App Hotkeys API Reference
Key hold & held keys API Reference
Hotkey Recorder API Reference
Normalization & format API Reference
Hotkeys API Reference

HotkeyRegistrationHandle

Defined in: hotkey-manager.ts:261

A handle returned from HotkeyManager.register() that allows updating the callback and options without re-registering the hotkey.

Example

ts
const handle = manager.register('Mod+S', callback, options)

// Update callback without re-registering (avoids stale closures)
handle.callback = newCallback

// Update options without re-registering
handle.setOptions({ enabled: false })

// Unregister when done
handle.unregister()
const handle = manager.register('Mod+S', callback, options)

// Update callback without re-registering (avoids stale closures)
handle.callback = newCallback

// Update options without re-registering
handle.setOptions({ enabled: false })

// Unregister when done
handle.unregister()

Type Parameters

TOptions

TOptions extends HotkeyOptions = | HotkeyChordOptions | HotkeySequenceOptions

Properties

callback

ts
callback: HotkeyCallback;
callback: HotkeyCallback;

Defined in: hotkey-manager.ts:268

The callback function. Can be set directly to update without re-registering. This avoids stale closures when the callback references React state.


id

ts
readonly id: string;
readonly id: string;

Defined in: hotkey-manager.ts:270

Unique identifier for this registration


isActive

ts
readonly isActive: boolean;
readonly isActive: boolean;

Defined in: hotkey-manager.ts:272

Check if this registration is still active (not unregistered)


setOptions

ts
setOptions: (options) => void;
setOptions: (options) => void;

Defined in: hotkey-manager.ts:280

Update options (merged with existing options). Useful for updating enabled, preventDefault, etc. without re-registering. Changing capture moves the listener phase without clearing requireReset state or sequence progress. A registration already processed for an event cannot process it again in another phase.

Parameters

options

Partial<TOptions>

Returns

void


unregister

ts
unregister: () => void;
unregister: () => void;

Defined in: hotkey-manager.ts:282

Unregister this hotkey

Returns

void