Use Kbd to document shortcuts in help text, command palettes, and docs.
Setup
<script lang="ts">
import { Kbd } from '.';
</script> Default
Press Ctrl + C to copy
<script lang="ts">
import { Kbd } from '.';
</script>
<span>Press</span>
<Kbd>Ctrl</Kbd>
<span>+</span>
<Kbd>C</Kbd>
<span>to copy</span> Common shortcuts
Shift Ctrl Alt ⌘ Enter Esc Tab ↑ ↓
<Kbd>Shift</Kbd>
<Kbd>Ctrl</Kbd>
<Kbd>Alt</Kbd>
<Kbd>⌘</Kbd>
<Kbd>Enter</Kbd>
<Kbd>Esc</Kbd> Chord sequences
⌘ + Shift + P Command palette
<Kbd>⌘</Kbd>
<span>+</span>
<Kbd>Shift</Kbd>
<span>+</span>
<Kbd>P</Kbd> Custom class
⌘K<Kbd class="border-primary-300 bg-primary-50 text-primary-800">⌘K</Kbd> Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | Snippet | — | Key label content (required) |
class | ClassValue | — | Extra classes on the <kbd> |
...rest | HTMLAttributes<HTMLElement> | — | Native attributes |
Theme base: rounded-lg border border-gray-200 bg-gray-100 px-2 py-1.5 text-xs font-semibold text-gray-800 (with dark variants).