Badge
Compact label for status, category, or count. Same variant set as button.
A badge is a small label attached to a piece of content. Use one when you need to call attention to category, status, count, or a tag value without the weight of a button.
Badges share the button's variant vocabulary so the two compose visually. A primary badge on a primary button reads as a coherent system rather than two separate decisions.
Variants
| Variant class | Use for | shadcn equivalent |
|---|---|---|
badge | Default outlined treatment. | badge (outline) |
badge-primary | "New," "Beta," "Live." Calls attention. | badge-primary (default) |
badge-muted | "Draft," "Archived." Soft, present-but-quiet. | badge-secondary |
badge-ghost | Inline metadata where a chip is too loud. | badge-ghost |
badge-link | A badge that's also a link (<a> element). | n/a |
export default function BadgeVariants() { return ( <div className="flex flex-wrap items-center gap-2"> <span className="badge">Category</span> <span className="badge badge-primary">New</span> <span className="badge badge-muted">Draft</span> <span className="badge badge-ghost">Inline</span> <a className="badge badge-link" href="#"> Posts </a> </div> );}Icon-only
The badge-minimal modifier makes a square icon-only badge. Useful for dots, status indicators, or kebab-menu triggers.
export default function BadgeMinimal() { return ( <span className="badge badge-minimal" aria-label="More actions"> <span className="badge-icon"> <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" > <circle cx="12" cy="12" r="1" /> <circle cx="12" cy="5" r="1" /> <circle cx="12" cy="19" r="1" /> </svg> </span> </span> );}Anatomy
<span class="badge">
<span class="badge-icon"><!-- optional leading icon --></span>
<span class="badge-label">Label</span>
<span class="badge-icon"><!-- optional trailing icon --></span>
</span>| Part | Class | Notes |
|---|---|---|
| Root | badge | A <span>, <a>, or <button> element. Required. |
| Variant | badge-primary, badge-muted, badge-ghost, badge-link | Optional. Apply at most one. |
| Modifier | badge-minimal | Square icon-only treatment. |
| Icon | badge-icon | One or two, leading and trailing as needed. |
| Label | badge-label | The visible text. Uses --font-size-xs for compactness. |
Tokens
| Property | Token / value |
|---|---|
| Height | --step-6 |
| Padding (inline) | --step-2 |
| Gap | --step-1_5 |
| Border | 1px solid var(--border) (default), variant-dependent elsewhere |
| Radius | --radius-badge (defaults to --radius-full, capsule) |
| Background (default) | transparent |
| Background (primary) | --primary → text --primary-foreground |
| Background (muted) | --muted with --faded border → text --foreground |
| Background (ghost) | transparent → hover paints --muted |
| Background (link) | transparent → hover sets text to --primary |
| Font (root) | family --font-body, size --font-size-sm, weight --weight-body, line-height 1 |
| Font (label) | size --font-size-xs |
| Hover | --muted background on default; opacity drop on primary and muted |
| Active | opacity: 0.8 (link also adds text-decoration: underline) |
| Focus-visible | box-shadow: var(--focus-ring) (apply via the ring utility class) |
Override --radius-badge to swap the default capsule shape for square chips (--radius-sm) or matched-to-button corners (--radius-md). See Foundations → Radius.
States
Static badges don't carry interactive states. Clickable badges (root is <a> or <button>, often with badge-link) inherit the same hover, active, and focus-visible behavior as button.
Accessibility
- Static badges (decorative labels) don't need ARIA. Use plain
<span>. - Clickable badges should be
<a>(navigation) or<button>(action). Applybadge-linkfor the visual treatment. - A badge that conveys live status (e.g., "Live now") should sit inside a region with
aria-live="polite"if it changes dynamically. - Color alone shouldn't carry meaning. Pair color with an icon or label for success/warning/error badges.
- For
badge-minimal, setaria-labelon the root.
Cross-platform
| Platform | Reference |
|---|---|
| Figma | Zazz v0.4.4 → badge (component_set) |
| Webflow | badge class with badge-{variant} modifier |
| CSS / Tailwind | The same classes after installing utilities.css |