Kbd
A square, centered keyboard "key" chip for rendering shortcut hints — K, ⌘, ⌃, Enter. Renders a native <kbd> element so screen readers announce it as keyboard input. Sized so letters and modifier symbols share a consistent visual height, width, and baseline.
When to use
- Documenting keyboard shortcuts in copy or tooltips.
- Inside menu items and command palettes alongside the action label.
- Inline with prose: "Press K to open search."
When not to use
- For arbitrary monospace text — use
Code. - For chord-style multi-key shortcuts as a single chip — render multiple
<Kbd>elements separated by+text instead.
Keyboard shortcuts
Combine multiple Kbd components to display keyboard shortcuts.
Accessibility
Screen readers do not announce symbol-only glyphs (⌘, ⌃, ↵) meaningfully. Put a visually hidden label inside the <Kbd> and mark the visible glyph aria-hidden. Do not set aria-label on the <Kbd>: <kbd> has the generic role, which prohibits naming, so a screen reader does not read the label reliably.
Translation
The <kbd> element always carries translate="no", so a browser translation engine skips the subtree. A translated shortcut names a key the reader's keyboard does not have.
Kbd omits the translate prop from its type, so no call site can turn the guard off. A key is never translatable, unlike Code, which also styles terms that are not code and therefore takes the override. See that page for the second reason the attribute matters: a translation engine that rewrites the text nodes React holds can also break the render, and Browser translation for the mechanism in full.
API Reference
Kbd
The Kbd accepts the following props in addition to the standard HTML kbd attributes, except translate.