{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "switch",
  "title": "Switch",
  "description": "An on/off setting that applies immediately.",
  "registryDependencies": [
    "https://creance.pages.dev/r/checkbox.json",
    "https://creance.pages.dev/r/creance-base.json"
  ],
  "files": [
    {
      "path": "switch/Switch.tsx",
      "content": "import { forwardRef, type InputHTMLAttributes, type ReactNode } from 'react';\nimport { cx } from '@/lib/creance/cx';\nimport '@/components/creance/checkbox/Checkbox.css';\n\nexport interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'role'> {\n  label: ReactNode;\n  description?: ReactNode;\n}\n\n/**\n * An on/off setting that applies immediately. A native checkbox with `role=\"switch\"`, so it submits\n * with forms and Space toggles it. Use `Checkbox` when the choice only applies after a Save.\n */\nexport const Switch = forwardRef<HTMLInputElement, SwitchProps>(function Switch(\n  { label, description, className, ...props },\n  ref,\n) {\n  return (\n    <label className={cx('cr-check cr-switch', className)}>\n      <span className=\"cr-check__text\">\n        {label}\n        {description && <span className=\"cr-check__description\">{description}</span>}\n      </span>\n      <input ref={ref} type=\"checkbox\" role=\"switch\" className=\"cr-switch__input\" {...props} />\n    </label>\n  );\n});\n",
      "type": "registry:ui",
      "target": "@components/creance/switch/Switch.tsx"
    }
  ],
  "categories": [
    "atom",
    "forms"
  ],
  "type": "registry:ui"
}