{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"badge","type":"registry:ui","title":"Badge","description":"Compact status label in six variants with an optional live dot, pulse ring and a glinting shine sweep.","dependencies":[],"registryDependencies":["utils"],"files":[{"path":"registry/ui/badge.tsx","type":"registry:ui","content":"\"use client\";\n\nimport type { HTMLAttributes } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nconst css = `\n@keyframes ui-badge-shine{0%,55%{translate:-120% 0}100%{translate:120% 0}}\n.ui-badge-shine::after{content:\"\";position:absolute;inset:0;background:linear-gradient(105deg,transparent 30%,rgb(255 255 255/.45) 50%,transparent 70%);animation:ui-badge-shine 3.2s ease-in-out infinite;pointer-events:none}\n@media (prefers-reduced-motion:reduce){.ui-badge-shine::after{animation:none;opacity:0}}\n`;\n\nexport type BadgeVariant = \"default\" | \"secondary\" | \"outline\" | \"success\" | \"warning\" | \"destructive\";\n\nconst variants: Record<BadgeVariant, string> = {\n  default: \"border-transparent bg-primary text-primary-foreground\",\n  secondary: \"border-transparent bg-secondary text-secondary-foreground\",\n  outline: \"border-border text-foreground\",\n  success: \"border-emerald-500/30 bg-emerald-500/15 text-emerald-700 dark:text-emerald-400\",\n  warning: \"border-amber-500/30 bg-amber-500/15 text-amber-700 dark:text-amber-400\",\n  destructive: \"border-destructive/30 bg-destructive/15 text-destructive\",\n};\n\nexport interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {\n  variant?: BadgeVariant;\n  size?: \"sm\" | \"md\";\n  /** Leading status dot in the badge's text color. */\n  dot?: boolean;\n  /** Pulse ring around the dot (implies `dot`). */\n  pulse?: boolean;\n  /** A light sweep that glides across the badge every few seconds. */\n  shine?: boolean;\n}\n\nexport function Badge({\n  variant = \"default\",\n  size = \"md\",\n  dot = false,\n  pulse = false,\n  shine = false,\n  className,\n  children,\n  ...props\n}: BadgeProps) {\n  return (\n    <span\n      {...props}\n      className={cn(\n        \"relative inline-flex w-fit shrink-0 items-center gap-1.5 overflow-hidden whitespace-nowrap rounded-full border font-medium\",\n        \"transition-[background-color,border-color,color,scale] duration-200 [a&]:hover:brightness-110\",\n        size === \"sm\" ? \"h-5 px-2 text-[11px]\" : \"h-6 px-2.5 text-xs\",\n        variants[variant],\n        shine && \"ui-badge-shine\",\n        className,\n      )}\n    >\n      {shine && (\n        <style href=\"ui-badge\" precedence=\"default\">\n          {css}\n        </style>\n      )}\n      {(dot || pulse) && (\n        <span aria-hidden className=\"relative flex size-1.5\">\n          {pulse && <span className=\"absolute inset-0 animate-ping rounded-full bg-current opacity-75 motion-reduce:hidden\" />}\n          <span className=\"relative size-1.5 rounded-full bg-current\" />\n        </span>\n      )}\n      {children}\n    </span>\n  );\n}\n"}]}