Malevich

Elements / Interactive/

Kbd

Inline keyboard key indicator. Native .

Kbd

Inline keyboard key indicator. Uses the native <kbd> element for semantic correctness; screen readers may announce its content as a key press depending on the user agent.

When to use

Use a <kbd> whenever documenting a keyboard shortcut, key combination, or hotkey in prose, tables, or tooltips.

For chord shortcuts, chain <kbd> elements with a literal separator (+, -, or a non-breaking space). The component does not own the separator — the consumer authors it explicitly so the rendered combo matches the convention of the surrounding documentation.

Variants

Variant Class Use for
Default .kbd Standard inline key indicator
Muted .kbd.-muted De-emphasized (within muted text runs)
Strong .kbd.-strong Inverted, for high contrast contexts

Anatomy

<kbd class="kbd">⌘</kbd>
<kbd class="kbd">Enter</kbd>
<kbd class="kbd -muted">Esc</kbd>
<kbd class="kbd -strong">Tab</kbd>

<!-- Combo -->
<kbd class="kbd">⌘</kbd>+<kbd class="kbd">K</kbd>

<!-- Three-key combo -->
<kbd class="kbd">⌘</kbd>+<kbd class="kbd">Shift</kbd>+<kbd class="kbd">P</kbd>

Tokens used

From semantic tier

Accessibility

<kbd> carries an implicit role and is the correct semantic element for keyboard input.

The component sets user-select: none so accidental selection during prose copying does not include the key indicator markup. Authors who need users to copy the key text (e.g. a tutorial that asks readers to paste a shortcut name) should override this with a local style.

The component does NOT default to data-copyable="true". Copying a keyboard shortcut name is rare and the copy button would clutter inline prose. Authors who want copy support opt in explicitly: <kbd class="kbd" data-copyable="true">⌘K</kbd>.

Edge cases

Do

Don't