Hotkeys Docs
API Reference
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
AI/LLM: This documentation page is available in plain markdown format at/hotkeys/latest/docs/reference/type-aliases/HotkeyChord.md
Hotkeys API Reference
HotkeyChord
ts
type HotkeyChord =
| Key
| SingleModifierHotkey
| TwoModifierHotkey
| ThreeModifierHotkey
| FourModifierHotkey;Defined in: hotkey.types.ts:126
A type-safe hotkey string.
Provides autocomplete for:
- All single keys (letters, numbers, function keys, navigation, editing, punctuation)
- Single modifier + common key (Control+S, Mod+A, Mod+/, etc.)
- Two modifiers + common key (Mod+Shift+S, Control+Alt+A, etc.)
- Three modifiers + common key (Control+Alt+Shift+A, Mod+Alt+Shift+S, etc.)
- Four modifiers + common key (Control+Alt+Shift+Meta+A, etc.)
Modifier Names#
Use canonical modifier names:
- Control (not Ctrl) - The Control key
- Alt (not Option) - The Alt key (Option on macOS)
- Meta (not Command/Cmd) - The Meta/Command key (macOS only)
- Shift - The Shift key
Platform-Adaptive Mod Modifier#
The Mod modifier is a special platform-adaptive modifier that automatically resolves to the "primary modifier" on each platform:
- macOS: Mod → Meta (Command key ⌘)
- Windows/Linux: Mod → Control (Ctrl key)
This enables cross-platform hotkey definitions that work correctly on all platforms without platform-specific code. The Mod modifier is resolved at runtime based on the detected platform.
When to use Mod vs platform-specific modifiers:
- Use Mod for cross-platform shortcuts (e.g., Mod+S for save)
- Use Meta or Control when you need platform-specific behavior
- Use Mod when you want your shortcuts to follow platform conventions automatically
Limitations:
- Mod+Control and Mod+Meta combinations are not allowed (they create duplicate modifiers on one platform)
- In four-modifier combinations, only canonical modifiers are allowed (no Mod)
Example#
ts
// Cross-platform shortcuts (recommended)
const save: HotkeyChord = 'Mod+S' // Command+S on Mac, Ctrl+S on Windows/Linux
const saveAs: HotkeyChord = 'Mod+Shift+S' // Command+Shift+S on Mac, Ctrl+Shift+S elsewhere
const comment: HotkeyChord = 'Mod+/' // Command+/ on Mac, Ctrl+/ elsewhere
// Platform-specific shortcuts
const macOnly: HotkeyChord = 'Meta+S' // Command+S on Mac only
const windowsOnly: HotkeyChord = 'Control+S' // Ctrl+S on Windows/Linux only