<label class="checkbox">
<input type="checkbox" class="checkbox__input">
<div class="checkbox__state">
<div class="checkbox__control">
<svg class="checkbox__icon">
<use href="../../assets/images/icons_sprite.svg#checkbox"></use>
</svg>
</div>
<div class="checkbox__title">Default</div>
</div>
</label>
<label class="checkbox">
<input type="checkbox" class="checkbox__input" checked>
<div class="checkbox__state">
<div class="checkbox__control">
<svg class="checkbox__icon">
<use href="../../assets/images/icons_sprite.svg#checkbox"></use>
</svg>
</div>
<div class="checkbox__title">Checked</div>
</div>
</label>
<label class="checkbox">
<input type="checkbox" class="checkbox__input" disabled>
<div class="checkbox__state">
<div class="checkbox__control">
<svg class="checkbox__icon">
<use href="../../assets/images/icons_sprite.svg#checkbox"></use>
</svg>
</div>
<div class="checkbox__title">Disabled</div>
</div>
</label>
.checkbox {
display: inline-block;
position: relative;
}
.checkbox__input {
position: absolute;
outline: none;
clip: rect(0, 0, 0, 0);
}
.checkbox__state {
display: flex;
align-items: center;
gap: 0.75em;
}
.checkbox__control {
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
width: 1.75em;
height: 1.75em;
background: var(--main-bg-color);
border: 0.0625em solid var(--grey-2);
border-radius: 0.25em;
cursor: pointer;
}
.checkbox__icon {
width: 15px;
height: 13px;
display: none;
}
.checkbox__title {
font-family: 'Inter', sans-serif;
font-style: normal;
font-weight: 400;
font-size: 1em;
line-height: 1.5em;
color: var(--active-text-color);
}
.checkbox__input:checked ~ .checkbox__state .checkbox__control {
background: var(--ligth-blue);
border: 0.0625em solid var(--ligth-blue);
animation: pulse 0.5s;
}
@keyframes pulse {
0% {
box-shadow: 0 0 0 0 #bdc3c7;
}
100% {
box-shadow: 0 0 1em 1.5rem rgba(189, 195, 199, 0);
}
}
.checkbox__input:checked ~ .checkbox__state .checkbox__icon {
display: block;
}
.checkbox__input:disabled ~ .checkbox__state .checkbox__control {
cursor: default;
background: var(--grey-2);
border: 0.0625em solid var(--grey-2);
}
.checkbox__input:disabled ~ .checkbox__state .checkbox__title {
color: var(--grey-2);
}
.checkbox__input:focus ~ .checkbox__state .checkbox__title {
text-decoration: underline;
}
@media screen and (max-width: 768px) {
.checkbox_main-page-preview {
font-size: 10px;
}
.checkbox_main-page-preview .checkbox__icon {
transform: scale(0.7);
}
}