Basic usageNow that dark mode is a first-class feature of many operating systems, it’s becoming more and more common to design a dark version of your website to go along with the default design. Show To make this as easy as possible, Tailwind includes a
By default this uses the Toggling dark mode manuallyIf you want to support toggling dark mode manually instead of relying on the operating system preference, use the
Now instead of
If you’ve set a prefix in your Tailwind config, be sure to add that to the How you add the Supporting system preference and manual selectionThe Here’s a simple example of how you can support light mode, dark mode, as well as respecting the operating system preference: Again you can manage this however you like, even storing the preference server-side in a database and rendering the class on the server — it’s totally up to you. Customizing the class nameSome frameworks (like NativeScript) have their own approach to enabling dark mode and add a different class name when dark mode is active. You can customize the dark mode selector name by setting |