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

isSingleLetterKey

Function: isSingleLetterKey()

ts
function isSingleLetterKey(key): boolean;

Defined in: constants.ts:445

Normalizes a key name to its canonical form.

Converts various key name formats (aliases, case variations) into the standard canonical names used throughout the library. This enables a more forgiving API where users can write keys in different ways and still get correct behavior.

Normalization rules:

  1. Check aliases first (e.g., 'Esc' → 'Escape', 'Del' → 'Delete')
  2. Single letters → uppercase (e.g., 'a' → 'A', 's' → 'S')
  3. Function keys → uppercase (e.g., 'f1' → 'F1', 'F12' → 'F12')
  4. Other keys → returned as-is (already canonical or unknown)

Parameters

key

string

The key name to normalize (can be an alias, lowercase, etc.)

Returns

boolean

The canonical key name

Example

ts
normalizeKeyName('esc') // 'Escape'
normalizeKeyName('a') // 'A'
normalizeKeyName('f1') // 'F1'
normalizeKeyName('ArrowUp') // 'ArrowUp' (already canonical)