blob: 51245fe234e19b0b9b22cceeb98561a6324c3733 [file] [log] [blame]
giod0026612025-05-08 13:00:36 +00001import * as React from "react";
2import { cva, type VariantProps } from "class-variance-authority";
gio5f2f1002025-03-20 18:38:48 +04003
giod0026612025-05-08 13:00:36 +00004import { cn } from "@/lib/utils";
gio5f2f1002025-03-20 18:38:48 +04005
6const badgeVariants = cva(
giod0026612025-05-08 13:00:36 +00007 "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
8 {
9 variants: {
10 variant: {
11 default: "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
12 secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
13 destructive:
14 "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
15 outline: "text-foreground",
16 },
17 },
18 defaultVariants: {
19 variant: "default",
20 },
21 },
22);
gio5f2f1002025-03-20 18:38:48 +040023
giod0026612025-05-08 13:00:36 +000024export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {}
gio5f2f1002025-03-20 18:38:48 +040025
26function Badge({ className, variant, ...props }: BadgeProps) {
giod0026612025-05-08 13:00:36 +000027 return <div className={cn(badgeVariants({ variant }), className)} {...props} />;
gio5f2f1002025-03-20 18:38:48 +040028}
29
giod0026612025-05-08 13:00:36 +000030export { Badge, badgeVariants };