KeyboardShortcut
Renders a keyboard shortcut as key caps (e.g. ⌘K). Use mod for the primary modifier rather than hardcoding ⌘ or Ctrl.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
keys | string | — | Shortcut string with + separators, e.g. "mod+k", "shift+/", "ctrl+alt+delete". |
platform | "mac" | "win" | — | Force a platform instead of sniffing. mod renders ⌘ on mac, Ctrl on win. |
size | "sm" | "md" | "md" | Key cap size. |
joined | boolean | — | Renders one merged cap (⌘K) instead of separate keys. |
subtle | boolean | — | Dim styling for shortcuts inside an already-highlighted row. |
Examples
mod+K
CtrlK
mod+shift+/
CtrlShift/
Joined
Ctrl+K
Size sm
CtrlEnter
Subtle
CtrlK
Explicit platform
import { KeyboardShortcut } from "@solarius/onset";
import type { KeyboardShortcutProps } from "@solarius/onset";