JSFiddle - React, Tailwind, and code Playground
by anup1986
HTML
<span><input type="checkbox"><label></label>I'm an option</span>
SCSS
/* Checkboxes
========================================================================== */
/* CUSTOM CSS CHECKBOXES */
form p {
margin-bottom: 10px;
text-align: left;
}
form p:last-child {
margin-bottom: 0;
}
/* Remove default checkbox */
[type="checkbox"]:not(:checked),
[type="checkbox"]:checked {
position: absolute;
left: -9999px;
opacity: 0;
}
// Checkbox Styles
[type="checkbox"] {
// Text Label Style
+ label {
position: relative;
padding-left: 35px;
cursor: pointer;
display: inline-block;
height: 25px;
line-height: 25px;
font-size: 1rem;
-webkit-user-select: none; /* webkit (safari, chrome) browsers */
-moz-user-select: none; /* mozilla browsers */
-khtml-user-select: none; /* webkit (konqueror) browsers */
-ms-user-select: none; /* IE10+ */
}
/* checkbox aspect */
+ label:before,
&:not(.filled-in) + label:after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 18px;
height: 18px;
z-index: 0;
border: 2px solid $radio-empty-color;
border-radius: 1px;
margin-top: 2px;
transition: .2s;
}
&:not(.filled-in) + label:after {
border: 0;
transform: scale(0);
}
&:not(:checked):disabled + label:before {
border: none;
background-color: $input-disabled-color;
}
// Focused styles
&.tabbed:focus + label:after {
transform: scale(1);
border: 0;
border-radius: 50%;
box-shadow: 0 0 0 10px rgba(0,0,0,.1);
background-color: rgba(0,0,0,.1);
}
}
[type="checkbox"]:checked {
+ label:before {
top: -4px;
left: -5px;
width: 12px;
height: 22px;
border-top: 2px solid transparent;
border-left: 2px solid transparent;
border-right: $radio-border;
border-bottom: $radio-border;
transform: rotate(40deg);
backface-visibility: hidden;
transform-origin: 100% 100%;
}
&:disabled + label:before {
border-right: 2px solid $input-disabled-color;
border-bottom:...