| 1 | import { cva, type VariantProps } from "class-variance-authority"; |
| 2 | import { cn } |
| 3 | import * as React |
| 4 | |
| 5 | const badgeVariants = cva |
| 6 | "inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium transition-colors [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-3", |
| 7 | { |
| 8 | variants: { |
| 9 | variant: { |
| 10 | default: "bg-foreground text-background", |
| 11 | secondary: "bg-muted text-muted-foreground", |
| 12 | outline: "border border-border text-foreground", |
| 13 | success: |
| 14 | "bg-green-500/10 text-green-600 dark:text-green-400", |
| 15 | info: "bg-blue-500/10 text-blue-600 dark:text-blue-400", |
| 16 | destructive: "bg-destructive/10 text-destructive", |
| 17 | warning: |
| 18 | "bg-yellow-500/10 text-yellow-600 dark:text-yellow-400", |
| 19 | }, |
| 20 | }, |
| 21 | defaultVariants: { |
| 22 | variant: "default", |
| 23 | }, |
| 24 | }, |
| 25 | ); |
| 26 | |
| 27 | function Badge({ |
| 28 | className, |
| 29 | variant, |
| 30 | ...props |
| 31 | }: React. |
| 32 | return ( |
| 33 | <span |
| 34 | data-slot="badge" |
| 35 | className={cn(badgeVariants |
| 36 | {...props} |
| 37 | /> |
| 38 | ); |
| 39 | } |
| 40 | |
| 41 | export { Badge, badgeVariants |