Hotkeys API Reference
- HotkeyManager
- getHotkeyManager
- Hotkey
- HotkeyChord
- HotkeySequence
- RegisterableHotkey
- RegisterableHotkeyChord
- RegisterableHotkeySequence
- RawHotkeyChord
- HotkeyOptions
- HotkeyChordOptions
- HotkeySequenceOptions
- HotkeyOptionsFor
- HotkeyRegistrationHandle
- HotkeyRegistrationView
- HotkeyChordRegistrationView
- HotkeySequenceRegistrationView
- toHotkeyRegistrationView
- HotkeyCallback
- HotkeyCallbackContext
- HotkeyChordCallbackContext
- HotkeySequenceCallbackContext
- HotkeyCallbackContextFor
- HotkeyMeta
- ConflictBehavior
- isHotkeySequence
- simplifyHotkey
- createSequenceMatcher
- DEFAULT_SEQUENCE_TIMEOUT
- HotkeysProvider
- useDefaultHotkeysOptions
- useHotkey
- useHotkeyRegistrations
- useHotkeys
- useHotkeysContext
- HotkeysProviderOptions
- HotkeysProviderProps
- UseHotkeyChordOptions
- UseHotkeyCommonOptions
- UseHotkeyDefinition
- UseHotkeyOptions
- UseHotkeyOptionsFor
- UseHotkeySequenceOptions
- UseHotkeyTarget
App Hotkeys API Reference
- defineAppHotkeys
- AppHotkeysStore
- provideAppHotkeys
- publishAppHotkeysStore
- AppHotkey
- AppHotkeyInput
- AppHotkeyOptions
- AppHotkeyListItem
- AppHotkeyStatus
- AppHotkeysState
- AppHotkeysStoreOptions
- CustomHotkeys
- Register
- AppHotkeyId
- RegisteredAppHotkeys
- isAppHotkey
- isCustomHotkey
- resolveAppHotkey
- useAppHotkeyList
- useAppHotkeys
- useCustomHotkeys
- UseCustomHotkeysResult
- UseAppHotkeyOptions
Key hold & held keys API Reference
Hotkey Recorder API Reference
- HotkeyRecorder
- HotkeyRecorderOptions
- HotkeyChordRecorderOptions
- HotkeySequenceRecorderOptions
- HotkeyRecorderState
- HotkeyRecorderCommitKeys
- HotkeyRecorderValidationContext
- HotkeyChordRecorderValidationContext
- HotkeySequenceRecorderValidationContext
- RecorderOptions
- RecorderRejection
- RecorderKeyMode
- findHotkeyConflicts
- HotkeyConflict
- HotkeyConflictOptions
- useHotkeyRecorder
- ReactHotkeyRecorder
Normalization & format API Reference
- formatForDisplay
- FormatDisplayOptions
- DisplayHotkey
- DisplayHotkeyChord
- formatHotkey
- normalizeHotkey
- parseHotkey
- parseKeyboardEvent
- ParsedHotkeyChord
- matchesKeyboardEvent
- areHotkeysEqual
- validateHotkey
- checkHotkey
- assertValidHotkey
- ValidationResult
- ValidatableHotkey
- LogicalKey
- PhysicalKey
- PhysicalKeyCode
- KEY_DISPLAY_SYMBOLS
- PUNCTUATION_KEY_DISPLAY_LABELS
- MAC_MODIFIER_SYMBOLS
- MAC_MODIFIER_LABELS
- WINDOWS_MODIFIER_LABELS
- LINUX_MODIFIER_LABELS
- MODIFIER_ALIASES
- MODIFIER_ORDER
- MODIFIER_KEYS
AppHotkeysStore
Defined in: app-hotkeys.ts:352
Holds declared app hotkeys and the user's custom hotkeys. Framework providers create one and expose it through hooks; devtools read it from HotkeyManager.appHotkeys.
Example#
const store = new AppHotkeysStore(appHotkeys, {
customHotkeys: JSON.parse(localStorage.getItem('hotkeys') ?? '{}'),
onCustomHotkeysChange: (custom) =>
localStorage.setItem('hotkeys', JSON.stringify(custom)),
})
store.setCustomHotkey('doc.save', 'Mod+Shift+S')Type Parameters#
T#
T extends AppHotkeys = AppHotkeys
Constructors#
Constructor#
new AppHotkeysStore<T>(appHotkeys, options?): AppHotkeysStore<T>;Defined in: app-hotkeys.ts:357
Parameters#
appHotkeys#
T
options?#
AppHotkeysStoreOptions<T> = {}
Returns#
AppHotkeysStore<T>
Properties#
store#
readonly store: Store<AppHotkeysState<T>>;Defined in: app-hotkeys.ts:353
Accessors#
appHotkeys#
Get Signature#
get appHotkeys(): T;Defined in: app-hotkeys.ts:375
Effective app hotkeys.
Returns#
T
customHotkeys#
Get Signature#
get customHotkeys(): CustomHotkeys<T>;Defined in: app-hotkeys.ts:380
The user's hotkeys that differ from the defaults.
Returns#
Methods#
findConflicts()#
findConflicts(id, hotkey): AppHotkey<string,
| HotkeyChord
| HotkeySequence
| null>[];Defined in: app-hotkeys.ts:416
Other app hotkeys that would collide if id used hotkey. App hotkeys collide when their scopes match or either is 'global', and their hotkeys are equal or one sequence starts with the other.
Parameters#
id#
keyof T & string
hotkey#
Returns#
AppHotkey<string, | HotkeyChord | HotkeySequence | null>[]
get()#
get(id):
| AppHotkey<string,
| HotkeyChord
| HotkeySequence
| null>
| undefined;Defined in: app-hotkeys.ts:407
Effective app hotkey for an id, or undefined when it is not declared.
Parameters#
id#
string
Returns#
| AppHotkey<string, | HotkeyChord | HotkeySequence | null> | undefined
getList()#
getList(registrations): AppHotkeyListItem<T[keyof T]>[];Defined in: app-hotkeys.ts:483
Joins app hotkeys with live registrations, in declaration order. Adapters call this with the manager's registration views.
Parameters#
registrations#
Iterable<HotkeyRegistrationView>
Returns#
AppHotkeyListItem<T[keyof T]>[]
resetCustomHotkey()#
resetCustomHotkey(id): void;Defined in: app-hotkeys.ts:460
Restores the default hotkey for an app hotkey.
Parameters#
id#
keyof T & string
Returns#
void
resetCustomHotkeys()#
resetCustomHotkeys(): void;Defined in: app-hotkeys.ts:467
Restores every default hotkey.
Returns#
void
setAppHotkeys()#
setAppHotkeys(appHotkeys): void;Defined in: app-hotkeys.ts:393
Replaces the declarations, for example after hot module replacement. Custom hotkeys for ids that still exist are kept.
Parameters#
appHotkeys#
T
Returns#
void
setCustomHotkey()#
setCustomHotkey(id, hotkey): AppHotkey<string,
| HotkeyChord
| HotkeySequence
| null>[];Defined in: app-hotkeys.ts:435
Sets the user's hotkey for an app hotkey. null unbinds it. A hotkey equal to the default removes the customization.
Parameters#
id#
keyof T & string
hotkey#
Hotkey | null
Returns#
AppHotkey<string, | HotkeyChord | HotkeySequence | null>[]
Conflicting app hotkeys. When any exist, nothing changes.
setOptions()#
setOptions(options): void;Defined in: app-hotkeys.ts:385
Updates callbacks and other options without resetting custom hotkeys.
Parameters#
options#
Omit<AppHotkeysStoreOptions<T>, "customHotkeys">
Returns#
void