A <kbd> fragment set in the mono face on a raised, bordered key cap — the physical-keycap sibling of Inline Code. Sized xs–xl so a shortcut tracks the surrounding text; data-density scales each size further.
Registry-only
No headless primitive — this component ships only as a copied styled file, so there is no Headless mode. primitiv add kbd installs it whichever mode you are reading.
Kbd renders a real <kbd> element, so assistive tech announces it as keyboard input rather than as plain text — the semantics come for free from the right element.
For a combination, give each key its own Kbd and keep the + joiner outside them: a screen reader then reads the keys individually instead of spelling out one run-together string.
It is presentational, not interactive — a <kbd> naming a key is not itself a control. The actual keyboard handling lives on the component the shortcut drives.
Examples
Every example below reacts to the density control. Currently showing Styled mode.
A single key
A <kbd> fragment styled as a raised key cap. Use it for the name of a single key — Esc, Enter, Tab — anywhere you refer to a keystroke in running text or a shortcuts list.
A combination is separate Kbds joined by a plain +, not one Kbd with the whole string — each physical key is its own cap, and a screen reader announces them one at a time. Keep the joiner (+ or a thin space) outside the caps.
Kbd sizes off the text around it, so a key named mid-sentence sits on the line without disturbing it. Reach for Kbd when the thing is a key to press; for a literal value or a command, that is InlineCode.
Press / to focus the search field, or Esc to close it.
import{Kbd}from"@/components/ui/kbd";<p> Press <Kbdsize="sm">/</Kbd> to focus the search field.</p>