Skip to content
shadcn.io is not affiliated with official shadcn/ui

Shadcn Kbd for React and Tailwind

Styled representation of a single key.

K
+K

Installation

bunx --bun shadcn@latest add https://kit.dev/r/kbd.json

Anatomy

Kbd

KbdGroup
├── Kbd
└── Kbd

Usage

import { 
  Kbd, 
  KbdGroup 
} from "@/components/ui";
<KbdGroup>
  <Kbd>⌘</Kbd>
  <Kbd>K</Kbd>
</KbdGroup>

Variant

Outline

Examples

Group

Use KbdGroup to group keys into a single shortcut.

Input Group

Use Kbd inside InputGroup addons to show shortcut hints next to inputs.

Button

Add shortcut hints to buttons with Kbd or KbdGroup.

Tooltip

Show keyboard shortcuts in Tooltip content.

Keyboard Table

For a Key / Description list of shortcuts, use Keyboard Table.

API Reference

Kbd

Styled representation of a single key.

PropTypeDefault
variant"default" | "outline""default"
classNamestring-
asChildbooleanfalse

KbdGroup

Groups multiple keys into one shortcut.

PropTypeDefault
classNamestring-
asChildbooleanfalse