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

formatHotkey

Call Signature

ts
function formatHotkey(parsed): string;
function formatHotkey(parsed): string;

Defined in: format.ts:36

Converts a parsed hotkey back to a string, with each platform modifier spelled out, such as Control+Shift+S. A parsed chord returns a string, and a parsed sequence returns one string per step. To get Mod back where the platform allows it, use normalizeHotkey instead.

Parameters

parsed

ParsedHotkeyChord

A parsed chord, or the parsed steps of a sequence

Returns

string

Example

ts
formatHotkey(parseHotkey('Mod+Shift+S', 'windows')) // 'Control+Shift+S'
formatHotkey(parseHotkey(['G', 'Mod+K'], 'mac')) // ['G', 'Meta+K']
formatHotkey(parseHotkey('Mod+Shift+S', 'windows')) // 'Control+Shift+S'
formatHotkey(parseHotkey(['G', 'Mod+K'], 'mac')) // ['G', 'Meta+K']

Call Signature

ts
function formatHotkey(parsed): string[];
function formatHotkey(parsed): string[];

Defined in: format.ts:37

Converts a parsed hotkey back to a string, with each platform modifier spelled out, such as Control+Shift+S. A parsed chord returns a string, and a parsed sequence returns one string per step. To get Mod back where the platform allows it, use normalizeHotkey instead.

Parameters

parsed

readonly ParsedHotkeyChord[]

A parsed chord, or the parsed steps of a sequence

Returns

string[]

Example

ts
formatHotkey(parseHotkey('Mod+Shift+S', 'windows')) // 'Control+Shift+S'
formatHotkey(parseHotkey(['G', 'Mod+K'], 'mac')) // ['G', 'Meta+K']
formatHotkey(parseHotkey('Mod+Shift+S', 'windows')) // 'Control+Shift+S'
formatHotkey(parseHotkey(['G', 'Mod+K'], 'mac')) // ['G', 'Meta+K']

Call Signature

ts
function formatHotkey(parsed): string | string[];
function formatHotkey(parsed): string | string[];

Defined in: format.ts:40

Converts a parsed hotkey back to a string, with each platform modifier spelled out, such as Control+Shift+S. A parsed chord returns a string, and a parsed sequence returns one string per step. To get Mod back where the platform allows it, use normalizeHotkey instead.

Parameters

parsed

| ParsedHotkeyChord | readonly ParsedHotkeyChord[]

A parsed chord, or the parsed steps of a sequence

Returns

string | string[]

Example

ts
formatHotkey(parseHotkey('Mod+Shift+S', 'windows')) // 'Control+Shift+S'
formatHotkey(parseHotkey(['G', 'Mod+K'], 'mac')) // ['G', 'Meta+K']
formatHotkey(parseHotkey('Mod+Shift+S', 'windows')) // 'Control+Shift+S'
formatHotkey(parseHotkey(['G', 'Mod+K'], 'mac')) // ['G', 'Meta+K']