chatbot-template/components/ui/badge.tsx

37 lines
1.1 KiB
TypeScript
Raw Normal View History

2025-09-09 15:44:07 -04:00
import * as React from 'react';
import { cva, type VariantProps } from 'class-variance-authority';
2025-08-28 14:15:36 +01:00
2025-09-09 15:44:07 -04:00
import { cn } from '@/lib/utils';
2025-08-28 14:15:36 +01:00
const badgeVariants = cva(
2025-09-09 15:44:07 -04:00
'inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2',
2025-08-28 14:15:36 +01:00
{
variants: {
variant: {
default:
2025-09-09 15:44:07 -04:00
'border-transparent bg-primary text-primary-foreground hover:bg-primary/80',
2025-08-28 14:15:36 +01:00
secondary:
2025-09-09 15:44:07 -04:00
'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
2025-08-28 14:15:36 +01:00
destructive:
2025-09-09 15:44:07 -04:00
'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80',
outline: 'text-foreground',
2025-08-28 14:15:36 +01:00
},
},
defaultVariants: {
2025-09-09 15:44:07 -04:00
variant: 'default',
2025-08-28 14:15:36 +01:00
},
2025-09-09 15:44:07 -04:00
},
);
2025-08-28 14:15:36 +01:00
export interface BadgeProps
extends React.HTMLAttributes<HTMLDivElement>,
VariantProps<typeof badgeVariants> {}
function Badge({ className, variant, ...props }: BadgeProps) {
return (
<div className={cn(badgeVariants({ variant }), className)} {...props} />
2025-09-09 15:44:07 -04:00
);
2025-08-28 14:15:36 +01:00
}
2025-09-09 15:44:07 -04:00
export { Badge, badgeVariants };