pnpm dlx shadcn@latest add @gammaui/badge
import { Badge } from "@/components/ui/badge"
export default function Example() {
return <Badge>Default Badge</Badge>
}<div className="flex gap-2">
<Badge variant="default">Default</Badge>
<Badge variant="secondary">Secondary</Badge>
<Badge variant="destructive">Destructive</Badge>
<Badge variant="outline">Outline</Badge>
</div>import Link from "next/link"
import { Badge } from "@/components/ui/badge"
;<Badge asChild>
<Link href="/dashboard">Dashboard</Link>
</Badge>| Prop | Type | Default | Description | |||
|---|---|---|---|---|---|---|
| variant | `'default' | 'secondary' | 'destructive' | 'outline'` | 'default' | Sets the visual style of the badge |
| asChild | boolean | false | Allows rendering the badge as a custom wrapper | |||
| className | string | — | Additional Tailwind CSS classes | |||
| ...props | React.ComponentProps<'span'> | — | Native span props passed through |
asChild)<div className="flex gap-2">
<Badge variant="default">Default</Badge>
<Badge variant="secondary">Secondary</Badge>
<Badge variant="destructive">Destructive</Badge>
<Badge variant="outline">Outline</Badge>
</div>