Smooth Slide Toggle
Pill toggle with gradient fill. The thumb glides on a cubic-bezier curve.
Smooth Slide Toggle the 1st of 23 designs in the 23 CSS Checkboxes collection. The design is implemented in pure CSS — no JavaScript required. Copy the HTML and CSS panels below into your project. Because the demo is pure CSS, it works in any framework or templating engine you happen to use. The design honours prefers-reduced-motion and uses real semantic markup, so it ships accessibility-ready out of the box.
Live preview
The code
<label class="cb-toggle">
<input class="cb-toggle__input" type="checkbox" checked />
<span class="cb-toggle__track">
<span class="cb-toggle__thumb"></span>
</span>
<span class="cb-toggle__label">Smooth slide toggle</span>
</label> .cb-toggle {
display: inline-flex; align-items: center;
gap: 10px; cursor: pointer; user-select: none;
}
.cb-toggle__input { display: none; }
.cb-toggle__track {
width: 44px; height: 24px; border-radius: 12px;
background: rgba(255,255,255,.1);
border: 1px solid rgba(255,255,255,.15);
position: relative;
transition: background .3s cubic-bezier(.23,1,.32,1),
border-color .3s;
}
.cb-toggle__thumb {
position: absolute; top: 3px; left: 3px;
width: 16px; height: 16px; border-radius: 50%;
background: #fff;
box-shadow: 0 2px 6px rgba(0,0,0,.3);
transition: transform .3s cubic-bezier(.23,1,.32,1);
}
.cb-toggle__input:checked + .cb-toggle__track {
background: linear-gradient(135deg, #7c6cff, #ff6c8a);
border-color: transparent;
}
.cb-toggle__input:checked + .cb-toggle__track .cb-toggle__thumb {
transform: translateX(20px);
}