Skip to content
VenusUI
Get started

Kbd

Keyboard keys and key combinations using the semantic kbd element.

Preview

Installation

npx shadcn@latest add @venusui/kbd

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/components/ui/kbd.tsx

Usage

The code behind the preview above.

kbd-demo.tsx

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

export default function KbdDemo() {
  return (
    <div className="space-y-3 text-sm">
      <p>
        Press <KbdCombo keys={["⌘", "K"]} /> to open search.
      </p>
      <p>
        Use <Kbd>↑</Kbd> <Kbd>↓</Kbd> to move and <Kbd>Enter</Kbd> to choose.
      </p>
    </div>
  )
}

API reference

PropTypeDefaultDescription
raisedbooleantrueKbd: thicker bottom border so it looks like a key.
keysstring[]—KbdCombo: keys in order, e.g. ["⌘", "K"].

Kbd accepts all <kbd> props.

Requirements

  • Tailwind CSS v4. Works in Server Components.

Customization

  • Show platform-specific shortcuts by choosing ⌘ or Ctrl in your own code.

Accessibility

  • Uses <kbd>; combinations nest keys inside an outer <kbd>, the HTML way to mark up key combos. The “+” is decorative.

Troubleshooting

Symbols such as ⌘ don’t show.
Use a font that includes them, or write “Cmd”.
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.
No components.json found
Run npx shadcn@latest init in your project first.
Loading preview

Analog Clock

Data display

A station clock whose needle waits at twelve; drag the minute hand to set it by hand.

Loading preview

Avatar Stack

Data display

Overlapping avatars with a +N counter that spread apart on hover.

Loading preview

Bookshelf

Interactive

Books on a wooden shelf whose spines lift on hover and pull out when selected, with a matching cover.