ZBMui

Next.js - Dark Mode

View markdown

Adding dark mode to your next app.

Install next-themes

Start by installing next-themes:

Create a theme provider

src/providers/theme-provider.tsx

Wrap your root layout

Add the ThemeProvider to your root layout and add the suppressHydrationWarning prop to the html tag.

src/app/layout.tsx

Add a theme toggle

Place a theme toggle on your site to toggle between light and dark mode.

src/components/theme-toggle.tsx
ZBMui

Built by the ZBM.

© 2026 ZBM ui. All rights reserved.