View fulldotdev/ui on GitHub

Kbd

Used to display textual user input from keyboard.

Installation

npx shadcn@latest add @fulldev/kbd

Usage

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

Composition

Kbd
KbdGroup
├── Kbd
└── Kbd

Group

Use KbdGroup to group keyboard keys together.

Button

Put a Kbd inside a Button, with data-icon="inline-end" for the icon spacing.

Tooltip

Put a Kbd inside TooltipContent.

Input Group

Put a Kbd inside an InputGroupAddon.

RTL

API Reference

Source: src/components/ui/kbd

ComponentElementData Slot
Kbdkbdkbd
KbdGroupdivkbd-group

Both take class and pass all other attributes through. KbdGroup renders a div, so do not nest it in a p.