How to Add Dark Mode to Your Next.js Project Using Tailwind CSS

A simple trick to fix the ‘document is not defined’ error.

Chad Murobayashi
JavaScript in Plain English
4 min readMay 19, 2021

--

Photo by Harpal Singh on Unsplash

Dark mode support was released in Tailwind V2.0.0 back in November 2020. With this release, adding dark mode using Tailwind was made simple.

In this article, we will take a look at how to add dark mode to a Next.js project using…

--

--