shadcn.io is not affiliated with official shadcn/ui
Kbd examples · With Icons
Unicode Symbols Kbd for React
Enter, Delete and Tab keys with a Unicode symbol before each name.
Key symbols don't need an icon library: Unicode has them. This React example shows ↵ Enter, ⌫ Delete and ⇥ Tab as three Kbd caps in a row, each symbol typed straight into the text before the key's name.
Preview
Installation
FAQ
Why Unicode symbols instead of icons?
They're plain text: no import, no extra markup, and they take the cap's font, size and color. They also work anywhere text does, like Markdown docs or a plain-text tooltip.
Which Unicode symbols are standard for keys?
⌘ Command (U+2318), ⌥ Option (U+2325), ⌃ Control (U+2303), ⇧ Shift (U+21E7), ↵ Return (U+21B5), ⌫ Delete (U+232B), ⇥ Tab (U+21E5) and ⎋ Escape (U+238B), plus the arrows ← ↑ → ↓.
Do the symbols look the same everywhere?
Not quite: each comes from whatever font has it, so its size and weight vary between systems. If they must match exactly, use icons, as the Enter with Icon example does.
Do screen readers read the symbols?
Inconsistently: some say the Unicode name, some skip the symbol. Here the key name follows each symbol, so the meaning gets through either way.
Related
- Enter with Icon KbdAn Enter key with a return arrow icon
- Delete with Icon KbdA Del key with a delete icon before its
- Command with Icon KbdA Command K shortcut with the Command key
- Special Keys KbdThe Esc, Tab and Enter keys in a row
- Arrow Keys with Icons KbdUp, down, left and right arrow keys drawn
- Arrow Keys Cross Pattern KbdFour arrow keys in the inverted T of a