ui

Kbd

A component for displaying keyboard keys and shortcuts. Built with Base UI and Tailwind CSS. Copy-paste ready.

Installation

Usage

Single key:

Multiple keys (key combination):

Examples

Input group

A search input with a KbdGroup addon showing the keyboard shortcut to focus the field — common in command bars.

Keys grouped together

Use KbdGroup to wrap multiple Kbd elements that form a chord, visually connecting them as a single shortcut.

With icons

Replace text key labels with icon symbols (⌘, ⇧, ⌥) to match platform conventions on macOS.

In a tooltip

Append shortcut keys inside a TooltipContent so users can discover keyboard shortcuts on hover without cluttering the UI.

Reference list

A formatted keyboard shortcut reference card listing actions and their corresponding key combinations in a two-column layout.

In Buttons

KbdGroup appended inside Button components to surface keyboard shortcuts inline with the action they trigger.

Arrow Keys

A directional pad layout of arrow key Kbd badges with labels below — useful in onboarding flows or keyboard shortcut docs.

Cross-Platform Shortcuts

A three-column table comparing action labels with Mac () and Windows/Linux (Ctrl) equivalents side by side.

In Menu Items

Shortcut badges aligned to the trailing edge of MenuItem components using ms-auto — the standard pattern for context menus.

Command Palette Results

A command palette result list where each row includes a trailing Kbd for the confirmation key, plus a footer legend for navigate, open, and close.