fundamentals
Next.js Theme Integration
Add dark mode to your Next.js application
Install next-themes package
Start by installing next-themes:
Create a Theme Provider
components/theme-provider.tsx
Wrap your Root Layout
Add the ThemeProvider to your root layout and add the suppressHydrationWarning prop to the html tag.
app/layout.tsx
Create a Theme Toggler
components/theme-toggler.tsx
Use the Theme Toggler
components/navigation-bar.tsx