Kbd
Use Kbd to distinguish literal keys and shortcuts from surrounding prose. It renders semantic HTML, remains readable in Markdown and print, and needs no JavaScript.
When to use
Use Kbd for keys the reader should press, including multi-key shortcuts. Use inline code for commands, option names, or text the reader should type; those are not physical or virtual keys.
Quick start
Source
Rendered result
Press Ctrl with K to open search. Use ⌘ with Shift with P to open the command palette, or press Alt with Enter to apply an action.
Interface
Kbd accepts one or more nonempty positional strings:
It has no named parameters. Quotes are required because every key must be a string. Missing keys, blank strings, named arguments, or non-string values stop the build with the source position.
Use the label printed on the relevant platform when the distinction matters. For cross-platform instructions, name the platform in prose instead of placing alternatives inside one key sequence.
Semantics and fallback
HTML contains one nested kbd element per key. Visual plus signs are hidden
from assistive technology; a localized word separates the keys for screen
readers. Markdown, print, and RSS use an unambiguous sequence such as
Ctrl + K. The instruction remains complete when CSS or JavaScript is absent.
Deliberate limits
Kbd represents simultaneous key sequences only. It does not model menus, gesture input, key remapping, platform detection, or an interactive shortcut recorder. Explain sequential actions in prose: “press Escape, then Enter.”