Badge
A short label for a status or a count. Renders a link or any element through render.
Installation
Or with the shadcn CLI, from the registry:
Usage
Variants
default filled, soft as a wash, outline as a border, secondary in grey, and destructive for errors (shorthand
for tone="destructive"). tone is the colour: primary by default, or neutral, success, warning, info,
destructive; outline stays neutral in primary.
NeutralPrimarySuccessWarningInfoDestructive
NeutralPrimarySuccessWarningInfoDestructive
NeutralPrimarySuccessWarningInfoDestructive
Sizes
sm, default and lg set the padding, the text and the icon.
SmallDefaultLarge
As a link
Villages
Its radius is --badge-radius: soft in Konoha, a pill in Kiri, square in Iwa, where it is also set in mono capitals.
Accessibility
- A
<span>: its text is read in place. A badge that only shows a count needs the thing counted in the text around it, or anaria-label.
API reference
The props of <span>, plus render (any element, through Base UI's useRender) and:
| Prop | Type | Default |
|---|---|---|
variant | "default" | "secondary" | "outline" | "soft" | "destructive" | "default" |
tone | "neutral" | "primary" | "success" | "warning" | "info" | "destructive" | "primary" |
size | "sm" | "default" | "lg" | "default" |
badgeVariants({ variant, tone, size }) returns the same classes.