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
API Reference
Hotkeys API Reference
Hotkey Sequence API Reference
Key Hold API Reference
Held Keys API Reference
Hotkey Recorder API Reference
Hotkey Sequence Recorder API Reference
Format for Display API Reference

validateHotkey

Function: validateHotkey()

ts
function validateHotkey(hotkey): ValidationResult;

Defined in: validate.ts:24

Validates a hotkey string and returns any warnings or errors.

Checks for:

  • Valid syntax (modifier+...+key format)
  • Known modifiers
  • Known keys

Parameters

hotkey

The hotkey string to validate

Hotkey | string & object

Returns

ValidationResult

A ValidationResult with validity status, warnings, and errors

Example

ts
validateHotkey('Mod+S')
// { valid: true, warnings: [], errors: [] }

validateHotkey('')
// { valid: false, warnings: [], errors: ['Hotkey cannot be empty'] }