← Каталог
Типовые элементы интерфейса — Чекбоксы
Фрагмент из «Типовые элементы интерфейса»: Чекбоксы.
.checkbox {
display: flex;
align-items: flex-start;
gap: 0.75rem;
cursor: pointer;
user-select: none;
line-height: 1.4;
}
.checkbox input {
position: absolute;
opacity: 0;
width: 0;
height: 0;
}
.checkbox-box {
position: relative;
display: inline-block;
width: 20px;
height: 20px;
border: 2px solid #CED4DA;
border-radius: 4px;
background-color: rgb(122, 73, 73);
flex-shrink: 0;
transition: border-color 0.2s ease, background-color 0.2s ease;
}
.checkbox input:focus + .checkbox-box {
border-color: var(--color-primary);
box-shadow: 0 0 0 3px rgba(123, 104, 238, 0.2);
}
.checkbox input:checked + .checkbox-box {
background-color: var(--color-primary);
border-color: var(--color-primary);
}
.checkbox input:checked + .checkbox-box::after {
content: "✓";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
font-size: 12px;
font-weight: bold;
} .checkbox {
display: flex;
align-items: flex-start;
gap: 0.75rem;
cursor: pointer;
user-select: none;
line-height: 1.4;
}
.checkbox input {
position: absolute;
opacity: 0;
width: 0;
height: 0;
}
.checkbox-box {
position: relative;
display: inline-block;
width: 20px;
height: 20px;
border: 2px solid #CED4DA;
border-radius: 4px;
background-color: rgb(122, 73, 73);
flex-shrink: 0;
transition: border-color 0.2s ease, background-color 0.2s ease;
}
.checkbox input:focus + .checkbox-box {
border-color: var(--color-primary);
box-shadow: 0 0 0 3px rgba(123, 104, 238, 0.2);
}
.checkbox input:checked + .checkbox-box {
background-color: var(--color-primary);
border-color: var(--color-primary);
}
.checkbox input:checked + .checkbox-box::after {
content: "✓";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
font-size: 12px;
font-weight: bold;
}