# Switch toggle (checkbox) (B 086)

Category: Buttons  
Tags: toggle, switch, checkbox, pill  
Page: https://designforai.dev/snippet/btn-086

## Prompt

A toggle switch built from a hidden checkbox: a 44px by 24px grey #d1d5db pill track with an 18px white knob (3px inset, small shadow). When checked the track turns green #16a34a and the knob slides 20px right (200ms). Hover darkens the track; while pressing, the knob stretches to 22px. Label text 14px medium on the right. Focus outline 2px green.

## HTML

```html
<label class="btn-086"><input type="checkbox"><span></span>Notifications</label>
```

## CSS

```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
}
```
