{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "theme-switcher", "title": "Theme Switcher", "author": "tusharvarshney ", "description": "Toggle between system, light, and dark themes in Next.js apps.", "dependencies": [ "next-themes", "motion" ], "files": [ { "path": "src/registry/components/theme-switcher/theme-switcher.tsx", "content": "\"use client\"\n\nimport { motion } from \"motion/react\"\nimport { useTheme } from \"next-themes\"\nimport type { JSX } from \"react\"\nimport { useSyncExternalStore } from \"react\"\n\nimport { IconPlaceholder } from \"@/components/icon-placeholder\"\nimport { cn } from \"@/lib/utils\"\n\nfunction ThemeOption({\n icon,\n value,\n isActive,\n onClick,\n}: {\n icon: JSX.Element\n value: string\n isActive?: boolean\n onClick: (value: string) => void\n}) {\n return (\n onClick(value)}\n >\n {icon}\n\n {isActive && (\n \n )}\n \n )\n}\n\nconst THEME_OPTIONS = [\n {\n icon: (\n \n ),\n value: \"system\",\n },\n {\n icon: (\n \n ),\n value: \"light\",\n },\n {\n icon: (\n \n ),\n value: \"dark\",\n },\n]\n\nfunction ThemeSwitcher() {\n const { theme, setTheme } = useTheme()\n\n const isMounted = useSyncExternalStore(\n () => () => {},\n () => true,\n () => false\n )\n\n if (!isMounted) {\n return
\n }\n\n return (\n \n {THEME_OPTIONS.map((option) => (\n \n ))}\n \n )\n}\n\nexport { ThemeSwitcher }\n", "type": "registry:component", "target": "@components/theme-switcher.tsx" } ], "docs": "https://tusharvarshney.com/components/theme-switcher", "type": "registry:component" }