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

ParsedHotkeyChord

ts
type ParsedHotkeyChord = ParsedModifiers & 
  | {
  code?: never;
  key: LogicalKey | string & object;
}
  | {
  code: string;
  key?: never;
};
type ParsedHotkeyChord = ParsedModifiers & 
  | {
  code?: never;
  key: LogicalKey | string & object;
}
  | {
  code: string;
  key?: never;
};

Defined in: hotkey.types.ts:156

A parsed chord matches either a logical key or a physical code, never both. Check code !== undefined to narrow to a physical binding. Its logical character is unknown without a keyboard event and is not stored in key.

Example

ts
parseHotkey('Alt+S') // { key: 'S', alt: true, ... }
parseHotkey('Alt+[KeyS]') // { code: 'KeyS', alt: true, ... } with no key property
parseHotkey('Alt+S') // { key: 'S', alt: true, ... }
parseHotkey('Alt+[KeyS]') // { code: 'KeyS', alt: true, ... } with no key property