Kbd
A keyboard key or shortcut on the real <kbd>element, the one HTML element that means "input from a keyboard". A combination follows the HTML spec's own pattern: an outer<kbd> holding one nested <kbd>per key, with the separator as real text between them, so a screen reader hears "Command plus K" as one shortcut rather than a row of unrelated glyphs.
- Open command palette
- Ctrl+K
- New chat
- Ctrl+Shift+O
- Send message
- Ctrl+Enter
- Stop generating
- Esc
Platform-aware keys
The lowercase aliases mod, alt,shift and ctrl resolve per platform:mod is ⌘ on Apple platforms and Ctrl everywhere else. They render as text, not icons, so they inherit the font and scale with it. With platform="auto" (the default) the platform is read after hydration; the server and the first client render use the non-Apple names, so the markup always matches. Passplatform="apple" or "other" to pin it.
Symbol keys (⌘ ⌥ ⇧ ⌃, ↵, the arrows) get a visually hidden spoken name, because screen readers announce those glyphs inconsistently.
Examples
Single key
Children render as one key.
Usage
<Kbd>Esc</Kbd>Combination
One nested key per entry in keys.
Usage
<Kbd keys={["mod", "K"]} />Inline
Sized like Badge, it sits on the text baseline.
Press
Usage
<p>Press <Kbd keys={["mod", "↵"]} /> to send.</p>Playground
Toggle every adjustable prop and watch the component — and the code — update live.
Same component — Kernel look stripped. See Platforms.
Usage
<Kbd keys={["mod","shift","P"]} /><kernel-kbd keys="mod shift P"></kernel-kbd>Props
| Prop | Type | Default |
|---|---|---|
keys | string[] | — |
separator | ReactNode | "+" |
platform | "auto" | "apple" | "other" | "auto" |
children | ReactNode (a single key, when keys is omitted) | — |
The custom element takes keys as a space-separated attribute: <kernel-kbd keys="mod shift P">.
Accessibility
<kbd>is the semantic element for keyboard input; nesting follows the HTML spec's example for combinations.- The separator is real text, so the combination is read as one phrase.
- Modifier symbols are
aria-hiddenand paired with a visually hidden name ("Command", "Shift", "Enter").