better-themes: a React library that handles theme switching without the usual SSR headaches.
It blocks rendering until the theme loads so you never see that flash of white before dark mode kicks in.
Works with localStorage for cross-tab sync or sessionStorage if you want isolation.
The library detects system preferences automatically and applies them through class names or data attributes.
Key features:
- Zero flash on page load
- System preference detection
- Works with Next.js App Router and Remix
- Full TypeScript support
- Tailwind CSS compatible
π Blog Post
π GitHub Repo
π Live Demo
Top comments (0)