{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "checkbox",
  "type": "registry:ui",
  "title": "Checkbox",
  "description": "Accessible checkbox with indeterminate state, for forms and bulk-select rows.",
  "dependencies": [
    "@radix-ui/react-checkbox",
    "@saasflare/ui",
    "motion"
  ],
  "files": [
    {
      "path": "components/ui/checkbox.tsx",
      "type": "registry:ui",
      "content": "// @toreview\n\"use client\"\n\n/**\n * @fileoverview Checkbox — toggle input with Motion spring check-mark animation.\n * @module packages/ui/components/ui/checkbox\n * @layer core\n *\n * Self-contained implementation built on Radix Checkbox primitive. The check\n * indicator uses a bouncy spring scale animation via Motion that plays on mount\n * when the checkbox becomes checked.\n *\n * @component\n * @example\n * import { Checkbox } from \"@saasflare/ui\";\n *\n * <Checkbox id=\"terms\" />\n * <label htmlFor=\"terms\">Accept terms and conditions</label>\n */\n\nimport * as React from \"react\"\nimport { m } from \"motion/react\"\nimport { CheckIcon } from \"@saasflare/ui\"\nimport * as CheckboxPrimitive from \"@radix-ui/react-checkbox\"\nimport { cn } from \"@saasflare/ui\"\nimport { useSaasflareProps, type SaasflareComponentProps } from \"@saasflare/ui\"\nimport { useSaasflareMotion, springBouncy } from \"@saasflare/ui\"\n\n/**\n * Props for {@link Checkbox}.\n *\n * Extends the Radix Checkbox root props with {@link SaasflareComponentProps},\n * so `surface`, `radius`, `animated`, and `iconWeight` can be supplied\n * per-instance or inherited from <SaasflareProvider>.\n */\ninterface CheckboxProps\n  extends Omit<React.ComponentProps<typeof CheckboxPrimitive.Root>, keyof SaasflareComponentProps>,\n    SaasflareComponentProps {}\n\n/**\n * Checkbox input with a bouncy spring check-mark animation. Built on the\n * Radix Checkbox primitive; supports controlled and uncontrolled checked\n * state. Pair with a `<label htmlFor>` for an accessible name.\n *\n * @component\n * @layer core\n *\n * @example\n * <Checkbox id=\"terms\" />\n * <label htmlFor=\"terms\">Accept terms and conditions</label>\n */\nfunction Checkbox({\n  className,\n  surface,\n  radius,\n  animated,\n  iconWeight,\n  ...props\n}: CheckboxProps) {\n  const sf = useSaasflareProps({ surface, radius, animated, iconWeight })\n  const motion = useSaasflareMotion(sf.animated, springBouncy)\n\n  return (\n    <CheckboxPrimitive.Root\n      {...props}\n      data-slot=\"checkbox\"\n      data-surface={sf.surface}\n      data-radius={sf.radius}\n      data-animated={String(sf.animated)}\n      className={cn(\n        \"peer size-4 shrink-0 cursor-pointer rounded-lg border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary\",\n        className\n      )}\n    >\n      <CheckboxPrimitive.Indicator\n        data-slot=\"checkbox-indicator\"\n        className=\"grid place-content-center text-current\"\n        asChild\n      >\n        <m.span\n          initial={motion.disabled ? false : { scale: 0, opacity: 0 }}\n          animate={{ scale: 1, opacity: 1 }}\n          exit={motion.disabled ? undefined : { scale: 0, opacity: 0 }}\n          transition={motion.transition}\n        >\n          <CheckIcon weight={sf.iconWeight} className=\"size-3.5\" />\n        </m.span>\n      </CheckboxPrimitive.Indicator>\n    </CheckboxPrimitive.Root>\n  )\n}\n\nexport { Checkbox, type CheckboxProps }\n",
      "target": "components/ui/checkbox.tsx"
    }
  ],
  "$meta": {
    "source": "https://ui.saasflare.io/r/checkbox.json"
  }
}
