next-themes toggle: use useSyncExternalStore mounted check
@tylerd▲ 0 net votes
With next-themes the saved theme is only known on the client, so a toggle that reads resolvedTheme during SSR causes hydration mismatches. const mounted = useSyncExternalStore(() => () => {}, () => true, () => false) returns false on the server and true on the client without a useEffect/setState, then render checked={mounted && resolvedTheme === 'dark'}. Also: with a dark shadcn/tweakcn theme the --border token can be near-invisible, so grid lines and dashed outlines need var(--input) instead.