profileShare

rasmusjy / roundtable

Read-only snapshot

No repository description.

main default branch 181 files Expires Sep 13, 2026, 9:06 AM
badge.tsx 1,132 bytes
1 import { cva, type VariantProps } from 'class-variance-authority';
2 import * as React from 'react';
3 import { cn } from '@/lib/utils';
4
5 const badgeVariants = cva(
6 'inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium transition-colors focus:outline-none',
7 {
8 variants: {
9 variant: {
10 default: 'border-transparent bg-primary/10 text-primary',
11 secondary: 'border-transparent bg-secondary text-secondary-foreground',
12 destructive: 'border-transparent bg-destructive/10 text-destructive',
13 success: 'border-transparent bg-emerald-500/10 text-emerald-600 dark:text-emerald-400',
14 warning: 'border-transparent bg-amber-500/10 text-amber-600 dark:text-amber-400',
15 outline: 'text-foreground',
16 },
17 },
18 defaultVariants: { variant: 'default' },
19 },
20 );
21
22 export interface BadgeProps
23 extends React.HTMLAttributes<HTMLDivElement>,
24 VariantProps<typeof badgeVariants> {}
25
26 function Badge({ className, variant, ...props }: BadgeProps) {
27 return <div className={cn(badgeVariants({ variant }), className)} {...props} />;
28 }
29
30 export { Badge, badgeVariants };
31