Switch Toggle (Checkbox)
Switch Toggle (Checkbox): CSS-Button. Kopiere die Regeln oder den Prompt, der das Ergebnis nachbaut.
CSS
.btn-086 {
display: inline-flex;
align-items: center;
gap: 10px;
font: 500 14px/1 system-ui,sans-serif;
color: #111827;
cursor: pointer;
user-select: none
}
.btn-086 input {
position: absolute;
opacity: 0;
width: 0;
height: 0
}
.btn-086 span {
position: relative;
width: 44px;
height: 24px;
background: #d1d5db;
border-radius: 999px;
transition: background .2s
}
.btn-086 span::after {
content: "";
position: absolute;
top: 3px;
left: 3px;
width: 18px;
height: 18px;
background: #fff;
border-radius: 50%;
box-shadow: 0 1px 3px rgba(0,0,0,.3);
transition: transform .2s
}
.btn-086 input:checked+span {
background: #16a34a
}
.btn-086 input:checked+span::after {
transform: translateX(20px)
}
.btn-086:hover span {
background: #9ca3af
}
.btn-086:hover input:checked+span {
background: #15803d
}
.btn-086 input:focus-visible+span {
outline: 2px solid #16a34a;
outline-offset: 2px
}
.btn-086:active span::after {
width: 22px
}
HTML
<label class="btn-086"><input type="checkbox"><span></span>Notifications</label>Prompt
Ein Schalter aus einer versteckten Checkbox: eine 44px mal 24px graue #d1d5db Pillen-Schiene mit einem 18px weißen Knopf (3px Inset, kleiner Schatten). Wenn checked, wird die Schiene grün #16a34a und der Knopf gleitet 20px nach rechts (200ms). Hover dunkelt die Schiene; während des Drückens streckt sich der Knopf auf 22px. Label-Text 14px medium rechts. Fokus-Outline 2px Grün.