Badge
Pills with unmistakable tones — nine variants, three sizes, status dots, and removable filter chips.
Installation#
pnpm dlx shadcn@latest add @davinciui/badgeUsage#
Badges are pills, not boxes — fully rounded with tabular numerals so counts never jitter. Tones carry border, surface, and text together; dots inherit the tone automatically. Dismiss buttons stop propagation so chips inside clickable rows stay safe.
Badge ├── BadgeDot └── (dismiss button via onRemove)
API Reference#
| Prop | Type | Default |
|---|---|---|
variantTone. Semantic tones shift border, surface, and text together. | "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | "info" | "success" | "warning" | "default" |
sizeDensity of the pill. | "sm" | "default" | "lg" | "default" |
onRemoveRenders a dismiss button for filter chips. Ignored with asChild. | () => void | — |
removeLabelAccessible label for the dismiss button. | string | "Remove" |
pulsePing animation behind the dot (BadgeDot). | boolean | false |
asChildRender as a link or custom element via Slot. | boolean | false |
classNameAdditional CSS classes. | string | — |
Accessibility#
The badge is a span unless asChild renders a link; the removable chip adds a native button labelled by removeLabel and stops click propagation. Focus-visible rings are present, but BadgeDot is aria-hidden, so status needs adjacent text.
Motion#
BadgeDot with pulse renders an animate-ping halo; all other motion is a color transition. There is no prefers-reduced-motion check, so the ping continues when reduced motion is requested.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

