Components
Badge
A small label for status, category or count.
Free
pnpm dlx shadcn@latest add @caliper/badgeWhen to use
Use it for
- Marking the state of a row, such as Paid or Failed.
- Adding a count or tag beside a title.
Skip it when
- The text is long; use a sentence.
- The label is clickable; use a button or chip.
Installation
terminal
pnpm dlx shadcn@latest add @caliper/badge
Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. No account needed. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage
This is the code behind the preview above.
example.tsx
import { type ReactNode } from "react" import { Badge } from "@/components/ui/badge" function Panel({ title, context, className = "max-w-md", children }: { title: string; context: string; className?: string; children: ReactNode }) { return ( <section className={`grid w-full gap-5 rounded-overlay border border-border bg-background p-4 shadow-resting sm:p-6 ${className}`}> <div className="grid gap-1"> <p className="font-medium">{title}</p> <p className="text-sm text-muted-foreground">{context}</p> </div> {children} </section> ); } type Service = { name: string; env: "Production" | "Staging" | "Preview"; status: ReactNode }; const envTone = { Production: "violet", Staging: "blue", Preview: "teal" } as const; const services: Service[] = [ { name: "Checkout API", env: "Production", status: <Badge variant="success">Healthy</Badge> }, { name: "Invoice export", env: "Production", status: <Badge variant="warning">Degraded</Badge> }, { name: "Search index", env: "Staging", status: <Badge variant="info">Syncing</Badge> }, { name: "Push notifications", env: "Preview", status: <Badge variant="error">Failed</Badge> }, { name: "Docs site", env: "Preview", status: <Badge variant="neutral" shape>Paused</Badge> }, ]; export function BadgeDemo() { return ( <Panel title="Northwind services" context="Deploy health across environments, 21 Oct 2026" className="max-w-lg"> <ul className="grid divide-y divide-border text-sm"> {services.map((s) => ( <li key={s.name} className="flex flex-wrap items-center gap-x-3 gap-y-1.5 py-2.5 first:pt-0 last:pb-0"> <span className="mr-auto min-w-0 truncate font-medium">{s.name}</span> <Badge tone={envTone[s.env]}>{s.env}</Badge> <span className="w-24">{s.status}</span> </li> ))} </ul> </Panel> ); }
API reference
Badge
component
Also accepts the native props of its root element and a ref.
PropTypeDefaultDescription
variant"neutral" | "success" | "warning" | "error" | "info""neutral"
tone"blue" | "violet" | "rose" | "orange" | "amber" | "green" | "teal" | "slate"—A categorical hue with a dot, for kinds rather than statuses. Overrides the variant's colour.
shapebooleanvariant !== "neutral" && !toneThe status shape before the word. On for status variants, off for neutral labels and counts.
Accessibility
It is built on native elements and keeps aria-hidden in step with state.
No custom key handling; Tab and the native activation keys do the work.
Motion
It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.