{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "checkbox-terms", "type": "registry:ui", "title": "Checkbox Terms", "description": "A checkbox for accepting terms of service and privacy policy with linked text.", "dependencies": [ "motion" ], "files": [ { "path": "registry/ruixenui/checkbox-terms.tsx", "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport { motion, AnimatePresence } from \"motion/react\";\n\ninterface CheckboxTermsProps {\n checked?: boolean;\n defaultChecked?: boolean;\n onCheckedChange?: (checked: boolean) => void;\n termsText?: string;\n termsLink?: string;\n privacyText?: string;\n privacyLink?: string;\n required?: boolean;\n disabled?: boolean;\n id?: string;\n className?: string;\n}\n\nexport function CheckboxTerms({\n checked,\n defaultChecked = false,\n onCheckedChange,\n termsText = \"Terms of Service\",\n termsLink = \"#\",\n privacyText = \"Privacy Policy\",\n privacyLink = \"#\",\n required = false,\n disabled = false,\n id,\n className,\n}: CheckboxTermsProps) {\n const [internalChecked, setInternalChecked] = React.useState(defaultChecked);\n const isControlled = checked !== undefined;\n const isChecked = isControlled ? checked : internalChecked;\n const inputId = id || React.useId();\n\n const handleChange = (e: React.ChangeEvent) => {\n const newChecked = e.target.checked;\n if (!isControlled) {\n setInternalChecked(newChecked);\n }\n onCheckedChange?.(newChecked);\n };\n\n return (\n \n
\n \n \n \n {isChecked && (\n \n \n \n )}\n \n \n
\n \n I agree to the{\" \"}\n e.stopPropagation()}\n className=\"text-neutral-900 underline decoration-neutral-300 underline-offset-[3px] transition-colors hover:decoration-neutral-500 dark:text-neutral-100 dark:decoration-neutral-700 dark:hover:decoration-neutral-500\"\n >\n {termsText}\n {\" \"}\n and{\" \"}\n e.stopPropagation()}\n className=\"text-neutral-900 underline decoration-neutral-300 underline-offset-[3px] transition-colors hover:decoration-neutral-500 dark:text-neutral-100 dark:decoration-neutral-700 dark:hover:decoration-neutral-500\"\n >\n {privacyText}\n \n {required && (\n \n *\n \n )}\n \n \n );\n}\n", "type": "registry:ui", "target": "components/ruixen/checkbox-terms.tsx" } ] }