{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "v-switch-8",
  "description": "Switch with descriptions in card grid",
  "registryDependencies": [
    "@cnippet/switch"
  ],
  "files": [
    {
      "path": "registry/default/variants/v-switch-8.tsx",
      "content": "// title: Switch with descriptions in card grid\n\"use client\";\n\nimport { BarChart3Icon, BugIcon, DatabaseIcon, GlobeIcon } from \"lucide-react\";\nimport { useState } from \"react\";\n\nimport { Field, FieldLabel } from \"@/registry/default/ui/field\";\nimport { Switch } from \"@/registry/default/ui/switch\";\n\nconst features = [\n  {\n    checked: true,\n    description: \"Track page views and user interactions\",\n    icon: <BarChart3Icon aria-hidden=\"true\" className=\"size-4\" />,\n    id: \"feat-analytics\",\n    title: \"Analytics\",\n  },\n  {\n    checked: true,\n    description: \"Capture and report runtime errors\",\n    icon: <BugIcon aria-hidden=\"true\" className=\"size-4\" />,\n    id: \"feat-logging\",\n    title: \"Error Logging\",\n  },\n  {\n    checked: false,\n    description: \"Serve static assets from edge network\",\n    icon: <GlobeIcon aria-hidden=\"true\" className=\"size-4\" />,\n    id: \"feat-cdn\",\n    title: \"CDN Caching\",\n  },\n  {\n    checked: false,\n    description: \"Daily snapshots of your database\",\n    icon: <DatabaseIcon aria-hidden=\"true\" className=\"size-4\" />,\n    id: \"feat-backup\",\n    title: \"Auto Backup\",\n  },\n];\n\nexport function Pattern() {\n  const [checked, setChecked] = useState<Record<string, boolean>>(\n    Object.fromEntries(features.map((f) => [f.id, f.checked])),\n  );\n\n  return (\n    <div className=\"grid w-full max-w-lg grid-cols-2 gap-4\">\n      {features.map((feature) => (\n        <Field key={feature.id}>\n          <FieldLabel\n            className={`h-full w-full cursor-pointer rounded-xl border p-3 transition-colors ${\n              checked[feature.id]\n                ? \"border-primary/5 bg-sidebar\"\n                : \"border-border\"\n            }`}\n            htmlFor={feature.id}\n          >\n            <div className=\"flex w-full items-start justify-between gap-2\">\n              <div className=\"flex items-start gap-2\">\n                <div\n                  className={`flex shrink-0 items-center justify-center rounded-md border p-1.5 shadow-black/5 shadow-xs transition-colors ${\n                    checked[feature.id]\n                      ? \"border-primary/30 bg-primary/10 text-primary\"\n                      : \"border-border bg-background\"\n                  }`}\n                >\n                  {feature.icon}\n                </div>\n                <div className=\"flex flex-col items-start gap-0.5\">\n                  <span className=\"font-semibold text-sm\">{feature.title}</span>\n                  <span className=\"text-muted-foreground text-xs\">\n                    {feature.description}\n                  </span>\n                </div>\n              </div>\n              <Switch\n                checked={checked[feature.id]}\n                id={feature.id}\n                onCheckedChange={(val) =>\n                  setChecked((prev) => ({ ...prev, [feature.id]: val }))\n                }\n              />\n            </div>\n          </FieldLabel>\n        </Field>\n      ))}\n    </div>\n  );\n}\n",
      "type": "registry:block"
    }
  ],
  "meta": {
    "className": ""
  },
  "categories": [
    "switch"
  ],
  "type": "registry:block"
}