How we engineered a better Next.js theme library
The article discusses the engineering of a new Next.js theme library. It compares three existing libraries, highlighting their bugs and architectural choices. The author emphasizes the importance of correctly applying themes to avoid user-visible issues during page loads.
- ▪There are three main theme libraries for Next.js and React as of 2026: next-themes, @wrksz/themes, and @teispace/next-themes.
- ▪Each library has significant bugs that can affect user experience without crashing the application.
- ▪The inline script responsible for applying the theme is crucial, as it must execute before any content is rendered to prevent visual glitches.
Opening excerpt (first ~120 words) tap to expand
try { if(localStorage) { let currentUser = localStorage.getItem('current_user'); if (currentUser) { currentUser = JSON.parse(currentUser); if (currentUser.id === 490674) { document.getElementById('article-show-container').classList.add('current-user-is-article-author'); } } } } catch (e) { console.error(e); } Krishna Adhikari Posted on May 18 How we engineered a better Next.js theme library #typescript #react #nextjs #opensource How we engineered a better Next.js theme library There are three serious theme libraries for Next.js and React in 2026: next-themes by paco — the OG. ~3 million weekly downloads. Battle-tested but unmaintained for React 19. @wrksz/themes by jakubwarkusz — a clean-slate rewrite from March 2026. ~10k weekly downloads.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at DEV.to (Top).