Keyboard key
Key caps and keyboard chords for shortcut hints.
Primitive · content
Install
Section titled “Install”npx shadcn@latest add https://ndigo.dev/r/kbd.jsonTo use the shorter @ndigo/kbd form, configure the namespace in components.json.
| Source | Target | Type |
|---|---|---|
registry/ui/kbd/nd-kbd.css |
@ui/nd-kbd/nd-kbd.css |
registry:file |
Live example
Section titled “Live example”See this component rendered live on the live examples page.
Dependencies
Section titled “Dependencies”None.
Documentation
Section titled “Documentation”<p>Press <kbd class="nd-kbd">Ctrl</kbd> + <kbd class="nd-kbd">K</kbd> to search.</p>
<span class="nd-kbd-group"> <kbd class="nd-kbd">⌘</kbd> <kbd class="nd-kbd">K</kbd></span>Accessibility
Section titled “Accessibility”<kbd> is the native element for user input; keep it. Do not use the key cap as
a button or shortcut handler — pair it with the real control. The visual spacing
in a chord is decorative; the surrounding sentence should explain the shortcut.
Styling
Section titled “Styling”Import nd-kbd.css after the tokens. The cap uses the raised surface, border, and
monospace font; the bottom border is thicker to read as a physical key.