{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"theme-switchers-accent-density","type":"registry:component","title":"Theme switchers · Accent and density","description":"Accent swatches and a density control beside a live preview whose rows re-space with a layout spring and repaint in the chosen accent.","author":"GetUrUI <hello@geturui.dev>","dependencies":["motion","lucide-react"],"registryDependencies":[],"files":[{"path":"registry/geturui/examples/theme-switchers/accent-density.tsx","type":"registry:component","target":"components/examples/theme-switchers/accent-density.tsx","content":"\"use client\";\n\nimport * as React from \"react\";\nimport { motion } from \"motion/react\";\nimport { Check, FileText, Folder, Image as ImageIcon } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport type Accent = \"volt\" | \"sky\" | \"violet\" | \"rose\" | \"amber\" | \"graphite\";\nexport type Density = \"compact\" | \"default\" | \"comfortable\";\n\nexport interface AccentDensityValue {\n  accent: Accent;\n  density: Density;\n}\n\nexport interface AccentDensityPickerProps {\n  defaultValue?: AccentDensityValue;\n  /** Fires with every change. Only the preview updates; apply it to your app yourself. */\n  onChange?: (value: AccentDensityValue) => void;\n  className?: string;\n}\n\nconst ACCENTS: { id: Accent; label: string; fill: string; text: string; soft: string }[] = [\n  { id: \"volt\", label: \"Volt\", fill: \"bg-volt\", text: \"text-on-volt\", soft: \"bg-volt-soft\" },\n  { id: \"sky\", label: \"Sky\", fill: \"bg-sky-500\", text: \"text-white\", soft: \"bg-sky-500/15\" },\n  { id: \"violet\", label: \"Violet\", fill: \"bg-violet-500\", text: \"text-white\", soft: \"bg-violet-500/15\" },\n  { id: \"rose\", label: \"Rose\", fill: \"bg-rose-500\", text: \"text-white\", soft: \"bg-rose-500/15\" },\n  { id: \"amber\", label: \"Amber\", fill: \"bg-amber-400\", text: \"text-neutral-950\", soft: \"bg-amber-400/20\" },\n  { id: \"graphite\", label: \"Graphite\", fill: \"bg-ink\", text: \"text-bg\", soft: \"bg-surface-hover\" },\n];\nconst DENSITIES: { id: Density; label: string; row: string }[] = [\n  { id: \"compact\", label: \"Compact\", row: \"py-1\" },\n  { id: \"default\", label: \"Default\", row: \"py-2\" },\n  { id: \"comfortable\", label: \"Comfortable\", row: \"py-3\" },\n];\nconst FILES = [\n  { name: \"Brand guidelines\", meta: \"12 files\", Icon: Folder },\n  { name: \"Q4 roadmap.pdf\", meta: \"2.4 MB\", Icon: FileText },\n  { name: \"Launch hero.png\", meta: \"860 KB\", Icon: ImageIcon },\n];\nconst DEFAULT: AccentDensityValue = { accent: \"volt\", density: \"default\" };\nconst spring = { type: \"spring\", stiffness: 420, damping: 32 } as const;\n\n/** Accent colour and density picker with a live preview: rows re-space with a layout spring and the accent repaints the selection. */\nexport function AccentDensityPicker({ defaultValue = DEFAULT, onChange, className }: AccentDensityPickerProps) {\n  const uid = React.useId();\n  const [value, setValue] = React.useState(defaultValue);\n  const accentRefs = React.useRef<(HTMLButtonElement | null)[]>([]);\n  const densityRefs = React.useRef<(HTMLButtonElement | null)[]>([]);\n  const A = ACCENTS.find((a) => a.id === value.accent) ?? ACCENTS[0];\n  const D = DENSITIES.find((d) => d.id === value.density) ?? DENSITIES[1];\n\n  function update(next: Partial<AccentDensityValue>) {\n    const v = { ...value, ...next };\n    setValue(v);\n    onChange?.(v);\n  }\n\n  function roving<T extends { id: string }>(e: React.KeyboardEvent, list: T[], current: string, refs: React.RefObject<(HTMLButtonElement | null)[]>, pick: (id: T[\"id\"]) => void) {\n    const i = list.findIndex((x) => x.id === current);\n    const step = e.key === \"ArrowRight\" || e.key === \"ArrowDown\" ? 1 : e.key === \"ArrowLeft\" || e.key === \"ArrowUp\" ? -1 : 0;\n    if (!step) return;\n    e.preventDefault();\n    const n = (i + step + list.length) % list.length;\n    pick(list[n].id);\n    refs.current[n]?.focus();\n  }\n\n  return (\n    <section aria-labelledby={`${uid}-t`} className={cn(\"grid w-full max-w-[640px] overflow-hidden rounded-lg border border-border bg-surface-raised shadow-sm sm:grid-cols-[1fr_260px]\", className)}>\n      <div className=\"space-y-5 p-5\">\n        <div>\n          <h2 id={`${uid}-t`} className=\"font-display text-[16px] font-semibold text-ink\">Theme</h2>\n          <p className=\"mt-0.5 text-[12.5px] text-ink-muted\">Pick an accent and how much room things get.</p>\n        </div>\n        <div>\n          <p id={`${uid}-a`} className=\"text-[12px] font-medium text-ink-muted\">Accent · <span className=\"text-ink\">{A.label}</span></p>\n          <div role=\"radiogroup\" aria-labelledby={`${uid}-a`} onKeyDown={(e) => roving(e, ACCENTS, value.accent, accentRefs, (id) => update({ accent: id }))} className=\"mt-2.5 flex flex-wrap gap-2.5\">\n            {ACCENTS.map((a, i) => {\n              const on = a.id === value.accent;\n              return (\n                <motion.button\n                  key={a.id}\n                  ref={(el) => {\n                    accentRefs.current[i] = el;\n                  }}\n                  type=\"button\"\n                  role=\"radio\"\n                  aria-checked={on}\n                  aria-label={a.label}\n                  tabIndex={on ? 0 : -1}\n                  whileTap={{ scale: 0.88 }}\n                  onClick={() => update({ accent: a.id })}\n                  className={cn(\"relative grid size-8 place-items-center rounded-full outline-none ring-offset-2 ring-offset-surface-raised transition-shadow focus-visible:shadow-[var(--focus-ring)]\", on && \"ring-2 ring-border-strong\")}\n                >\n                  <span className={cn(\"absolute inset-0 rounded-full shadow-sm ring-1 ring-inset ring-border\", a.fill)} />\n                  {on && (\n                    <motion.span initial={{ scale: 0 }} animate={{ scale: 1 }} transition={{ type: \"spring\", stiffness: 600, damping: 20 }} className={cn(\"relative\", a.text)}>\n                      <Check aria-hidden className=\"size-4\" strokeWidth={3} />\n                    </motion.span>\n                  )}\n                </motion.button>\n              );\n            })}\n          </div>\n        </div>\n        <div>\n          <p id={`${uid}-d`} className=\"text-[12px] font-medium text-ink-muted\">Density</p>\n          <div role=\"radiogroup\" aria-labelledby={`${uid}-d`} onKeyDown={(e) => roving(e, DENSITIES, value.density, densityRefs, (id) => update({ density: id }))} className=\"mt-2.5 grid grid-cols-3 rounded-full border border-border bg-surface-sunken p-1\">\n            {DENSITIES.map((d, i) => {\n              const on = d.id === value.density;\n              return (\n                <button\n                  key={d.id}\n                  ref={(el) => {\n                    densityRefs.current[i] = el;\n                  }}\n                  type=\"button\"\n                  role=\"radio\"\n                  aria-checked={on}\n                  tabIndex={on ? 0 : -1}\n                  onClick={() => update({ density: d.id })}\n                  className={cn(\"relative h-8 rounded-full text-[12.5px] font-medium outline-none focus-visible:shadow-[var(--focus-ring)]\", on ? \"text-ink\" : \"text-ink-subtle hover:text-ink\")}\n                >\n                  {on && <motion.span layoutId={`${uid}-den`} transition={spring} className=\"absolute inset-0 rounded-full border border-border bg-surface-raised shadow-sm\" />}\n                  <span className=\"relative\">{d.label}</span>\n                </button>\n              );\n            })}\n          </div>\n        </div>\n      </div>\n\n      <div aria-label=\"Preview\" role=\"img\" className=\"border-t border-border bg-surface p-4 sm:border-l sm:border-t-0\">\n        <p className=\"text-[11px] font-medium uppercase tracking-wide text-ink-subtle\">Preview</p>\n        <motion.ul layout className=\"mt-2.5 rounded-md border border-border bg-surface-raised p-1\">\n          {FILES.map(({ name, meta, Icon }, i) => (\n            <motion.li key={name} layout transition={spring} className={cn(\"relative flex items-center gap-2.5 rounded-sm px-2\", D.row)}>\n              {i === 1 && <motion.span layout transition={spring} className={cn(\"absolute inset-0 rounded-sm\", A.soft)} />}\n              <Icon aria-hidden className={cn(\"relative size-4\", i === 1 ? \"text-ink\" : \"text-ink-subtle\")} />\n              <span className=\"relative flex-1 truncate text-[12.5px] text-ink\">{name}</span>\n              <span className=\"relative text-[11px] text-ink-subtle\">{meta}</span>\n            </motion.li>\n          ))}\n        </motion.ul>\n        <motion.div layout transition={spring} className=\"mt-3\">\n          <div className=\"flex justify-between text-[11px] text-ink-muted\">\n            <span>Storage</span>\n            <span className=\"tabular-nums\">68%</span>\n          </div>\n          <div className=\"mt-1.5 h-1.5 overflow-hidden rounded-full bg-border\">\n            <motion.div layout className={cn(\"h-full w-[68%] rounded-full transition-colors duration-300\", A.fill)} />\n          </div>\n        </motion.div>\n        <motion.div layout transition={spring} className={cn(\"mt-3 grid h-8 place-items-center rounded-full text-[12.5px] font-semibold transition-colors duration-300\", A.fill, A.text)}>\n          Share folder\n        </motion.div>\n      </div>\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","theme","dark mode","light mode","appearance","accent","density","segmented control","settings"],"meta":{"tier":"free","license":"MIT","docs":"https://geturui.com/docs/theme-switchers#accent-density"}}