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
Normalization & format API Reference

normalizeHotkey

Call Signature

ts
function normalizeHotkey(hotkey, platform?): HotkeyChord;
function normalizeHotkey(hotkey, platform?): HotkeyChord;

Defined in: parse.ts:255

Normalizes a hotkey to its canonical string form. Accepts a chord string, a chord object, a parsed chord, or a sequence of any of these. Each sequence step is normalized, and a one-step sequence becomes its chord.

  • When Mod is allowed for the platform (Command on Mac without Control; Control on Windows/Linux without Meta): emits Mod, then Alt, then Shift, then the key (e.g. Mod+Shift+E, Mod+S).
  • Otherwise: literal modifiers in Control+Alt+Shift+Meta order, then the key.
  • Resolves aliases and normalizes key casing (e.g. esc → Escape, a → A).

Parameters

hotkey

AnyChord

The hotkey to normalize

platform?

Platform

The target platform for resolving Mod (defaults to auto-detection)

Returns

HotkeyChord

Example

ts
normalizeHotkey('shift+meta+e', 'mac') // 'Mod+Shift+E'
normalizeHotkey('ctrl+a', 'windows') // 'Mod+A'
normalizeHotkey({ key: 's', mod: true }) // 'Mod+S'
normalizeHotkey(['g', 'shift+g']) // ['G', 'Shift+G']
normalizeHotkey(parseKeyboardEvent(event)) // The chord the event pressed
normalizeHotkey('shift+meta+e', 'mac') // 'Mod+Shift+E'
normalizeHotkey('ctrl+a', 'windows') // 'Mod+A'
normalizeHotkey({ key: 's', mod: true }) // 'Mod+S'
normalizeHotkey(['g', 'shift+g']) // ['G', 'Shift+G']
normalizeHotkey(parseKeyboardEvent(event)) // The chord the event pressed

Call Signature

ts
function normalizeHotkey(hotkey, platform?): Hotkey;
function normalizeHotkey(hotkey, platform?): Hotkey;

Defined in: parse.ts:259

Normalizes a hotkey to its canonical string form. Accepts a chord string, a chord object, a parsed chord, or a sequence of any of these. Each sequence step is normalized, and a one-step sequence becomes its chord.

  • When Mod is allowed for the platform (Command on Mac without Control; Control on Windows/Linux without Meta): emits Mod, then Alt, then Shift, then the key (e.g. Mod+Shift+E, Mod+S).
  • Otherwise: literal modifiers in Control+Alt+Shift+Meta order, then the key.
  • Resolves aliases and normalizes key casing (e.g. esc → Escape, a → A).

Parameters

hotkey

AnyChord | readonly AnyChord[]

The hotkey to normalize

platform?

Platform

The target platform for resolving Mod (defaults to auto-detection)

Returns

Hotkey

Example

ts
normalizeHotkey('shift+meta+e', 'mac') // 'Mod+Shift+E'
normalizeHotkey('ctrl+a', 'windows') // 'Mod+A'
normalizeHotkey({ key: 's', mod: true }) // 'Mod+S'
normalizeHotkey(['g', 'shift+g']) // ['G', 'Shift+G']
normalizeHotkey(parseKeyboardEvent(event)) // The chord the event pressed
normalizeHotkey('shift+meta+e', 'mac') // 'Mod+Shift+E'
normalizeHotkey('ctrl+a', 'windows') // 'Mod+A'
normalizeHotkey({ key: 's', mod: true }) // 'Mod+S'
normalizeHotkey(['g', 'shift+g']) // ['G', 'Shift+G']
normalizeHotkey(parseKeyboardEvent(event)) // The chord the event pressed