.checkbox-box-sizes() { top: 0; left: 0; width: 18px; height: 18px; border: 2px solid #999; transform: rotate(0deg); } .checkbox-mark-sizes() { top: -1px; left: 5px; width: 10px; height: 18px; border: 2px solid #0F9D58; border-width: 0 2px 2px 0; transform: rotate(45deg); } .checkbox-result-sizes() { top: 13px; left: 5px; width: 4px; height: 4px; transform: rotate(45deg); } .e-component { white-space: nowrap; * { display: inline-block; } select:focus { outline: 1px dotted; } span { margin: 0 0.5em; white-space: normal; } select + span { padding: 2px 0; } } .e-checkbox { cursor: pointer; margin-bottom: 6px; padding: 2px 0; &:focus-within { outline: 1px dotted; } &.disabled { cursor: not-allowed; opacity: 0.5; } } .e-checkbox.material-design { line-height: 20px; width: auto !important; > div { position: relative; width: 18px; } > div > div { position: absolute; .checkbox-box-sizes(); animation: checkmark-to-box 200ms ease-out forwards; } input { opacity:0; } input:checked + div { .checkbox-mark-sizes(); animation: box-to-checkmark 200ms ease-out forwards; } } @keyframes box-to-checkmark { 0% { .checkbox-box-sizes(); } 50% { .checkbox-result-sizes(); } 100% { .checkbox-mark-sizes(); } } @keyframes checkmark-to-box { 0% { .checkbox-mark-sizes(); } 50% { .checkbox-result-sizes(); } 100% { .checkbox-box-sizes(); } }