Kbd
Kbd stands for the HTML <kbd> element — short for "keyboard input" — and is the standard semantic tag for representing user keystrokes (W3C HTML spec). The <x-wirekit:: component wraps that element into a small, raised "keycap" — a <kbd> tag with a monospace font, a subtle border, a tinted background, and a rounded corner. Use it whenever you describe a keyboard input the user is meant to press.
Two common patterns:
- Inline shortcut hints — sprinkle a single
<x-wirekit::into running text to label a key (e.g.kbd> press <x-wirekit::kbd size="sm">Esc</x-wirekit::). The component sits inline with the surrounding font flow and adapts its size relative to the parent typography.kbd> to close - Key combinations — wrap multiple
<x-wirekit::in akbd> <x-wirekit::row gap="xs">to render shortcut sequences like<x-wirekit::kbd size="sm">⌘</x-wirekit::. Each key gets its ownkbd> <x-wirekit::kbd size="sm">K</x-wirekit:: kbd> <kbd>element so screen readers announce them as discrete inputs rather than concatenating them into a single token.
The component renders the semantic HTML5 <kbd> element — assistive technology announces it as "keyboard input" automatically, so authors don't need to add aria-label for the indicator role itself. For platform-specific glyphs (⌘ Cmd on macOS, Ctrl on Windows / Linux, ⇧ Shift, ⌥ Opt, ⌃ Ctrl-on-Mac, ↵ Enter), prefer the symbol on macOS / iOS surfaces and the spelled-out label everywhere else — or detect the platform and swap server-side.
Live Sandbox
This is a hydrated playground for the component. Toggle "Live preview" on the block below to swap the static HTML render for a real Livewire instance — every prop in the component's sandbox schema becomes an editable form field inside the iframe, so you can try different prop combinations live without writing any local code.
Basic Usage
Key Combinations
Sizes
In Context
Press ⌘ K to open the command palette.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
size |
string | 'md' |
Size: sm, md, lg |
scope |
string|null | null |
Scoped personalization name |
Keyboard Interaction
This component is purely presentational and does not respond to keyboard input.
Pitfalls
- Think twice before putting
<x-wirekit::inside akbd> <button>. Not for the font — the element sets--font-wk-monoon itself and keeps it wherever it lands. The reason is semantic:<kbd>marks up input the READER is being asked to type, and a button already says "activate me". Nesting the two makes the shortcut look like a second control. Render the hint beside the button rather than inside it.
Design Tokens
| Token | Used for |
|---|---|
--font-wk-mono |
Monospace font family |
--color-wk-border |
Key border |
--color-wk-bg-muted |
Key background |
--color-wk-text |
Key text color |
--radius-wk-sm |
Border radius |
--border-wk-width |
Border width |