Skip to main content

Function: shortcutLabel()

shortcutLabel(combo, platform?): string

Defined in: src/lib/utils/shortcuts/index.ts:406

A short label for a key combination, e.g. for menus: modifier symbols (^ Control, ⌥ Alt, ⇧ Shift, then ⌘ for "cmd" on Apple devices or ^ elsewhere), then the key as a symbol or in uppercase.

Parameters​

combo​

KeyCombo

platform?​

string

Returns​

string

Example​

shortcutLabel({ key: "z", cmd: true, shift: true }, "MacIntel"); // "⇧⌘Z"
shortcutLabel({ key: "backspace", alt: true }, "Win32"); // "⌥⌫"