Skip to content

Data display

Kbd

Kbd shows keyboard keys the way people see them on their keyboard: a small keycap with a firmer bottom edge. KbdCombo strings keys into chords like ⌘ K or Ctrl + K and sequences like G then I. Symbol keys get a spoken name, so a screen reader says "Command" instead of reading out a glyph.

On this page

Keyboard shortcuts

Search everything
CommandK
New invoice
C
Go to inbox
GthenI
Save draft
CommandS
Toggle sidebar
CommandShiftB
Close panel
Esc

Usage

components/ui/kbd.tsx
import { Kbd, KbdCombo } from "@/components/ui/kbd"; <KbdCombo keys={["⌘", "K"]} /><Kbd>Esc</Kbd>

Examples

Overview

Keyboard shortcuts

Search everything
CommandK
New invoice
C
Go to inbox
GthenI
Save draft
CommandS
Toggle sidebar
CommandShiftB
Close panel
Esc

Keys and sizes

sm (20 px) for inline text and menus, md (24 px) for help pages and onboarding. Symbol keys carry a spoken name and a tooltip.

CommandShiftOptionControlEnterBackspaceEscTabK
CommandUp arrowDown arrowSpaceEnter

Combinations

Chords sit side by side (Mac style) or with a plus (Windows style). Sequences say "then" between keys.

CommandKCtrl+KCommandShiftPGthenICommandEnter

Inline and in a field

Keys sit on the text baseline, so they work mid-sentence and as a hint inside a search trigger.

Press CommandK to search, or / to filter this list. Use Up arrow Down arrow to move and Enter to open.

Search invoices…CommandK

Props

Kbd

  • childrenrequiredReactNodedefault: —Key label: a letter, a word (Esc, Tab) or a symbol (⌘ ⇧ ⌥ ⌃ ↵ ⌫ ↑ ↓).
  • size"sm" | "md"default: "sm"20 or 24 px tall.
  • classNamestringdefault: —Extra classes, such as margins.

KbdCombo

  • keysrequiredstring[]default: —Keys in order.
  • separator"none" | "plus" | "then"default: "none"Chord side by side, chord with +, or a sequence.
  • size"sm" | "md"default: "sm"Size of every key.

Accessibility

  • Keys render as kbd elements; a combination is a kbd wrapping one kbd per key, as the HTML spec describes for key input.
  • Symbol keys (⌘ ⇧ ⌥ ⌃ ↵ ⌫ ⇥ and arrows) are read by name ("Command", "Shift"), with the glyph hidden from screen readers and the name in a tooltip.
  • Kbd is not interactive. If a shortcut also has a button, the button is the accessible way to trigger it; show the shortcut as a hint.
  • Show the modifier for the user's platform (⌘ on macOS, Ctrl elsewhere) when you know it.

Suggested