Skip to content

formatKey

formatKey(spec, aria?): string

Defined in: keys.ts:284

Write a key combination the way the platform writes it: "⇧⌘K" on a Mac, "Ctrl+Shift+K" everywhere else. What the components put in their key hints — use it for the same hint elsewhere in your app, so both spell the shortcut the way this machine’s user expects. Pass aria: true for the aria-keyshortcuts spelling instead: full modifier names and real key names, "Meta+Shift+K"/"Control+Shift+K".

string

boolean = false

string

S.button({ content: `Search ${S.formatKey("mod+k")}`, click: search });