Badge
Badge is a compact, pill-shaped status label with six color variants (default, secondary, outline, success, warning, destructive) and two sizes. It can add a leading status dot, a pulsing ring around that dot, or a looping light shine sweep across the label.


shadcn add · no workarounds · theme neutral (none shipped)Installation
Requires @glint-ui in the registries of your components.json (shadcn adds official directory namespaces automatically).
Usage
import { Badge } from "@/components/ui/badge";<Badge variant="success" dot>Online</Badge>- Show a compact status, state, or category label such as Active, Draft, Paid, or Beta next to a title, row, or card.
- Mark a live or online state with the dot and pulse props, for example a Live or Online indicator.
- Add a subtle eye-catching shine to a promotional or new-feature label such as New or Pro, without a heavy animation.
- Use the success, warning, and destructive variants to convey semantic meaning, and outline or secondary for neutral tags.
Examples
Status with a leading dot
A success badge with a static dot to show an active state.
import { Badge } from "@/components/ui/badge";export function StatusExample() { return <Badge variant="success" dot>Active</Badge>;}Live indicator with pulse
The pulse prop implies the dot, so the ring animation is shown around it. It respects reduced-motion preferences.
import { Badge } from "@/components/ui/badge";export function LiveExample() { return <Badge variant="destructive" pulse>Live</Badge>;}Small shiny promo label
A small warning badge with the shine sweep for a new or beta feature.
import { Badge } from "@/components/ui/badge";export function PromoExample() { return ( <Badge variant="warning" size="sm" shine> Beta </Badge> );}Badge inside a link
Badge renders a span, so it can be placed inside an anchor; it brightens on hover in that context.
import { Badge } from "@/components/ui/badge";export function LinkExample() { return ( <a href="/pricing" className="inline-flex items-center gap-2"> Pricing <Badge variant="secondary">Pro</Badge> </a> );}API reference
Accessibility
- The dot and pulse ring are wrapped in a span with aria-hidden, so screen readers only announce the label text.
- The pulse ping animation uses motion-reduce:hidden, and the shine sweep is disabled under prefers-reduced-motion: reduce.
- Color is not the only signal: always include a text label such as Active or Failed so the status is clear without relying on hue.
- Badge renders a span, not a button or link; pass role or aria attributes via props when the badge conveys a status that assistive technology must announce, for example role="status" for live updates.
- Ensure the text contrast of the variant colors meets WCAG AA against the surrounding background, especially the tinted success, warning, and destructive variants.
Docs written by anthropic:claude-haiku-5-5 from the registry source.
Use with Coding Agent
Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.
Use the "Badge" component (glint-ui/badge) from its shadcn registry.1. Install it with: npx shadcn@latest add @glint-ui/badge2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: variant, size, dot, pulse, shine, className, children, ...props.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { Badge } from "@/components/ui/badge";<Badge variant="success" dot>Online</Badge>```Files & dependencies
- registry/ui/badge.tsx