Kbd
A square, centered keyboard "key" chip for rendering keyboard shortcut hints, such as K, ⌘, ⌃, or Enter. For a symbol key, put a visually hidden label inside the Kbd and mark the glyph aria-hidden.
When to use
- Show keyboard shortcuts in copy or tooltips.
- Show a shortcut beside the action label in a menu item or a command palette.
- Show a key inline with prose: "Press K to open search."
- Prefer
Codefor a fragment of code or other monospace text. - Prefer
Badgefor a status, a category, or a count.
When not to use
- For a chord-style multi-key shortcut as a single chip. Render multiple
<Kbd>elements separated by+text instead.
Keyboard shortcuts
Combine multiple Kbd components to display keyboard shortcuts.
Sizing
Kbd is sized so letters and modifier symbols share a consistent visual height, width, and baseline.
Accessibility
Kbd renders a native <kbd> element, so screen readers announce it as keyboard input. 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.