JSFiddle - React, Tailwind, and code Playground

by moob

HTML

<div class="container">
    <label class="blue">
      <input type="checkbox" />
      <div><span>You picked Blue</span></div>
    </label>
    <label class="red">
      <input type="checkbox" />
      <div><span>You picked Red</span></div>
    </label>
    <label class="green">
      <input type="checkbox" />
      <div><span>You picked Green</span></div>
    </label>
    <label class="purple">
      <input type="checkbox" />
      <div><span>You picked Purple</span></div>
    </label>
  </div>
  <!--
  TODO: try having the inputs outside so we can say 
  :checked label {scale:0.1}
  #blue:checked .blue {scale:1}
  #blue:checked #content {background: lightblue;}
  -->

CSS

@import url("https://fonts.googleapis.com/css?family=Lato:300");
* {
  -webkit-transition: all 0.7s ease;
  transition: all 0.7s ease;
  box-sizing: border-box;
}
body {
  background: rgba(0,168,255,0.1);
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
      -ms-flex-pack: center;
          justify-content: center;
  -webkit-box-align: center;
  -webkit-align-items: center;
      -ms-flex-align: center;
          align-items: center;
  width: 100vw;
  height: 100vh;
  font-family: 'Lato', sans-serif;
  font-weight: 300;
  overflow: hidden;
}
body .container {
  background: #fff;
  width: 416px;
  height: 128px;
  border-radius: 16px;
  color: #fff;
  font-size: 16px;
  z-index: 1;
  overflow: hidden;
  position:relative;
  box-shadow:0px 20px 60px -40px #000;
}

body .container .blue div {
  background: #00a8ff;
  margin-left: 32px;
  margin-top: 32px;
}
body .container .red div {
  background: #ff605f;
  margin-top: 32px;
  margin-left: 128px;
}
body .container .green div {
  background: #96d100;
  margin-top: 32px;
  margin-left: 224px;
}
body .container .purple div {
  background: #d066fa;
  margin-top: 32px;
  margin-left: 320px;
}
body .container {
 padding:8px;
}
body .container label:hover {
  cursor: pointer;
}
body .container div span {
    display:inline-block;
    padding:20px;
    opacity:0;
}
body .container input[type="checkbox"] {
    position:absolute;
    opacity:0.001;
}
body .container input[type="checkbox"] + div {
    display:block;
    width:100%;
    min-width:64px;
    min-height:64px;
    max-width: 64px;
  max-height: 64px;
  border-radius: 8px;
  z-index: 2;
  position: absolute;
  top:0;
  left:0;
  bottom:0;
  right:0;
}
body .container input[type="checkbox"]:checked + div {
    margin:8px;
    max-width:100%;
    max-height:100%;
    z-index:100;
    width:auto;
}
body .container input[type="checkbox"]:checked + div span {
   ...