Skip to content

Kbd

kbd

A keyboard key and a chord of keys, rendered as real kbd elements with a keycap edge. For shortcut hints in menus, tooltips and empty states.

Install

$npxshadcnadd@forme/kbd

Adds the component, its registry dependencies, and the token stylesheet you import once.

API reference

Read from the source, so it is the API of the file you install. A prop marked * is required.

Kbd

A key, as printed on a keyboard.

PropTypeDefaultDescription
unstyledboolean—

Also takes every prop of <kbd> attributes.

KbdGroup

A chord: keys pressed together, with the separator hidden from assistive tech.

PropTypeDefaultDescription
keys*readonly string[]—
variant"keys" | "pill""keys"keys draws one keycap per key, for shortcuts listed in menus and prose. pill draws the chord as one rounded hint, for the end of a search trigger; it brightens with a group ancestor's hover.

Also takes every prop of <span> attributes.