{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "theme-switcher", "title": "Theme Switcher", "author": "ramanak ", "description": "A theme switcher component for Next.js apps with next-themes and Tailwind CSS, supporting system, light, and dark modes.", "dependencies": [ "next-themes", "lucide-react", "motion" ], "registryDependencies": [ "@ramanak/utils" ], "files": [ { "path": "src/registry/theme-switcher/theme-switcher.tsx", "content": "\"use client\"\r\n\r\nimport { MonitorIcon, MoonStarIcon, SunIcon } from \"lucide-react\"\r\nimport { motion } from \"motion/react\"\r\nimport { useTheme } from \"next-themes\"\r\nimport type { JSX } from \"react\"\r\nimport { useSyncExternalStore } from \"react\"\r\n\r\nimport { cn } from \"@/lib/utils\"\r\n\r\nfunction ThemeOption({\r\n icon,\r\n value,\r\n isActive,\r\n onClick,\r\n}: {\r\n icon: JSX.Element\r\n value: string\r\n isActive?: boolean\r\n onClick: (value: string) => void\r\n}) {\r\n return (\r\n onClick(value)}\r\n >\r\n {icon}\r\n\r\n {isActive && (\r\n \r\n )}\r\n \r\n )\r\n}\r\n\r\nconst THEME_OPTIONS = [\r\n {\r\n icon: ,\r\n value: \"system\",\r\n },\r\n {\r\n icon: ,\r\n value: \"light\",\r\n },\r\n {\r\n icon: ,\r\n value: \"dark\",\r\n },\r\n]\r\n\r\nfunction ThemeSwitcher() {\r\n const { theme, setTheme } = useTheme()\r\n\r\n const isMounted = useSyncExternalStore(\r\n () => () => {},\r\n () => true,\r\n () => false\r\n )\r\n\r\n if (!isMounted) {\r\n return
\r\n }\r\n\r\n return (\r\n \r\n {THEME_OPTIONS.map((option) => (\r\n \r\n ))}\r\n \r\n )\r\n}\r\n\r\nexport { ThemeSwitcher }\r\n", "type": "registry:component" } ], "docs": "https://www.ramana.dev/components/theme-switcher-component", "type": "registry:component" }