Kbd
kbd with one key name per parameter to display a semantic key sequence. Instructions remain readable in print and Markdown.Use keys to show shortcuts and chords separately from prose. Supply one positional parameter per key. The theme draws keycaps, adds separators, and gives screen readers a readable sequence. Use inline code for command names, flags, and text to type. They are not physical keys.
Shortest form
Press Ctrl with K to open the command palette.
Quote each positional parameter and use one parameter per key. Missing, empty, or named parameters warn. Ordinary previews do not render invalid keys. Review the warning and rendered fallback before publication.
A single key
Each parameter represents one key. Write symbol keys as displayed on the keyboard.
Escape closes a dialog; / jumps to search; t toggles light and dark; l cycles through languages.
Chords
Multiple parameters display in order, separated by +.
Assistive technology receives a localized connector instead of the visible plus sign.
⌘ with Shift with P and Ctrl with Shift with P are the same action. For a literal plus, treat it as a key of its own: Ctrl with + zooms the page in.
Platform differences
Use the reader’s keyboard labels: ⌘ on macOS and Ctrl on Windows and Linux.
Never combine platform labels in one sequence. Labels such as Ctrl/⌘ cannot be read aloud correctly.
Name the platform in the sentence or use tabs.
On macOS press ⌘ with K; on Windows and Linux, Ctrl with K.
Shortcut tables
Keys are common in cheatsheets. This table shows some global keys that the site supports:
| Key | Action |
|---|---|
| Ctrl with K | Open the command palette (⌘ with K on macOS) |
| / | The palette’s full search state |
| t | Toggle light and dark |
| q / e | Previous / next page |
| w s a d | Move, collapse and expand in the sidebar tree |
| Escape | Leave the sidebar tree for the article |
The complete list of site-wide shortcuts is in keyboard navigation.
In steps
- Press Ctrl with K to open the command palette
- Type
>for the command-only state, or type a keyword to search - Select with ↑ ↓ and press Enter to go
- Escape closes it and focus returns where it was
Raw <kbd> tags
Raw <kbd> tags get the same styles, and GitHub also displays them.
With raw tags, you maintain separators and accessible sequences yourself. Either form works for single keys. Use the shortcode for chords.
Press F5 to reload. In an editor, Ctrl+S saves.
Output
| Output | Shape |
|---|---|
| HTML | <span class="td-kbd-sequence"> around one <kbd> per key; the visible + is hidden from screen readers, which get a localized connector |
| Same as HTML, static | |
| Markdown | Plain text: Ctrl + K, ⌘ + Shift + P |
| RSS | Same as print |
The instruction remains readable without CSS or JavaScript.
Parameter reference
Only positional parameters are supported. There is no separator, label, platform, class, or size parameter.
Hugo cannot combine positional and named parameters in one shortcode call.
Limits
- Each sequence represents keys pressed together. For consecutive keys, use two
kbdcalls and describe the order: press Escape, then Enter. - There is no platform detection. The page never replaces
Ctrlwith⌘based on the visitor’s operating system. - There is no key mapping or recording. Menu paths, gestures, and gamepads are outside the scope.
- Missing quotes fail the build.
Ctrlin{{< kbd Ctrl K >}}is not a string parameter. - Do not use keys for commands.
hugo serveris inline code;Ctrlis a key.
Related
- Keyboard navigation — the full shortcut list and its switches
- Command palette — what Ctrl with K opens
- Badges — the other inline shortcode
- Steps — the container for instructions