Measured entry

shadcn-kbd

badgeunclassified

A small copy-in React component for rendering keyboard keys and grouped shortcuts. It ships through the shadcn registry as Tailwind-styled source, uses the project cn helper, and relies on clsx, tailwind-merge, and shadcn-style semantic color tokens rather than a runtime provider.

Specimen
Harness screenshot of shadcn-kbd at 375 pixels wide
Harness screenshot at 375 pixels wide. No horizontal overflow recorded.
Harness screenshot of shadcn-kbd at 768 pixels wide
Harness screenshot at 768 pixels wide. No horizontal overflow recorded.
Harness screenshot of shadcn-kbd at 1440 pixels wide
Harness screenshot at 1440 pixels wide. No horizontal overflow recorded.

Measured

Every value below was written by the harness on the run that produced the frames above. None of it is derived from the prose.

Harness measurements recorded for shadcn-kbd
BuildOK
MountOK
Console errors0
Uncaught page errors0
Horizontal overflowclean at 375, 768, 1440
Axe critical0
Axe serious1
Axe moderate0
Axe minor0
Gzip marginal29.1 KB (94.6 KB build, 65.5 KB baseline)
Bare modeOK
Provider requiredNO
Demo usedwritten from the component source API

Verdict

A focused, low-complexity keycap primitive that builds and mounts without a provider. It is a sensible fit for shadcn-based interfaces, but the default muted styling needs a contrast review before production use.

Use it if

  • You need consistent keycap labels beside commands, menu items, or shortcut documentation.
  • Your React app already uses Tailwind and shadcn semantic theme tokens.
  • You want source-owned styling that can be adjusted locally without adopting a component runtime.

Skip it if

  • Your design system cannot accommodate Tailwind utility classes or shadcn semantic tokens.
  • You need an interactive shortcut recorder or keyboard event handling rather than a visual label.
  • You cannot revise the muted foreground styling, which triggered a serious color contrast finding in the tested demo.

Install

Installation record for shadcn-kbd
Declared dependenciesclsx, tailwind-merge
Missing on installnone
Bare installbuilds and mounts without the shadcn-style helpers
Providerno provider required in the harness

In a non-shadcn project, add Tailwind, define the muted and foreground theme tokens, provide a cn utility backed by clsx and tailwind-merge, and replace the source alias if your project does not map it. Adjust the muted text color to meet your contrast standard.

Source and credit

This page is a review, not a copy. The component source lives with its author and this site does not republish it. Read the license before you use anything.

Author repository

github.com/shadcn-ui/ui
License
MIT
Record published
2026-08-16

Alternatives

Other published entries for the badge pattern, ordered by what they measured: mounts first, then clean axe scans, then bare-mode passes, then the smaller bundle.