Kbd

Kbd displays quiet, native keyboard shortcut notation beside actions and commands.

Overview and decision boundary

Use Kbd to display a keyboard shortcut beside an action or command label.

Do not use Kbd as an interactive control or a replacement for visible command labels.

Esc⌘K⇧⌘P⌥←⌘↵
import { Kbd } from '@nerio-ui/ui';<Kbd>Esc</Kbd><Kbd>K</Kbd><Kbd>P</Kbd><Kbd></Kbd><Kbd></Kbd>

Installation and imports

Install the editable registry source, or use the matching package entrypoint when the product keeps Nerio as a workspace dependency.

pnpm dlx nerio add kbdimport { Kbd } from '@nerio-ui/ui';

Usage

import { Kbd } from '@nerio-ui/ui';<Kbd>Esc</Kbd><Kbd>K</Kbd><Kbd>P</Kbd><Kbd></Kbd><Kbd></Kbd>

Variants

VariantUse
DefaultNeutral shortcut notation that adapts through tokens.

Anatomy

⌘K
ElementPurpose
kbdNative kbd element with quiet shortcut styling.

States

Esc
StateBehavior
DefaultStatic supplementary notation with no interactive state.

Motion

  • Kbd is static and does not animate.

Accessibility

  • Renders the native kbd element so shortcut notation retains semantic meaning.
  • Use Kbd as supplemental shortcut notation, not as the only way to discover a command.
  • When Kbd is displayed inside a named control, hide it from assistive technology to avoid repeating the action name.

API

PropTypePurpose
childrenReactNodeShortcut notation such as ⌘S, ⇧⌘P, or Esc.
classNamestringExtends the root while preserving tokenized defaults.
HTML attributesHTMLAttributes<HTMLElement>Passes native kbd attributes through.

Implementation contract

ContractValue
Registry itemkbd installs 3 source files into the configured components directory.
Base UINo interactive primitive required.
Registry dependenciesNone.
Package dependenciesclsx, react

Styling contract

ContractValue
AuthoringComplete, statically detectable Tailwind CSS v4 recipes own component visuals.
ValuesSemantic and component --n-* variables remain the canonical customization layer.
OverridesCustomizable slots merge consumer className values with tailwindCn so conflicting utilities resolve deterministically.
Residual CSSOnly shared keyframes and scoped no-Preflight compatibility rules remain; there is no parallel visual selector layer.

Design notes

  • Keep shortcut notation quiet so it supports, rather than competes with, the action label.

Do / do not

Do

Use beside familiar commands when a keyboard shortcut is available.

Do not

Use Kbd as an interactive control or a replacement for visible command labels.

Tokens

GroupTokensControls
Surface--n-kbd-background / --n-kbd-border-colorQuiet key surface and boundary.
Shape--n-kbd-border-width / --n-kbd-radiusBorder weight and corner radius.
Typography--n-kbd-foreground / --n-kbd-font-family / --n-kbd-font-size / --n-kbd-font-weightShortcut legibility and tone.
Spacing--n-kbd-padding-block / --n-kbd-padding-inlineInner key spacing.