Keyboard keys
Keys printed as keys, in either the HTML or the component form.
authoring/components1 min read
- #authoring
- #components
- #accessibility
A key renders as a key cap: Ctrl + K opens the command menu, / focuses the sidebar filter, Esc closes whatever is open.
Both forms work and render identically. A <kbd> typed into the document is
passed through as HTML, and the cap is styled on the element rather than on the
component, which is what keeps the two the same:
mdx
Writing shortcuts
- One key per element, with the separator as ordinary text: Ctrl + Shift + P, not a single cap reading
Ctrl+Shift+P. - Name the platform when it differs: Ctrl on Linux and Windows, Cmd on macOS.
- Spell the keys as the keyboard does, so Esc, Enter, Tab, Home, End, and use the arrows for arrows: ← ↑ ↓ →.
- A key is not inline code.
Ctrlin backticks is a string; Ctrl is a key.
Props
<Kbd> takes no props of its own; anything passed goes to the underlying
element.
Related entries
authoring2 min
Callouts
Semantic notices for a caveat, a tip or a danger, with the five types and when each is honest.
authoring2 min
Tabs
One panel per alternative, with keyboard navigation and a shared choice across the document.
authoring2 min
Steps
A numbered procedure whose rail survives the code blocks inside it.