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

useHotkeys

ts
function useHotkeys(hotkeys, commonOptions?): void;
function useHotkeys(hotkeys, commonOptions?): void;

Defined in: useHotkeys.ts:90

Vue composable for registering several hotkeys at once: chords, sequences, and app hotkeys. The list, each hotkey, and options may be refs or getters.

Options merge in this order: provider defaults, app hotkey declaration, commonOptions, per-hotkey options. Each option applies only to the kinds that support it. Unbound app hotkeys and empty sequences register nothing. A target that resolves to null skips registration until it is set.

Parameters

hotkeys

MaybeRefOrGetter<readonly UseHotkeyDefinition[]>

commonOptions?

MaybeRefOrGetter<UseHotkeyCommonOptions> = {}

Returns

void

Example

ts
useHotkeys([
  { hotkey: 'Mod+S', callback: () => save() },
  { hotkey: ['G', 'G'], callback: () => scrollToTop(), options: { timeout: 500 } },
])
useHotkeys([
  { hotkey: 'Mod+S', callback: () => save() },
  { hotkey: ['G', 'G'], callback: () => scrollToTop(), options: { timeout: 500 } },
])