apps/v4/content/docs/components/base/kbd.mdx
npx shadcn@latest add kbd
<Step>Copy and paste the following code into your project.</Step>
<ComponentSource name="kbd" title="components/ui/kbd.tsx" styleName="base-nova" />
<Step>Update the import paths to match your project setup.</Step>
</Steps> </TabsContent> </CodeTabs>import { Kbd } from "@/components/ui/kbd"
<Kbd>Ctrl</Kbd>
Use the KbdGroup component to group keyboard keys together.
Use the Kbd component inside a Button component to display a keyboard key inside a button.
You can use the Kbd component inside a Tooltip component to display a tooltip with a keyboard key.
You can use the Kbd component inside a InputGroupAddon component to display a keyboard key inside an input group.
To enable RTL support in shadcn/ui, see the RTL configuration guide.
<ComponentPreview styleName="base-nova" name="kbd-rtl" direction="rtl" />Use the Kbd component to display a keyboard key.
| Prop | Type | Default |
|---|---|---|
className | string | `` |
<Kbd>Ctrl</Kbd>
Use the KbdGroup component to group Kbd components together.
| Prop | Type | Default |
|---|---|---|
className | string | `` |
<KbdGroup>
<Kbd>Ctrl</Kbd>
<Kbd>B</Kbd>
</KbdGroup>