Simple component for toggle between light
and dark
theme in your React app.
Demo generated with code from Usage section
- It saves the theme in
localStorage
with the key theme
by default
- If there is no theme in
localStorage
, the default is the user’s preferred
theme
Installation
Usage
-
Use the component in your project:
-
Add your styles:
Demos
For examples and details on the usage of the component, see the demo page:
API
See documentation below for reference to all of the props, classes and CSS
variables (custom properties) available for toggle theme component: