JSFiddle - React, Tailwind, and code Playground

HTML

<input type="checkbox" id="sidebarShown" hidden />
<input type="checkbox" id="darkThemeUsed" hidden />

<!-- here begins actual content, for example: -->
<div id="container">
    <div id="sidebar">
        <label for="sidebarShown" class="button">x</label>
        <h3>Super cool sidebar</h3>
        <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
        </p>
    </div>

    <h3>Sample page</h3>
    
    <p>
        <label for="darkThemeUsed">Use dark theme? – </label>
    </p>
    
    <label for="sidebarShown" class="button">Toggle sidebar</label>
</div>

<div id="footer">
    (c) The 0815 Company
</div>

CSS

body {
  margin: 0;
}

/* animate EVERYTHING! - well, almost. */
* {
  transition: all .2s, height 1ms;
}

[for] {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

#container, #footer {
  width: calc(100% - 2em);
  color: #555;
  padding: 1em;
}
#darkThemeUsed:checked ~ #container,
#darkThemeUsed:checked ~ #footer {
  color: #eee;
}

#container {
  height: calc(100vh - 2em);
  background: #eee;
}
#darkThemeUsed:checked ~ #container {
  background: #333;
}

#sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  width: 260px;
  background: #2196f3;
  margin-right: -304px;
  padding: 20px;
  color: #fff;
  box-shadow: 0 0 4px rgba(0, 0, 0, .5);
}
#sidebarShown:checked ~ #container #sidebar {
  margin-right: 0;
}
#darkThemeUsed:checked ~ #container #sidebar {
  background: #303f9f;
}

h3, h4 {
  margin: 0;
  margin-top: 1.5em;
  margin-bottom: .6em;
}

label {
  cursor: pointer;
}

label[for=darkThemeUsed]:after {
  content: "No"
}
#darkThemeUsed:checked ~ #container label[for=darkThemeUsed]:after {
  content: "Yes"
}

.button {
  display: inline-block;
  font-weight: bold;
  line-height: 36px;
  text-align: center;
  padding: 0 8px;
  min-width: 20px;
  background: rgba(0, 0, 0, .1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  text-transform: uppercase;
  font-size: 90%
}
#darkThemeUsed:checked ~ * .button {
  background: rgba(255, 255, 255, .1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .8);
}

#footer {
  height: 20px;
  position: fixed;
  bottom: 0;
  background: #ddd;
}
#darkThemeUsed:checked ~ #footer {
  background: #444;
}