Docs
Cloudflare
CodeRabbit
Railway
SerpAPI
Netlify
WorkOS
Clerk
AG Grid
OpenRouter
Electric
Sentry
Prisma
Unkey
Cloudflare
CodeRabbit
Railway
SerpAPI
Netlify
WorkOS
Clerk
AG Grid
OpenRouter
Electric
Sentry
Prisma
Unkey
API Reference
Hotkeys API Reference
Hotkey Sequence API Reference
Key hold & held keys API Reference
Hotkey Recorder API Reference
Hotkey Sequence Recorder API Reference
Normalization & format API Reference
Normalization & format API Reference

formatForDisplay

Function: formatForDisplay()

ts
function formatForDisplay(hotkey, options): string;
function formatForDisplay(hotkey, options): string;

Defined in: format.ts:92

Formats a hotkey for display in a user interface.

On macOS, uses symbols (⌘⇧S) in the same modifier order as normalizeHotkeyFromParsed. On Windows/Linux, uses text (Ctrl+Shift+S) with separators. The separator can be customized with .

Parameters

hotkey

The hotkey string or ParsedHotkey to format

& |

options

=

Formatting options

Returns

A formatted string suitable for display

Example

ts
formatForDisplay('Mod+Shift+S', { platform: 'mac' })
// Returns: '⌘ ⇧ S' (symbols separated by spaces on macOS)

formatForDisplay('Mod+Shift+S', { platform: 'windows' })
// Returns: 'Ctrl+Shift+S'

formatForDisplay('Escape')
// Returns: 'Esc' (on all platforms)
formatForDisplay('Mod+Shift+S', { platform: 'mac' })
// Returns: '⌘ ⇧ S' (symbols separated by spaces on macOS)

formatForDisplay('Mod+Shift+S', { platform: 'windows' })
// Returns: 'Ctrl+Shift+S'

formatForDisplay('Escape')
// Returns: 'Esc' (on all platforms)