shadcn.io is not affiliated with official shadcn/ui
When the shortcut is the point, as in a feature highlight, an onboarding step or a tutorial, a default-size cap is too easy to miss. This React example sizes both keys of a ⌘K KbdGroup with h-8 min-w-8 px-2 text-base: 32 pixels tall, at least as wide, with body-size type.
Preview
Installation
FAQ
When should I use large key caps?
When the shortcut is the content rather than a hint beside it: a callout that teaches a shortcut, an onboarding screen, a cheat sheet, a slide. Next to a menu item or a button, the default size fits better.
What dimensions work for large key caps?
This example uses a 32-pixel height and minimum width with base-size text and a little more padding. Keep the height and minimum width equal so single characters stay square, and scale the text with them.
How do I use large key caps for visual hierarchy?
Use one large shortcut as the focal point and keep the rest of the page's shortcuts at the default size. Several large shortcuts compete with each other and the headings.
Are large key caps more accessible?
They're easier to read for people with low vision and from a distance. They don't change what screen readers hear, which is the text inside each cap.
Related
- Default KbdA ⌘K shortcut at the key cap's default
- Small KbdSmall ⌘ and K key caps, 16 pixels tall
- Extra Large KbdExtra large ⌘ and K key caps, 48 pixels
- Inline with Text Kbd⌘ and K keys inline in a sentence about
- Command Palette Shortcut KbdThe ⌘K shortcut that opens a command
- Arrow Keys Cross Pattern KbdFour arrow keys in the inverted T of a