Sliding tab toggle

Sliding tab toggle: a CSS button. Copy the rules, or the prompt that rebuilds it.

toggletwo-optionradiosegmentedslider

CSS
.btn-088 {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  background: #e5e7eb;
  border-radius: 999px;
  padding: 4px;
  isolation: isolate
}
.btn-088 input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0
}
.btn-088 label {
  position: relative;
  z-index: 1;
  font: 600 13px/1 system-ui,sans-serif;
  color: #4b5563;
  text-align: center;
  padding: 9px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: color .2s
}
.btn-088 span {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
  transition: transform .25s
}
.btn-088 input:nth-of-type(1):checked~span {
  transform: translateX(0)
}
.btn-088 input:nth-of-type(2):checked~span {
  transform: translateX(100%)
}
.btn-088 input:checked+label {
  color: #111827
}
.btn-088 label:hover {
  color: #111827
}
.btn-088 input:focus-visible+label {
  outline: 2px solid #111827;
  outline-offset: -2px
}
.btn-088 label:active {
  color: #000
}
HTML
<div class="btn-088"><input type="radio" name="b088" id="b088a" checked><label for="b088a">Monthly</label><input type="radio" name="b088" id="b088b"><label for="b088b">Yearly</label><span></span></div>
Prompt

A two-option sliding toggle (Monthly / Yearly) made with radio inputs: a grey #e5e7eb pill track with 4px padding, two equal labels at 13px semibold grey #4b5563, and a white pill thumb with a small shadow that slides to sit under the checked option (250ms). The checked label turns #111827. Focus shows a 2px dark outline inside the label.