Kbd
A physical key, rendered as a cap — it names a shortcut and is never the control that fires one.
Default
A key cap: DM Mono, a recessed fill and a hairline, because with no shadow available a bare tint does not read as a cap. `title` spells out a glyph nobody can search for — `⌘` renders as one character but reads as "Command" to a screen reader.
Usage
import { Kbd, KbdGroup } from '@oceanic-hub/brand-system'Composition
Use the following composition to build a Kbd:
Kbd
KbdGroup
└── Kbd ×2It has one job: draw a key someone would press. KbdGroup combines several into
a chord or a sequence — ⌘ K together, G then I one after another — because a
<kbd> holding <kbd>s is the element's own shape for a combination.
This overlaps two other places the package already names a shortcut. DropdownMenuShortcut
and CommandShortcut are positional slots inside a menu row — no cap, no border, pushed to
the trailing edge by ml-auto — because a row of bordered caps inside every item would
out-shout the labels. Reach for one of those inside a DropdownMenuItem or a CommandItem;
reach for Kbd everywhere else — a docs page, an empty state, a tooltip, an
InputGroupAddon. They compose rather than compete: a Shortcut may hold a Kbd.
It takes no size, no variant and no asChild — one cap height, one look, and a leaf
that never becomes a control. The 32px touch floor does not apply: at h-5 (20px) it sits
below it on purpose, because it is pointer-events-none by construction — a picture of a
key, never something a finger has to hit. A pressable shortcut is a Button with a Kbd
inside it, and the Button brings the floor with it.
Group
KbdGroup for a chord or a sequence — ⌘ K together, or G then I one after another. It is a <kbd> holding <kbd>s, which is the element's own shape for a combination.
Press ⌘K to search contacts, or GR to jump to the latest run.
In a button
A Kbd inside a Button is how a shortcut becomes pressable — the cap alone is pointer-events-none and never a control, so the Button is what brings the 32px touch floor.
In a tooltip
When a tooltip's whole job is naming a shortcut, put a Kbd in the content instead of spelling the combination out as prose. Our Tooltip emits no data-slot, so — unlike upstream — the cap needs no special-cased recolour to sit inside one; it takes its usual recessed fill everywhere, a tooltip included.
In an input group
InputGroupAddon is tuned for a Kbd child — align it inline-end and the addon tightens its own margin so the cap sits flush against the field's edge.
API Reference
See the Kbd API page for every prop of every part, with types, defaults and the contract that pins them.