Display
Kbd
A key on a keyboard, set as one.
Examples
default
Press ⌘ K to open the palette, or Esc to close it.
Notes
A key on a keyboard, set as one.
Renders a <kbd>, which is the element that means this — a <span> styled to look like a key tells a screen reader nothing. Sized in em so it tracks whatever type it sits beside rather than fixing itself at one px value, which is how the same shortcut ended up three different sizes across a page.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| childrenrequired | ReactNode | — |
Also accepts everything in HTMLAttributes<HTMLElement>. Those are forwarded to the underlying element and are not listed row by row.
Accessibility
- Renders <kbd>, which carries the meaning a styled <span> does not.