Kbd

A key cap for showing keyboard shortcuts in text, menus and tooltips. Renders a semantic <kbd>.

StableSource

Press Ctrl K to search.

Import

tsx
import { Kbd } from "@merid/react";

Examples

Sizes

md (default) sits in body text; sm fits inside menu items, tooltips and dense rows.

EscEsc

Chords

Render one Kbd per key and put the separator between them as plain text.

Ctrl + Shift + P

API reference

Kbd forwards its ref to the <kbd> and passes other HTML attributes through.

PropTypeDefaultDescription
size"sm" | "md""md"Size of the key cap.

Styling

HookValues
.mrd-kbdRoot <kbd>
data-sizesm · md

Accessibility

  • <kbd> is read as its text. Spell out symbols that screen readers pronounce poorly — prefer “Ctrl” over “⌃”, or add a VisuallyHidden name next to the glyph.
  • Kbd is not interactive; it documents a shortcut, it does not bind one.

Guidelines

Do

Use one cap per key, with the key names your users see on their keyboard.

Avoid

Put a whole shortcut like “Ctrl+Shift+P” inside a single cap.

  • Code — inline code and commands.
  • Text — the running text Kbd usually sits in.