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.jsonInvoice #1042
$1,240.00Pending
Tones
DraftNewActivePendingFailedProLive
import { Badge } from "@/components/sheenui/badge/badge";
// Package build (after the first npm release, or a packed tarball): import { Badge } from "@sheenui/theme";
export function Example() {
return (
<>
<Badge>Draft</Badge>
<Badge tone="accent">New</Badge>
<Badge tone="success" dot>Active</Badge>
<Badge tone="warning" dot>Pending</Badge>
<Badge tone="danger" dot>Failed</Badge>
<Badge variant="solid">Pro</Badge>
<Badge tone="success" pulse>Live</Badge>
</>
);
}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 failedimport { Badge } from "@/components/sheenui/badge/badge";
import { Button } from "@/components/sheenui/button/button";
// Package build (after the first npm release, or a packed tarball): import { Badge, Button } from "@sheenui/theme";
// This example also uses button: npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/button.json
export function Example() {
return (
<>
<Button variant="glass">
Inbox <Badge tone="accent">12</Badge>
</Button>
<p className="flex items-center gap-2 text-sm">
Production deploy <Badge tone="success" dot>Passing</Badge>
</p>
<p className="flex items-center gap-2 text-sm">
Billing <Badge tone="warning" dot>Past due</Badge>
</p>
<Badge tone="danger">3 failed</Badge>
</>
);
}Props
Keyboard
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
Related pages
67 components pages in all: browse them on All components.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .