Kbd

Utilities

A component for displaying keyboard keys and shortcuts. Use Kbd to show keyboard interactions, hotkeys, or command shortcuts in your documentation.

Import

import { Kbd, KeyboardShortcut } from "@/components/ui/kbd";

Usage

Single Keys

Individual keyboard keys

EnterEscTabSpaceBackspace

Key Combinations

Multiple keys for shortcuts

KSP

With Labels

Shortcuts with descriptive labels

SearchKSaveSCommand PalettePClose

Sizes

Different key sizes

SmMdLg

Common Shortcuts

Pre-defined keyboard shortcuts

CopyC
PasteV
UndoZ
RedoZ

Responsive Behavior

Keyboard keys automatically scale down on smaller screens

Scales with viewport

PCommand Palette

In context menu

CutX
CopyC
PasteV

API Reference

keys
string | string[]

Key(s) to display

variant"default"
"default" | "outline" | "flat"

Visual style

size"md"
"sm" | "md" | "lg"

Size of the key