Ballmac UI home

Kbd

Keyboard key and shortcut display built on the semantic <kbd> element, in three sizes, with KbdGroup for combinations like ⌘ ⇧ K. Adapts inside tooltips.

Press ⌘K to search

⌘⇧PCtrlEsc↵

Installation

$ pnpm dlx shadcn@latest add @ballmac/kbd

Usage

import { Kbd, KbdGroup } from "@/components/ballmac/kbd"

The full example is in the Code tab above.

API reference

PropTypeDefault
size"sm" | "default" | "lg""default"

Also accepts the standard attributes of its root element.

Use with AI

Displays a key or shortcut. Use Kbd for each key and KbdGroup for keys pressed together; it restyles itself for the dark tooltip surface automatically. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Kbd (@ballmac/kbd) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Shortcut hints in menus, tooltips and command palettes
  • Documentation of keyboard controls
  • Search inputs that show a ⌘ K hint

Not for

  • Inline code or commands (use code)
  • Buttons that trigger the shortcut (use button)

Registry JSON: https://ui.ballmac.com/r/kbd.json

Credits

Free to use in personal and commercial projects.

Registry
shadcn/utils