Files

42 lines
1023 B
TypeScript

import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "@/lib/utils";
const badgeVariants = cva(
"inline-flex h-6 items-center rounded-md border px-2 py-0.5 text-xs font-medium",
{
variants: {
variant: {
default: "border-transparent bg-primary text-primary-foreground",
secondary: "border-transparent bg-secondary text-secondary-foreground",
outline:
"text-foreground border-border bg-background hover:bg-muted/40",
destructive:
"border-transparent bg-destructive text-destructive-foreground",
},
},
defaultVariants: {
variant: "default",
},
},
);
type BadgeProps = React.HTMLAttributes<HTMLDivElement> &
VariantProps<typeof badgeVariants>;
const Badge = ({ className, variant, ...props }: BadgeProps) => (
<span
className={cn(
badgeVariants({
variant,
}),
className,
)}
{...props}
/>
);
Badge.displayName = "Badge";
export { Badge, badgeVariants };