Measured entry
shadcn-badge
A copy-in React and TypeScript badge primitive built from Tailwind utility classes. It renders a span by default, can delegate rendering through the Radix Slot, and exposes style variants through class-variance-authority. It also expects the shadcn cn helper and theme tokens.



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.
| Build | OK |
|---|---|
| Mount | OK |
| Console errors | 0 |
| Uncaught page errors | 0 |
| Horizontal overflow | clean at 375, 768, 1440 |
| Axe critical | 0 |
| Axe serious | 0 |
| Axe moderate | 0 |
| Axe minor | 0 |
| Gzip marginal | 14.2 KB (78.8 KB build, 64.6 KB baseline) |
| Bare mode | FAIL |
| Provider required | NO |
| Demo used | written from the component source API |
What the harness recorded
BARE BUILD
✗ Build failed in 954ms error during build: [vite]: Rollup failed to resolve import "class-variance-authority" from "<sandbox>/src/cut/components/ui/badge.tsx".
Verdict
A solid, compact choice inside a shadcn codebase, with useful variants and flexible child rendering. It builds and mounts in the configured harness, but the bare project fails, so it needs a shadcn-style setup before it is usable.
Use it if
- You need compact status, category, or metadata labels that follow an existing shadcn theme.
- You want selectable visual variants and the option to render a link or other child element through Radix Slot.
- Your team prefers source-owned components that can be adjusted locally instead of a packaged black box.
Skip it if
- Your project does not use Tailwind utilities or shadcn theme tokens and you do not want to recreate that styling layer.
- You need a standalone package that works without copied helpers and supporting dependencies.
- You need interactive selection, dismissal, or notification behavior rather than a small presentational label.
Install
| Declared dependencies | radix-ui |
|---|---|
| Missing on install | none |
| Bare install | fails once the shadcn-style helpers are removed, so it needs that setup |
| Provider | no provider required in the harness |
In a non-shadcn project, add radix-ui and class-variance-authority, provide the cn class-merging helper, configure Tailwind, and define the referenced theme colors, border, focus-ring, dark-mode, and state utilities. Preserve the path alias or replace that import with a local relative path.
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/uiAlternatives
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.
- neu-badgeneumorphism
- Renders
- YES
- A11y
- 0
- Gzip
- 17.5KB
- Bare
- pass
- Prov
- NO
- clay-badgeclaymorphism
- Renders
- YES
- A11y
- 0
- Gzip
- 17.9KB
- Bare
- pass
- Prov
- NO
- ruixen-load-rippleunclassified
- Renders
- YES
- A11y
- 0
- Gzip
- 17.9KB
- Bare
- pass
- Prov
- NO
- kibo-listminimal-flat
- Renders
- YES
- A11y
- 0
- Gzip
- 42.4KB
- Bare
- pass
- Prov
- NO
- ruixen-blurred-stagger-textunclassified
- Renders
- YES
- A11y
- 0
- Gzip
- 58.1KB
- Bare
- pass
- Prov
- NO
- tripled-auto-revealing-heading-shadcnuiminimal-flat
- Renders
- YES
- A11y
- 0
- Gzip
- 58.3KB
- Bare
- pass
- Prov
- NO