This commit is contained in:
Vula Builder
2026-06-23 08:39:17 +00:00
parent d7a7af40bd
commit 740d242714
+28
View File
@@ -0,0 +1,28 @@
import { cn } from "@/lib/utils"
import React from "react"
interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
variant?: "default" | "secondary" | "outline" | "success" | "warning" | "destructive"
}
export default function Badge({ variant = "default", className, children, ...props }: BadgeProps) {
return (
<span
className={cn(
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",
{
"border-transparent bg-primary text-primary-foreground hover:bg-primary/80": variant === "default",
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80": variant === "secondary",
"border-border bg-background text-foreground hover:bg-accent": variant === "outline",
"border-transparent bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-100": variant === "success",
"border-transparent bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-100": variant === "warning",
"border-transparent bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-100": variant === "destructive"
},
className
)}
{...props}
>
{children}
</span>
)
}