Kbd, KbdShortcut
Frondmod renders ⌘ or Ctrl by platform.KJesc
Usage
The import, then a use to start from. Both copy as they are.
Import
import { Kbd, KbdShortcut } from "@/components/ui/kbd";Example
<KbdShortcut keys={["mod", "K"]} /><KbdShortcut keys={["mod", "J"]} variant="inverse" /><Kbd>esc</Kbd>When to use
Use it for
- Show the shortcut wherever one exists: in a
Tooltip, a menu row, or beside a button's label. - Write
modfor the platform key: it renders ⌘ on macOS and Ctrl elsewhere. variant="inverse"on dark surfaces such as tooltips and the primary button.
Avoid
- Typing ⌘ or Ctrl into copy. It's wrong on the other platform.
- Showing a shortcut the app doesn't handle.
Accessibility
Checks
- A shortcut is a hint, never the only way: everything it does is reachable with Tab and Enter.
API
Read from each component's stories, the same source as COMPONENTS.md, and kept in step by check:design-system.
Kbd
COMPONENTS.md.KbdShortcut
COMPONENTS.md.