Skip to content

Components · Typography

Kbd

Keyboard shortcut hint.

@rookcom/monarch-reactComponent

Shortcut

⌘ K

Usage examples

The example at the top of the page is the only one for this component.

Purpose

Shows a keyboard key or shortcut, e.g. ⌘K.

Use when

  • Hinting a shortcut in a menu, tooltip or help text.

Design principles

  • Semantic: renders a native <kbd> element.

API reference

import { Kbd } from '@rookcom/monarch-react';
ExportKindRenderingRoot class
Kbdcomponentserver-safe.mn-kbd

Native <kbd> attributes pass through.

Generated from the TypeScript declarations of packages/react/src/components/typography/kbd.

Properties

Kbd

A keyboard key or shortcut, e.g. <Kbd>⌘K</Kbd>.

PropTypeDescription
childrenReactNode
classNamestring
idstring

Variants

Kbd has no variants.

States

No states: it renders static content.

Interaction behaviour

Not interactive.

Keyboard support

Not interactive; it only displays a key.

Accessibility

  • Screen readers read the key text; spell out symbols nearby if they are not obvious.

Responsive behaviour

  • Inline element; no breakpoints.

Theme support

  • Border, surface and text use Monarch semantic tokens.

Do and don't

Do

  • Use one Kbd per key in a combination.

Don't

  • Do not use Kbd for code snippets; use <code>.

Dependencies

KindDepends on
npm packagesNone
Monarch componentsNone

Testing coverage

  • Renders a <kbd> element.
CheckCovered
Axe in jsdomYes
Server renderingYes
Browser suitesVisual baselines: /__gallery

Tests: packages/react/src/components/typography/kbd