peppa/apps/web/components/ui/badge.tsx
Асель 28fbde4add PEP-38: console foundation — Tailwind v4, shadcn/ui components, dark theme, three-panel layout
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 16:21:43 +05:00

30 lines
1.2 KiB
TypeScript

import * as React from "react";
import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "@/lib/utils";
const badgeVariants = cva(
"inline-flex w-fit shrink-0 items-center gap-1 whitespace-nowrap rounded-full border px-2 py-0.5 text-xs font-medium [&>svg]:size-3",
{
variants: {
variant: {
default: "border-transparent bg-primary text-primary-foreground",
secondary: "border-transparent bg-secondary text-secondary-foreground",
outline: "border-border text-muted-foreground",
primary: "border-primary/30 bg-primary/12 text-primary",
ok: "border-ok/30 bg-ok/12 text-ok",
warn: "border-warn/30 bg-warn/12 text-warn",
info: "border-info/30 bg-info/12 text-info",
danger: "border-destructive/30 bg-destructive/12 text-destructive",
muted: "border-transparent bg-muted text-muted-foreground",
},
},
defaultVariants: { variant: "secondary" },
},
);
function Badge({ className, variant, ...props }: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants>) {
return <span data-slot="badge" className={cn(badgeVariants({ variant }), className)} {...props} />;
}
export { Badge, badgeVariants };