Badge
A small capsule: an accent label, a grey count or the red badge of a Dock icon.
@cupertinoui/badgeRegistry JSON import { CheckIcon } from "lucide-react"
import { Badge } from "@/components/ui/badge"
export default function BadgeDemo() {
return (
<div className="flex flex-wrap items-center gap-2">
<Badge>New</Badge>
<Badge variant="secondary">12</Badge>
<Badge variant="destructive">3</Badge>
<Badge variant="outline">Beta</Badge>
<Badge variant="secondary">
<CheckIcon /> Verified
</Badge>
<Badge variant="link" render={<a href="#" />}>
Release notes
</Badge>
</div>
)
}Installation
pnpm dlx shadcn@latest add @cupertinoui/badgeThe first install also adds the macOS theme. See Installation to set up the registry.
Usage
import { Badge } from "@/components/ui/badge"
<Badge variant="destructive">3</Badge>API Reference
Every part forwards the props of the underlying element. The props below are the ones CupertinoUI adds or changes.
Badge
| Prop | Type | Description |
|---|---|---|
variant | "default" | "secondary" | "destructive" | "outline" | "ghost" | "link"Default: "default" | The style. |
render | ReactElement | Render a link with the badge's styles. |
className | string | Extra classes, merged with the component's own. |