GitHub 560+

Kbd

Used to display textual user input from keyboard.

Ctrl B

Installation

npx shadcn@latest add @fulldev/kbd

Usage

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

Composition

Use the following composition to build Kbd and KbdGroup:

Kbd
KbdGroup
├── Kbd
└── Kbd

Examples

Group

Use the KbdGroup component to group keyboard keys together.

Use
Ctrl B
or
Ctrl K
to open the command palette

Button

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

Tooltip

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

Input Group

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

K

API Reference

Kbd

Use the Kbd component to display a keyboard key.

PropTypeDefault
classstring
<Kbd>Ctrl</Kbd>

KbdGroup

Use the KbdGroup component to group Kbd components together.

PropTypeDefault
classstring
<KbdGroup>
  <Kbd>Ctrl</Kbd>
  <Kbd>B</Kbd>
</KbdGroup>

See the GitHub source code for more information on props.