{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"theme-switchers-appearance-card","type":"registry:component","title":"Theme switchers · Appearance card","description":"Theme cards with tiny app windows drawn in each theme's real tokens, a check that pops onto the chosen one and a stepped text-size slider.","author":"GetUrUI <hello@geturui.dev>","dependencies":["motion","lucide-react"],"registryDependencies":[],"files":[{"path":"registry/geturui/examples/theme-switchers/appearance-card.tsx","type":"registry:component","target":"components/examples/theme-switchers/appearance-card.tsx","content":"\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { Check } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport type AppearanceTheme = \"light\" | \"dark\" | \"system\";\n\nexport interface AppearanceSettings {\n  theme: AppearanceTheme;\n  /** Interface text scale in percent. */\n  textSize: number;\n}\n\nexport interface AppearanceCardProps {\n  defaultValue?: AppearanceSettings;\n  /** Fires with every change. The card only previews; apply the result yourself. */\n  onChange?: (value: AppearanceSettings) => void;\n  className?: string;\n}\n\nconst THEMES = [\n  { id: \"light\", label: \"Light\" },\n  { id: \"dark\", label: \"Dark\" },\n  { id: \"system\", label: \"System\" },\n] as const;\nconst SIZES = [90, 100, 110, 125];\nconst DEFAULT: AppearanceSettings = { theme: \"dark\", textSize: 100 };\nconst spring = { type: \"spring\", stiffness: 420, damping: 30 } as const;\n\n/** A tiny app window drawn with tokens, scoped to one theme with data-theme. */\nfunction Mini({ scheme }: { scheme: \"light\" | \"dark\" }) {\n  return (\n    <div data-theme={scheme} className=\"flex h-full w-full gap-1.5 bg-bg p-2\">\n      <div className=\"flex w-1/4 flex-col gap-1 rounded-[4px] bg-surface p-1\">\n        <span className=\"h-1.5 w-full rounded-full bg-volt\" />\n        <span className=\"h-1 w-3/4 rounded-full bg-ink-subtle/50\" />\n        <span className=\"h-1 w-2/3 rounded-full bg-ink-subtle/50\" />\n      </div>\n      <div className=\"flex flex-1 flex-col gap-1 rounded-[4px] border border-border bg-surface-raised p-1.5\">\n        <span className=\"h-1.5 w-2/3 rounded-full bg-ink\" />\n        <span className=\"h-1 w-full rounded-full bg-ink-subtle/40\" />\n        <span className=\"h-1 w-5/6 rounded-full bg-ink-subtle/40\" />\n        <span className=\"mt-auto h-2.5 w-8 rounded-full bg-volt\" />\n      </div>\n    </div>\n  );\n}\n\n/** Appearance settings with mini window previews for each theme, a springing check on the chosen one and a live text-size sample. */\nexport function AppearanceCard({ defaultValue = DEFAULT, onChange, className }: AppearanceCardProps) {\n  const reduce = useReducedMotion();\n  const uid = React.useId();\n  const [value, setValue] = React.useState(defaultValue);\n  const refs = React.useRef<(HTMLButtonElement | null)[]>([]);\n\n  function update(next: Partial<AppearanceSettings>) {\n    const v = { ...value, ...next };\n    setValue(v);\n    onChange?.(v);\n  }\n\n  function onKey(e: React.KeyboardEvent) {\n    const i = THEMES.findIndex((t) => t.id === value.theme);\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 + THEMES.length) % THEMES.length;\n    update({ theme: THEMES[n].id });\n    refs.current[n]?.focus();\n  }\n\n  const sizeIndex = SIZES.indexOf(value.textSize);\n\n  return (\n    <section aria-labelledby={`${uid}-t`} className={cn(\"w-full max-w-[520px] rounded-lg border border-border bg-surface-raised p-5 shadow-sm\", className)}>\n      <h2 id={`${uid}-t`} className=\"font-display text-[16px] font-semibold text-ink\">Appearance</h2>\n      <p className=\"mt-0.5 text-[12.5px] text-ink-muted\">Choose how the workspace looks on this device.</p>\n\n      <div role=\"radiogroup\" aria-label=\"Theme\" onKeyDown={onKey} className=\"mt-4 grid grid-cols-3 gap-2.5 sm:gap-3\">\n        {THEMES.map(({ id, label }, i) => {\n          const on = value.theme === id;\n          return (\n            <motion.button\n              key={id}\n              ref={(el) => {\n                refs.current[i] = el;\n              }}\n              type=\"button\"\n              role=\"radio\"\n              aria-checked={on}\n              tabIndex={on ? 0 : -1}\n              whileTap={{ scale: 0.97 }}\n              onClick={() => update({ theme: id })}\n              className=\"group flex flex-col gap-2 rounded-md text-left outline-none focus-visible:shadow-[var(--focus-ring)]\"\n            >\n              <span className={cn(\"relative block aspect-[4/3] w-full overflow-hidden rounded-md border-2 transition-colors\", on ? \"border-volt-ink\" : \"border-border group-hover:border-border-strong\")}>\n                {id === \"system\" ? (\n                  <>\n                    <span className=\"absolute inset-0\"><Mini scheme=\"light\" /></span>\n                    <span className=\"absolute inset-0 [clip-path:polygon(100%_0,100%_100%,0_100%)]\"><Mini scheme=\"dark\" /></span>\n                  </>\n                ) : (\n                  <Mini scheme={id} />\n                )}\n                <AnimatePresence>\n                  {on && (\n                    <motion.span initial={{ scale: 0, rotate: reduce ? 0 : -30 }} animate={{ scale: 1, rotate: 0 }} exit={{ scale: 0 }} transition={{ type: \"spring\", stiffness: 520, damping: 18 }} className=\"absolute right-1.5 top-1.5 grid size-5 place-items-center rounded-full bg-volt text-on-volt shadow-sm\">\n                      <Check aria-hidden className=\"size-3\" strokeWidth={3} />\n                    </motion.span>\n                  )}\n                </AnimatePresence>\n              </span>\n              <span className={cn(\"px-0.5 text-[12.5px] font-medium\", on ? \"text-ink\" : \"text-ink-muted\")}>{label}</span>\n            </motion.button>\n          );\n        })}\n      </div>\n\n      <div className=\"mt-5 border-t border-border pt-4\">\n        <div className=\"flex items-center justify-between\">\n          <label htmlFor={`${uid}-size`} className=\"text-[13px] font-medium text-ink\">Text size</label>\n          <span className=\"font-mono text-[12px] tabular-nums text-ink-muted\">{value.textSize}%</span>\n        </div>\n        <div className=\"mt-3 flex items-center gap-3\">\n          <span aria-hidden className=\"text-[11px] font-semibold text-ink-subtle\">A</span>\n          <div className=\"relative flex-1\">\n            <div className=\"absolute inset-x-0 top-1/2 h-1 -translate-y-1/2 rounded-full bg-surface-sunken ring-1 ring-border\" />\n            <motion.div className=\"absolute left-0 top-1/2 h-1 -translate-y-1/2 rounded-full bg-volt\" animate={{ width: `${(sizeIndex / (SIZES.length - 1)) * 100}%` }} transition={spring} />\n            <div className=\"relative flex justify-between\">\n              {SIZES.map((s, i) => (\n                <span key={s} aria-hidden className={cn(\"size-2 rounded-full\", i <= sizeIndex ? \"bg-volt\" : \"bg-border-strong\")} />\n              ))}\n            </div>\n            <input\n              id={`${uid}-size`}\n              type=\"range\"\n              min={0}\n              max={SIZES.length - 1}\n              step={1}\n              value={sizeIndex}\n              aria-valuetext={`${value.textSize} percent`}\n              onChange={(e) => update({ textSize: SIZES[Number(e.target.value)] })}\n              className=\"peer absolute inset-0 h-full w-full cursor-pointer opacity-0\"\n            />\n            <motion.span\n              aria-hidden\n              className=\"pointer-events-none absolute top-1/2 size-4 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-volt bg-surface-raised shadow-md peer-focus-visible:shadow-[var(--focus-ring)]\"\n              animate={{ left: `${(sizeIndex / (SIZES.length - 1)) * 100}%` }}\n              transition={spring}\n            />\n          </div>\n          <span aria-hidden className=\"text-[16px] font-semibold text-ink-subtle\">A</span>\n        </div>\n        <motion.p layout={!reduce} className=\"mt-4 rounded-md border border-border bg-surface-sunken px-3 py-2.5 text-ink-muted\" style={{ fontSize: `${(13 * value.textSize) / 100}px` }}>\n          The quick review is ready. Leave comments by Friday.\n        </motion.p>\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#appearance-card"}}