About the shadcn/ui Kbd Component
The Kbd component is part of shadcn/ui — a collection of accessible, copy-paste React components built with Radix UI and Tailwind CSS. Install it with `npx shadcn@latest add kbd` and copy it directly into your project.
Kbd Component — Frequently Asked Questions
How do I display a keyboard shortcut combination like Ctrl+K?
Use multiple `<Kbd>` elements: `<Kbd>Ctrl</Kbd><span>+</span><Kbd>K</Kbd>`. The kbd-group example shows how to render key combinations with proper spacing.
Where should I use the shadcn Kbd component?
Use Kbd in command palettes, tooltips, keyboard shortcut guides, and help documentation. It visually distinguishes keys from regular text for better scannability.
How do I embed a Kbd inside a Button?
The kbd-button example shows a Button with a Kbd inside for showing shortcuts: `<Button>Search <Kbd>⌘K</Kbd></Button>`. Use `ml-auto` to push the shortcut to the right.