Skip to content

React Badge

A React badge is a small glass label for status and counts that stays readable on any background and never relies on color alone. Use Badge as a status badge next to a table row or card title, such as Paid, Draft or Beta, where one short word explains the state at a glance.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/badge.json

Invoice #1042

$1,240.00Pending

Tones

DraftNewActivePendingFailedProLive

Files to copy

3 folders · 2 files · 4 packages
From theme/src/
  • components/badge/
  • lib/{cn.ts, warn-once.ts}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/badge.jsonRegistry item: badge. The styles need the Tailwind v4 glass UI setup.
The examples also use
  • components/button/
  • components/spinner/
  • hooks/{use-latest.ts, use-magnetic.ts, use-media-query.ts, use-preferences.ts}
  • motion/{gate.ts, tokens.ts}
  • lib/{form.ts, state-light.tsx}
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/button.json
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

Counts and inline status

Badges sit beside the thing they describe: a count on a button, a status next to a name.

Production deploy Passing

Billing Past due

3 failed

Props

PropTypeDefaultDescription
tone"neutral" | "accent" | "success" | "warning" | "danger" | "solid""neutral"Colour role: "neutral" (glass), "accent", "success", "warning" or "danger". "solid" still works but is deprecated: it means variant="solid" and logs a development warning once.
variant"solid" | "soft""soft"Visual form: "soft" (the tone's tint) or "solid" (the filled accent gradient; it ignores tone).
dotbooleanfalseSmall dot before the text, e.g. for statuses.
pulsebooleanfalsePulsing dot for live states. Pings a few times, then rests; still with reduced motion.

Keyboard

KeysAction
TabNot focusable: a Badge is not interactive. Put it inside a button or link if it should be.

Accessibility

  • A badge always carries words, so color is never the only signal; the dot is aria-hidden.
  • The tint sits on a near-opaque surface, so text keeps 4.5:1 contrast over glass or photos.
  • The pulse stops after four pings (WCAG 2.2.2) and is off under reduced motion.

When to use Badge

  • Use Badge on an invoice list or a project card to label an item Paid, Draft or Beta in one short word, with a dot or an icon beside it so the state never rests on color alone.
  • Use it for a count beside a navigation item, for example 3 new beside Inbox, and choose the accent or solid tone to separate it from neutral labels.
  • Use the dot and pulse props for a live state like a running deploy or an active stream; the ping runs a few times then rests, and stays still under reduced motion.
  • Skip it when the label must be clicked, toggled or removed. A Badge takes no focus, so use Button for an action or Toggle for a pressed state instead.
  • Pair it with Avatar for a role under a name, DataTable cells for status columns, and Progress when a state needs a number and not only a word.

Frequently asked questions

67 components pages in all: browse them on All components.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .