Badge shows a short label or status next to other content. It is a server component and works without JavaScript. It has soft state variants, icons, a status dot, three sizes, a link form, a removable tag and a round counter.
Preview
PublishedLivePendingNew
Installation
Usage
import { Badge } from "@/components/ui/badge"
<Badge variant="success">Published</Badge>Examples
States
Soft background, same-hue text and a thin border.
defaultsecondaryoutlinedestructivesuccesswarninginfoneutral
<Badge variant="default">default</Badge>
<Badge variant="secondary">secondary</Badge>
<Badge variant="outline">outline</Badge>
<Badge variant="destructive">destructive</Badge>
<Badge variant="success">success</Badge>
<Badge variant="warning">warning</Badge>
<Badge variant="info">info</Badge>
<Badge variant="neutral">neutral</Badge>With an icon
An svg child gets the right size and spacing. Put it on either side.
PublishedPending4.9+12%Read the docs
import { ArrowUp, Check, Star, TriangleAlert } from "lucide-react"
<Badge variant="success"><Check />Published</Badge>
<Badge variant="warning"><TriangleAlert />Pending</Badge>
<Badge variant="secondary"><Star />4.9</Badge>
<Badge variant="success"><ArrowUp />+12%</Badge>
<Badge variant="outline">Read the docs<ArrowUp className="rotate-45" /></Badge>Status dot
The dot takes the text color. pulse adds a ring that stops under reduced motion.
OnlineLivePendingNeutralInfo
<Badge variant="success" dot>Online</Badge>
<Badge variant="destructive" dot="pulse">Live</Badge>
<Badge variant="warning" dot>Pending</Badge>Sizes
SmallDefaultLarge
<Badge size="sm" variant="info">Small</Badge>
<Badge variant="info">Default</Badge>
<Badge size="lg" variant="info">Large</Badge>Link badge
asChild gives the badge styles to a link or a button and adds hover and focus.
<Badge asChild variant="info">
<a href="/docs">Read the docs</a>
</Badge>
<Badge asChild variant="outline">
<button type="button"><Star />Star</button>
</Badge>Removable tags
BadgeRemove is a plain button. Handle removal in your own client component.
ReactTypeScriptTailwindNext.js
"use client"
import { useState } from "react"
import { Badge, BadgeRemove } from "@/components/ui/badge"
export function TagFilters() {
const [tags, setTags] = useState(["React", "TypeScript", "Tailwind"])
return tags.map((tag) => (
<Badge key={tag} variant="secondary" size="lg">
{tag}
<BadgeRemove
aria-label={`Remove ${tag}`}
onClick={() => setTags((p) => p.filter((x) => x !== tag))}
/>
</Badge>
))
}Counter
BadgeCount is a round counter. Position it over an icon or a button.
399+
import { Bell } from "lucide-react"
import { BadgeCount } from "@/components/ui/badge"
<span className="relative inline-flex">
<Button variant="outline" size="icon" aria-label="Notifications">
<Bell />
</Button>
<BadgeCount count={128} className="absolute -top-2 -right-2" />
</span>Status in a card and a table
Invoices
Payment status for the last orders
| Order | Status |
|---|---|
| #1042 | Paid |
| #1043 | Pending |
| #1044 | Cancelled |
<Card>
<CardHeader><CardTitle>Invoices</CardTitle></CardHeader>
<CardContent>
<table>
<tr><td>#1042</td><td><Badge variant="success" dot>Paid</Badge></td></tr>
<tr><td>#1043</td><td><Badge variant="warning" dot>Pending</Badge></td></tr>
<tr><td>#1044</td><td><Badge variant="destructive" dot>Cancelled</Badge></td></tr>
</table>
</CardContent>
</Card>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | string | default | Visual style: default, secondary, outline, destructive, success, warning, info, neutral, beta, draft, experimental. |
| size | "sm" | "default" | "lg" | default | Size of the badge. |
| dot | boolean | "pulse" | false | Status dot before the text. pulse adds a pulsing ring. |
| asChild | boolean | false | Render the only child (a, button) with badge styles. The dot is not added in this mode. |
| className | string | - | Extra CSS classes. |
| BadgeRemove aria-label | string | Remove | Accessible label of the cross button. |
| BadgeCount count | number | - | Number to show. Above max it renders as max+. |
| BadgeCount max | number | 99 | Upper limit before the plus sign. |