Kbd
A keyboard key or shortcut, shown as a small keycap.
Preview
⌘KCtrl+Shift+PEsc↵
Installation
npm
Manual
pnpm add @syntara/react @syntara/tokensimport { Kbd, KbdGroup } from '@syntara/react';Usage
import { Kbd, KbdGroup } from '@syntara/react';
export function SearchHint() {
return (
<p>
Press{' '}
<KbdGroup>
<Kbd>⌘</Kbd>
<Kbd>K</Kbd>
</KbdGroup>{' '}
to search.
</p>
);
}Examples
In text
Shortcut hints inside a sentence.
Press / to search claims, or ⌘K to open the command menu.
Use ↑ ↓ to move between rows and Space to select.
Accessibility
No keyboard interaction of its own.
- Renders <kbd>; KbdGroup is a <kbd> containing <kbd>s, the HTML idiom for a key combination.
- Symbols such as ⌘ and ↵ are read inconsistently by screen readers; spell the shortcut out nearby or in an aria-label on the control it belongs to (aria-keyshortcuts).
- Key combinations stay in pressing order (left to right) on right-to-left pages.
Guidelines
Do
- Use the platform's key names (⌘ on macOS, Ctrl elsewhere).
Don’t
- Don't use Kbd for code or values — use <code>.
API reference
Kbd
childrenRequiredReactNodeThe key name or symbol, e.g. "Esc", "⌘", "↵".
KbdGroup
childrenRequiredReactNodeKbd elements, optionally with separators such as "+" or "then".
Tokens
The semantic tokens this component reads, grouped by what they control. Swatches show this site’s theme; change a tenant’s brand and the component follows with no code change.
- Colour4
border.defaultsurface.raisedtext.defaulttext.subtle- Type4
font.monofont.size.xsfont.weight.mediumfont.tracking.xs- Space and size2
space.1space.5- Shape1
radius.badge- Depth2
shadow.highlighthairline