Skip to content

Keyboard key

In review

Kbd is a single raised keycap, the dimensional key-hint chip the whole system shares: the command palette’s trigger + per-row hints, menu / tooltip / popover shortcut legends, and any “press X” caption. It renders a real <kbd> (so it is keyboard input in the a11y tree) and self-injects its recipe; the host still owns the accessible shortcut description.

Depth is built the same way every other lifted surface is (the lift law): a mono legend on a raised surface, a 1px top catch-light, and a weighted neutral bottom (a hard side-wall edge + a soft ambient drop). No glow, no colored shadow, no fat bottom border. On :active the cap depresses (it travels down and the bottom weight collapses), the way a physical key moves. For a chord, render several caps side by side in a tight flex row.

Live · web

Single keys: press one to feel it depress

KEscTabEnter

Chords: several caps in a tight row read as one shortcut

GthenP

Inline: a cap sits on the prose baseline

Open the command palette with , walk the results with , run one with Enter, and dismiss it with Esc.

Multi-line: a long sequence wraps cleanly in a narrow column (no overlap)

Ctrl P then G I then Enter, or Esc Esc to cancel, then K to reopen.

Every cap is a real <kbd>, semantically keyboard input in the a11y tree; the host still owns the accessible shortcut description. The look, the depress, and the theme flip come from the primitive, so the caps here carry no local styling.

// Web: React, consuming @dizyx/nockerl-tokens. NockerlKbd is a shipped leaf primitive in the
// published @dizyx/nockerl-react package (it is web-only today; see the drift note).
import { NockerlKbd } from '@dizyx/nockerl-react';
export function ShortcutLegend() {
return (
<p>
Open the palette with{' '}
{/* a CHORD: several caps side by side in a tight flex row (gap: var(--space-1)) */}
<span style={{ display: 'inline-flex', gap: 'var(--space-1)' }}>
<NockerlKbd></NockerlKbd>
<NockerlKbd>K</NockerlKbd>
</span>
, dismiss it with <NockerlKbd>Esc</NockerlKbd>.
</p>
);
}
// A single key inline in prose (it sits on the text baseline).
Press <NockerlKbd>Tab</NockerlKbd> to move focus.
// Riding a NockerlButton's trailingIcon slot (the command-palette trigger). The slot is a fixed
// 1em box, so release it to size to content when it hosts a chord, then the caps sit neatly.
<NockerlButton text="Search commands" variant="secondary" trailingIcon={<NockerlKbd></NockerlKbd>} />
PropTypeDefaultDescription
childrenReactNodeThe key legend: a glyph or short label (e.g. the cmd glyph, K, Esc, a chevron).