{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "radix-checkbox", "type": "registry:ui", "title": "Checkbox", "description": "A control that allows the user to toggle between checked and not checked.", "dependencies": [ "motion", "radix-ui" ], "files": [ { "path": "registry/radix/checkbox/index.tsx", "content": "'use client';\n\nimport * as React from 'react';\nimport { Checkbox as CheckboxPrimitive } from 'radix-ui';\nimport { motion, type HTMLMotionProps } from 'motion/react';\n\nimport { cn } from '@/lib/utils';\n\ntype CheckboxProps = React.ComponentProps &\n HTMLMotionProps<'button'>;\n\nfunction Checkbox({ className, onCheckedChange, ...props }: CheckboxProps) {\n const [isChecked, setIsChecked] = React.useState(\n props?.checked ?? props?.defaultChecked ?? false,\n );\n\n React.useEffect(() => {\n if (props?.checked !== undefined) setIsChecked(props.checked);\n }, [props?.checked]);\n\n const handleCheckedChange = React.useCallback(\n (checked: boolean) => {\n setIsChecked(checked);\n onCheckedChange?.(checked);\n },\n [onCheckedChange],\n );\n\n return (\n \n \n \n \n \n \n \n \n \n );\n}\n\nexport { Checkbox, type CheckboxProps };\n", "type": "registry:ui", "target": "components/animate-ui/radix/checkbox.tsx" } ] }