vert-ui
Browse docs
All components

Badge

Compact status label for counts, states and categories — pill-shaped with an optional status dot.

Install

Install the component

Add the source straight into your project with the shadcn CLI — no package dependency to track.

npx shadcn@latest add https://vert-ui.dev/r/badge.json

Preview

Live preview

defaultsecondaryoutlineghostsuccesswarningdestructive

Usage

Examples

Status with dot

OperationalDegradedOutage
<Badge dot variant="success">Operational</Badge>
<Badge dot variant="warning">Degraded</Badge>
<Badge dot variant="destructive">Outage</Badge>

Sizes

smmdlg
<Badge size="sm">sm</Badge>
<Badge size="md">md</Badge>
<Badge size="lg">lg</Badge>

Count badge next to a title

Open issues

12
<div className="flex items-center gap-2">
  <h3 className="font-semibold">Open issues</h3>
  <Badge variant="secondary">12</Badge>
</div>

Reference

Props

PropTypeDefaultDescription
variant"default" | "secondary" | "outline" | "ghost" | "warning" | "success" | "destructive""default"Visual role. warning/success/destructive map to the semantic status palettes.
size"sm" | "md" | "lg""md"Padding and type scale of the pill.
dotboolean—Prefixes a 6px status dot that inherits the badge color.
asChildboolean—Render the child element instead of a <span> — for linking a badge.
…native element attrsHTMLAttributes<HTMLElement>—title, aria-*, data-*, …

Accessibility

Accessibility notes

  • A badge is decorative by default — if it carries meaning the control nearby does not, add readable text or an aria-label.
  • Colour alone is insufficient: pair every status colour with a word ("Degraded", not just amber).
  • The dot span is visual only; screen readers rely on the badge text beside it.
  • Badges are not interactive — if it should be pressed, use a Button or a link with asChild.