Skip to content

Kbd

Use 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

Source
Press {{< kbd "Ctrl" "K" >}} to open the command palette.

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.

Source
{{< kbd "Escape" >}} closes a dialog;
{{< kbd "/" >}} jumps to search;
{{< kbd "t" >}} toggles light and dark;
{{< kbd "l" >}} cycles through languages.

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.

Source
{{< kbd "⌘" "Shift" "P" >}} and {{< kbd "Ctrl" "Shift" "P" >}} are the same action.
For a literal plus, treat it as a key of its own: {{< kbd "Ctrl" "+" >}} zooms the page in.

⌘ 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.

Source
On macOS press {{< kbd "⌘" "K" >}}; on Windows and Linux, {{< kbd "Ctrl" "K" >}}.

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:

Source
| Key | Action |
| --- | --- |
| {{< kbd "Ctrl" "K" >}} | Open the command palette ({{< kbd "⌘" "K" >}} on macOS) |
| {{< kbd "/" >}} | The palette's full search state |
| {{< kbd "t" >}} | Toggle light and dark |
| {{< kbd "q" >}} / {{< kbd "e" >}} | Previous / next page |
| {{< kbd "w" >}} {{< kbd "s" >}} {{< kbd "a" >}} {{< kbd "d" >}} | Move, collapse and expand in the sidebar tree |
| {{< kbd "Escape" >}} | Leave the sidebar tree for the article |
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

Source
1. Press {{< kbd "Ctrl" "K" >}} to open the command palette
1. Type `>` for the command-only state, or type a keyword to search
1. Select with {{< kbd "↑" >}} {{< kbd "↓" >}} and press {{< kbd "Enter" >}} to go
1. {{< kbd "Escape" >}} closes it and focus returns where it was
{.steps}
  1. Press Ctrl with K to open the command palette
  2. Type > for the command-only state, or type a keyword to search
  3. Select with ↑ ↓ and press Enter to go
  4. 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.

Source
Press <kbd>F5</kbd> to reload; in an editor, <kbd>Ctrl</kbd>+<kbd>S</kbd> saves.

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
Print 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

Positional 1..n , string , default—
At least one; each must be non-empty and quoted; order is display order

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 kbd calls and describe the order: press Escape, then Enter.
  • There is no platform detection. The page never replaces Ctrl with ⌘ 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. Ctrl in {{< kbd Ctrl K >}} is not a string parameter.
  • Do not use keys for commands. hugo server is inline code; Ctrl is a key.