Redpanda UIRedpanda UI

Kbd

Used to display textual user input from keyboard.

Made by shadcn

Installation

Loading component...

When to use

The Kbd component displays keyboard keys and shortcuts in a styled format. Use this decision tree to determine when it's appropriate:

Usage

    <Kbd>
      <Command /> +K
    </Kbd>

Anatomy

The Kbd component displays keyboard keys in a styled format. Here's how the components work together:

<Kbd>          {/* Container styled as a keyboard key */}
  <Command />  {/* Optional icon (⌘, Ctrl, Shift, etc.) */}
  +K           {/* Key text or combination */}
</Kbd>

<KbdGroup>     {/* Groups multiple keys together */}
  <Kbd>⌘</Kbd>
  <Kbd>K</Kbd>
</KbdGroup>

Layout Structure

  • Kbd: Root component with keyboard key styling (border, padding, rounded corners)
  • KbdGroup: Flex container that groups multiple Kbd components with proper spacing

Typical Usage Patterns

// Single key
<Kbd>K</Kbd>

// Combination with icon
<Kbd><Command /> K</Kbd>

// Multiple keys in sequence
<KbdGroup>
  <Kbd>Ctrl</Kbd>
  <Kbd>Shift</Kbd>
  <Kbd>P</Kbd>
</KbdGroup>

// In button
<Button>
  Search <Kbd className="ml-2">⌘K</Kbd>
</Button>

// In tooltip
<TooltipContent>
  <p>Search</p>
  <Kbd><Command /> K</Kbd>
</TooltipContent>

// In input group
<InputGroup>
  <InputGroupInput placeholder="Search..." />
  <InputGroupAddon>
    <Kbd>⌘K</Kbd>
  </InputGroupAddon>
</InputGroup>

Examples

Default

Loading component...

Group

Use the KbdGroup component to group keyboard keys together.

Loading component...

Button

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

Loading component...

Tooltip

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

Loading component...

Input Group

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

Loading component...

Props

Credits

  • We take our inspiration from Shadcn UI for the kbd component and style.

Recent changes

  • patchv1.2.0Pin shipped dependency floors to the version we develop against. Registry items now declare ranges like `^5.1.9` (the actual installed version) instead of collapsing to `^5.0.0`, so consumers start on the known-tested b…#133
  • minorv1.1.0Theme docs refresh, readability pass on semantic foregrounds, and consumer-facing Base UI regression fixes.#121
  • minorv1.0.0Post-Base-UI polish. Public API unchanged.#116
  • majorv1.0.0Migrate every Radix-based primitive to `@base-ui/react@^1.4.0` (Base UI).#114
  • minorv0.3.0Add theme-provider component to the registry with documentation and tests. Includes playground type improvements (export RegistryItem, remove as-const boilerplate) and docs site dark mode border color fix.#109
See full history →
Built by malinskibeniamin. The source code is available on GitHub.

On this page