On this page

Kbd

What Kbd gives you and what your team does.

Conformance

Kbd meets WCAG 2.2 level AA when used as described on these pages.

Keyboard

Kbd is not interactive and takes no focus.

What Kbd gives you

  • The native <kbd> element, which marks keyboard input.
  • Key text at least 7:1 on its fill in both themes (color.text.subtle on color.background.neutral).

What your team does

  • Hide the “+” between keys from screen readers (aria-hidden="true"); they read each key.
  • When a symbol stands for a key (⌘, ⇧), add its name for screen readers: <Kbd><span aria-hidden="true">⌘</span><span class="sr-only">Command</span></Kbd>.
  • Make sure every shortcut you list also works without the keyboard, through a visible control (WCAG 2.1.4 lets people turn off single-key shortcuts).

WCAG criteria

Criterion Level How
1.1.1 Non-text Content A Symbol keys have a name
1.4.3 Contrast (Minimum) AA Key text at least 7:1
2.1.4 Character Key Shortcuts A Your team lets people turn off or remap single-key shortcuts