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 exec 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

ElementPurpose
kbdNative kbd element with secondary text and an adaptive alpha-neutral surface.

States

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.

Review the shared responsibility and evidence boundaries in the Accessibility foundation alongside this component-specific contract. Use the Spacing & layout foundation for shared density, wrapping, overflow, reflow, and component-versus-product ownership guidance. The Color foundation, Typography foundation, and Localization foundation define the shared visual-role, text-resilience, direction, and locale boundaries used by component examples.

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 with secondary text and an alpha-neutral surface that adapts to its background.

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-colorAdaptive alpha-neutral key surface and quiet 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-weightSecondary shortcut text, legibility, and tone.
Spacing--n-kbd-padding-block / --n-kbd-padding-inlineInner key spacing.