Kbd

Used to display textual user input from keyboard.

Loading example…

Installation

bunx --bun shadcn@latest add @sui/kbd

Install with the shadcn CLI or use the shared @workspace/ui package. Follow the installation guide to configure the registry, load styles, and choose import aliases.

Usage

import { Kbd } from "@workspace/ui/components/kbd"
<Kbd>Ctrl</Kbd>

Composition

Use the following composition to build Kbd and KbdGroup:

Kbd
KbdGroup
├── Kbd
└── Kbd

Group

Use the KbdGroup component to group keyboard keys together.

Loading example…

Button

Use the Kbd component inside a Button component to display a keyboard key inside a button.

Loading example…

Tooltip

You can use the Kbd component inside a Tooltip component to display a tooltip with a keyboard key.

Loading example…

Input Group

You can use the Kbd component inside a InputGroupAddon component to display a keyboard key inside an input group.

Loading example…

RTL

To enable RTL support in shadcn/ui, see the RTL configuration guide.

Loading example…

API Reference

Kbd

Use the Kbd component to display a keyboard key.

PropTypeDefault
classNamestring``
<Kbd>Ctrl</Kbd>

KbdGroup

Use the KbdGroup component to group Kbd components together.

PropTypeDefault
classNamestring``
<KbdGroup>
  <Kbd>Ctrl</Kbd>
  <Kbd>B</Kbd>
</KbdGroup>