Kbd

A component to display keyboard shortcuts.

Ctrl+B

Installation

pnpm dlx cubix@latest add kbd

Usage

Import
import { Kbd, KbdGroup } from "@/components/cubix/kbd"
Example
<Kbd>Ctrl</Kbd>
<Kbd>⌘K</Kbd>

Basic

Ctrl⌘KCtrl + B

Modifier Keys

C

KbdGroup

Use KbdGroup to group related keys together.

CtrlShiftP

Use Ctrl + BCtrl + K to open the command palette

Arrow Keys

With Icons

With Icons and Text

LeftVoice Enabled

Input Group

Compose Kbd inside an InputGroup addon.

⌘K

Tooltip

Show keyboard shortcuts inside a tooltip.

With samp

Wrap sample output in <samp> when the key represents a program or file name.

File

API Reference

Kbd

PropTypeDefaultDescription
classNamestring-Additional Tailwind classes merged with the component styles (last one wins).
childrenReact.ReactNode-The key label, icon, or combination to display.

KbdGroup

PropTypeDefaultDescription
classNamestring-Additional Tailwind classes merged with the component styles (last one wins).
childrenReact.ReactNode-One or more Kbd elements to group together.