- Plugins
- Theme Switch
Plugins
Tailwind CSS Theme Switch
Style your site in dark mode with ready made Preline UI's dark mode toggle plugin.
Installation
To get started, install Theme Switch plugin via npm, else you can skip this step if you are already using Preline UI as a package.
Toggling dark mode manually
To enable manual toggling of dark mode instead of relying on the operating system preference, use Tailwind's @custom-variant
strategy:
How you add the dark
class to the html
element is up to you, but a common approach is to use a bit of JS that reads a preference from somewhere (like localStorage
) and updates the DOM accordingly.
For more information, visit Tailwind CSS Dark Mode
Demo examples
Looking for prebuilt UI components based on the Tailwind CSS? Preline UI packs hundreds of component examples for all your website needs.