Components
Displays a badge or a component that looks like a badge.
Playground
Badge renders an inline span — drop it next to headings, table cells or list items to label status, counts or metadata. Pick a style with the variant prop.import { Badge } from "@workspace/ui/components/badge"
<Badge>Badge</Badge>
<Badge variant="secondary">Secondary</Badge>
<Badge variant="destructive">Destructive</Badge>
<Badge variant="outline">Outline</Badge>default uses the brand primary, secondary and outline stay neutral, destructive tints with --destructive, and ghost and link are transparent until hovered.<Badge>Default</Badge> <Badge variant="secondary">Secondary</Badge> <Badge variant="destructive">Destructive</Badge> <Badge variant="outline">Outline</Badge> <Badge variant="ghost">Ghost</Badge> <Badge variant="link">Link</Badge>
text-xs, so 4.5:1 is the bar, not the 3:1 that applies to large text. Prefer these over hand-pairing a semantic colour with an alpha tint of itself: an alpha tint composites against whatever sits behind it, so the same pair can pass on one surface and fail on another.<Badge variant="success">Pago</Badge> <Badge variant="warning">Pendente</Badge> <Badge variant="danger">Vencido</Badge> <Badge variant="neutral">Rascunho</Badge>
data-icon="inline-start" or data-icon="inline-end" — the badge tightens the padding on that side automatically.import { BookmarkSimpleIcon, SealCheckIcon } from "@phosphor-icons/react"
<Badge variant="secondary">
<SealCheckIcon data-icon="inline-start" />
Verified
</Badge>
<Badge variant="outline">
Bookmark
<BookmarkSimpleIcon data-icon="inline-end" />
</Badge>Spinner in for loading states — remember the data-icon attribute so the padding adjusts like it does for icons.import { Spinner } from "@workspace/ui/components/spinner"
<Badge variant="destructive">
<Spinner data-icon="inline-start" />
Deleting
</Badge>
<Badge variant="secondary">
Generating
<Spinner data-icon="inline-end" />
</Badge>asChild prop to render the badge as your own element — an anchor keeps the badge styling and gains the variant's [a]:hover treatment.<Badge asChild>
<a href="#link">
Open Link <ArrowUpRightIcon data-icon="inline-end" />
</a>
</Badge>dark: counterparts.<Badge className="bg-green-100 text-green-700 dark:bg-green-950 dark:text-green-300"> Green </Badge> <Badge className="bg-orange-100 text-orange-700 dark:bg-orange-950 dark:text-orange-300"> Orange </Badge> <Badge className="bg-purple-100 text-purple-700 dark:bg-purple-950 dark:text-purple-300"> Purple </Badge> <Badge className="bg-beige-100 text-beige-700 dark:bg-beige-950 dark:text-beige-300"> Beige </Badge>
dir="rtl" on a wrapper or inherit it from a Direction provider — icon paddings use logical properties (ps/pe), so inline-start and inline-end flip automatically.<div dir="rtl" className="flex flex-wrap gap-2">
<Badge>شارة</Badge>
<Badge variant="secondary">
<SealCheckIcon data-icon="inline-start" />
متحقق
</Badge>
<Badge variant="outline">
إشارة مرجعية
<BookmarkSimpleIcon data-icon="inline-end" />
</Badge>
</div>Badge renders a span (or its child via asChild) and accepts all of the matching HTML props.| Prop | Type | Default |
|---|---|---|
| variant | "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | "default" |
| asChild | boolean | false |
| className | string | — |
Tokens used
29 design tokens consumed by the Badge component.
--status-success
Status Success
--status-success-foreground
Status Success Foreground
--status-success-hover
Status Success Hover
--status-success-border
Status Success Border
--status-warning
Status Warning
--status-warning-foreground
Status Warning Foreground
--status-warning-hover
Status Warning Hover
--status-warning-border
Status Warning Border
--status-danger
Status Danger
--status-danger-foreground
Status Danger Foreground
--status-danger-hover
Status Danger Hover
--status-danger-border
Status Danger Border
--status-neutral
Status Neutral
--status-neutral-foreground
Status Neutral Foreground
--status-neutral-hover
Status Neutral Hover
--status-neutral-border
Status Neutral Border
--primary
Primary
--primary-foreground
Primary Foreground
--secondary
Secondary
--secondary-foreground
Secondary Foreground
--destructive
Destructive
--border
Border
--foreground
Foreground
--muted
Muted
--muted-foreground
Muted Foreground
--ring
Ring
--radius-4xl
Radius 4XL (radius × 2.6)
--text-xs
Text Extra Small (12px)
--spacing
Spacing unit (4px)