Kbd
A styled element to indicate a keyboard shortcut.
Press ⌘ + K to open
<p>Press <Kbd>⌘</Kbd> + <Kbd>K</Kbd> to open</p>
Kbd is a styled HTML <kbd> that marks a keyboard shortcut. Small rendering with a light border and monospace font. Combine it with text (e.g. "Press ⌘K to open").
Installation
$ bext ui add kbd
Copy and paste the following into src/components/ui/kbd.tsx.
<p>Press <Kbd>⌘</Kbd> + <Kbd>K</Kbd> to open</p>
Usage
Anatomy
<Kbd>⌘K</Kbd>
API Reference
Kbd
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | The shortcut (symbol or letter). |
| className | string | — | Extra classes on the element. |
Accessibility
Semantic <kbd> element. Assistive technologies announce "key <content>". For a compound shortcut, wrap each key: <Kbd>⌘</Kbd> + <Kbd>K</Kbd>.
On This Page