"use client" import { useEffect, useState } from "react" import { Moon, Sun, Monitor } from "lucide-react" import { useTheme } from "next-themes" import { cn } from "@/lib/utils" const options = [ { value: "light", label: "Light mode", icon: Sun }, { value: "vibrant", label: "Vibrant theme", icon: Monitor }, { value: "dark", label: "Dark mode", icon: Moon }, ] as const /** * Renders an empty slot until mounted: `theme` is unknown on the server (and on the * client's first paint, before next-themes reads localStorage), so rendering the active * segment before that would either be wrong or cause a hydration mismatch. */ export function ThemeToggle({ className }: { className?: string }) { const { theme, setTheme } = useTheme() const [mounted, setMounted] = useState(false) useEffect(() => setMounted(true), []) if (!mounted) { return
} return (