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
App Hotkeys API Reference

defineAppHotkeys

ts
function defineAppHotkeys<T>(definitions): DefinedAppHotkeys<T>;
function defineAppHotkeys<T>(definitions): DefinedAppHotkeys<T>;

Defined in: app-hotkeys.ts:178

Declares every app hotkey up front, without registering any, so cheat sheets and settings screens can list hotkeys whose components have not mounted. Pass the result to HotkeysProvider as appHotkeys.

Type Parameters

T

T extends Record<string, AppHotkeyInput>

Parameters

definitions

T & ValidatedAppHotkeyInputs<T>

Returns

DefinedAppHotkeys<T>

Example

ts
export const appHotkeys = defineAppHotkeys({
  'doc.save': { hotkey: 'Mod+S', meta: { name: 'Save', group: 'Document' } },
  'nav.home': { hotkey: ['G', 'H'], meta: { name: 'Go home' }, options: { timeout: 800 } },
  'palette.open': { hotkey: null, meta: { name: 'Command palette' } },
})
export const appHotkeys = defineAppHotkeys({
  'doc.save': { hotkey: 'Mod+S', meta: { name: 'Save', group: 'Document' } },
  'nav.home': { hotkey: ['G', 'H'], meta: { name: 'Go home' }, options: { timeout: 800 } },
  'palette.open': { hotkey: null, meta: { name: 'Command palette' } },
})