Badge
Displays a badge or a component that looks like a badge.
DefaultSecondaryOutlineDestructive
Installation
npm i @radix-ui/react-slotUsage
1
2
3
4
5
import { Badge } from "@/components/ui/badge"
export function BadgeDemo() {
return <Badge variant="secondary">Badge</Badge>
}Examples
Variants
Default
DefaultSecondary
SecondaryOutline
OutlineDestructive
DestructiveCustom Styling
Custom Color
Custom ColorCustom Shape
Custom ShapeCustom Border
Custom BorderWith Icons
Check
CompletedInfo
InformationWarning
WarningProps
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | 'default' | 'secondary' | 'destructive' | 'outline' | 'default' | The visual style of the badge. |
| className | string | undefined | Additional CSS classes to apply to the badge. |
| asChild | boolean | false | When true, the badge will be rendered as its child element. Useful for links and buttons. |