JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container" class="light"></div>
<button id="darkmode">Dark Mode</button>
<button id="lightmode">Light Mode</button>
CSS
div {
width: 500px;
height: 300px;
border: 1px solid black;
}
button {
margin: 10px;
}
.light {
background-color: #ffffff;
}
.dark {
background-color: #243447;
}
JavaScript
document.getElementById("darkmode").onclick = function() {
document.getElementById("container").className = "dark";
}
document.getElementById("lightmode").onclick = function() {
document.getElementById("container").className = "light";
}