{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"switch-cards-notifications","type":"registry:component","title":"Switch cards · Notifications","description":"Email and push preferences in labelled groups; the thumb stretches on press and a Saved chip blurs in after each change.","author":"GetUrUI <hello@geturui.dev>","dependencies":["motion","lucide-react"],"registryDependencies":[],"files":[{"path":"registry/geturui/examples/switch-cards/notifications.tsx","type":"registry:component","target":"components/examples/switch-cards/notifications.tsx","content":"\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { BellOff, Check, Mail, Smartphone } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface NotificationSetting {\n  id: string;\n  label: string;\n  description: string;\n  channel: \"email\" | \"push\";\n  enabled: boolean;\n}\n\nexport interface NotificationSwitchCardProps {\n  title?: string;\n  settings?: NotificationSetting[];\n  onChange?: (id: string, enabled: boolean) => void;\n  className?: string;\n}\n\nconst SETTINGS: NotificationSetting[] = [\n  { id: \"mentions\", label: \"Mentions and replies\", description: \"When someone @mentions you or replies to your thread.\", channel: \"email\", enabled: true },\n  { id: \"digest\", label: \"Weekly digest\", description: \"A Monday summary of activity in your projects.\", channel: \"email\", enabled: true },\n  { id: \"product\", label: \"Product updates\", description: \"New features and changes, about once a month.\", channel: \"email\", enabled: false },\n  { id: \"assigned\", label: \"Assigned to you\", description: \"New tasks and reviews that need your input.\", channel: \"push\", enabled: true },\n  { id: \"deploys\", label: \"Deploy status\", description: \"Builds that fail or finish on production.\", channel: \"push\", enabled: false },\n];\nconst GROUPS = [\n  { channel: \"email\", label: \"Email\", Icon: Mail },\n  { channel: \"push\", label: \"Push\", Icon: Smartphone },\n] as const;\nconst spring = { type: \"spring\", stiffness: 520, damping: 32 } as const;\n\n/** Accessible switch with a springy thumb that stretches while pressed. */\nfunction Switch({ checked, onToggle, labelledBy, describedBy }: { checked: boolean; onToggle: () => void; labelledBy: string; describedBy: string }) {\n  return (\n    <motion.button\n      type=\"button\"\n      role=\"switch\"\n      aria-checked={checked}\n      aria-labelledby={labelledBy}\n      aria-describedby={describedBy}\n      onClick={onToggle}\n      whileTap=\"press\"\n      className={cn(\n        \"relative inline-flex h-6 w-10 shrink-0 items-center rounded-full border p-[2px] outline-none transition-colors duration-200 focus-visible:shadow-[var(--focus-ring)]\",\n        checked ? \"border-transparent bg-volt\" : \"border-border-strong bg-surface-sunken\",\n      )}\n    >\n      <motion.span\n        animate={{ x: checked ? 16 : 0 }}\n        variants={{ press: { scaleX: 1.25 } }}\n        transition={spring}\n        style={{ originX: checked ? 1 : 0 }}\n        className={cn(\"block size-[18px] rounded-full shadow-sm\", checked ? \"bg-on-volt\" : \"bg-ink-subtle\")}\n      />\n    </motion.button>\n  );\n}\n\n/** Notification preferences grouped by channel; each switch springs and a quiet \"Saved\" confirmation fades in. */\nexport function NotificationSwitchCard({ title = \"Notifications\", settings = SETTINGS, onChange, className }: NotificationSwitchCardProps) {\n  const reduce = useReducedMotion();\n  const uid = React.useId();\n  const [state, setState] = React.useState(() => Object.fromEntries(settings.map((s) => [s.id, s.enabled])));\n  const [saved, setSaved] = React.useState(0);\n  const allOff = settings.every((s) => !state[s.id]);\n\n  React.useEffect(() => {\n    if (!saved) return;\n    const t = setTimeout(() => setSaved(0), 1800);\n    return () => clearTimeout(t);\n  }, [saved]);\n\n  function toggle(id: string) {\n    const next = !state[id];\n    setState((s) => ({ ...s, [id]: next }));\n    setSaved((n) => n + 1);\n    onChange?.(id, next);\n  }\n\n  return (\n    <section aria-labelledby={`${uid}-title`} className={cn(\"w-full max-w-[460px] rounded-lg border border-border bg-surface-raised shadow-sm\", className)}>\n      <header className=\"flex items-start justify-between gap-3 border-b border-border px-5 py-4\">\n        <div>\n          <h2 id={`${uid}-title`} className=\"font-display text-[16px] font-semibold text-ink\">{title}</h2>\n          <p className=\"mt-0.5 text-[12.5px] text-ink-muted\">Choose what reaches you and where.</p>\n        </div>\n        <p role=\"status\" className=\"h-6 text-[12px]\">\n          <AnimatePresence>\n            {saved > 0 && (\n              <motion.span key={saved} initial={{ opacity: 0, y: reduce ? 0 : 4, filter: \"blur(4px)\" }} animate={{ opacity: 1, y: 0, filter: \"blur(0px)\" }} exit={{ opacity: 0 }} className=\"inline-flex items-center gap-1 rounded-full bg-surface-sunken px-2 py-1 font-medium text-ink-muted ring-1 ring-border\">\n                <Check aria-hidden className=\"size-3 text-success\" />\n                Saved\n              </motion.span>\n            )}\n          </AnimatePresence>\n        </p>\n      </header>\n\n      {GROUPS.map(({ channel, label, Icon }) => (\n        <div key={channel} role=\"group\" aria-labelledby={`${uid}-${channel}`} className=\"px-5 py-3\">\n          <p id={`${uid}-${channel}`} className=\"flex items-center gap-1.5 py-1 text-[11.5px] font-medium uppercase tracking-wide text-ink-subtle\">\n            <Icon aria-hidden className=\"size-3.5\" />\n            {label}\n          </p>\n          <ul>\n            {settings.filter((s) => s.channel === channel).map((s) => (\n              <li key={s.id} className=\"flex items-center justify-between gap-4 py-2.5\">\n                <div className=\"min-w-0\">\n                  <p id={`${uid}-${s.id}`} className={cn(\"text-[13.5px] font-medium transition-colors\", state[s.id] ? \"text-ink\" : \"text-ink-muted\")}>{s.label}</p>\n                  <p id={`${uid}-${s.id}-d`} className=\"text-[12px] text-ink-subtle\">{s.description}</p>\n                </div>\n                <Switch checked={!!state[s.id]} onToggle={() => toggle(s.id)} labelledBy={`${uid}-${s.id}`} describedBy={`${uid}-${s.id}-d`} />\n              </li>\n            ))}\n          </ul>\n        </div>\n      ))}\n\n      <AnimatePresence initial={false}>\n        {allOff && (\n          <motion.p initial={{ height: 0, opacity: 0 }} animate={{ height: \"auto\", opacity: 1 }} exit={{ height: 0, opacity: 0 }} transition={reduce ? { duration: 0 } : spring} className=\"overflow-hidden\">\n            <span className=\"flex items-center gap-2 border-t border-border px-5 py-3 text-[12.5px] text-warning\">\n              <BellOff aria-hidden className=\"size-4 shrink-0\" />\n              All notifications are off. You may miss mentions and failed deploys.\n            </span>\n          </motion.p>\n        )}\n      </AnimatePresence>\n    </section>\n  );\n}\n"},{"path":"LICENSE-geturui.md","type":"registry:file","target":"LICENSE-geturui.md","content":"MIT License\n\nCopyright (c) 2026 geturui.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"}],"categories":["examples","switch","toggle","settings","preferences","notifications","privacy","features","form"],"meta":{"tier":"free","license":"MIT","docs":"https://geturui.com/docs/switch-cards#notifications"}}