Toggle

A switch. .toggle goes on a checkbox; Kobalte's Switch builds it from a Control and a Thumb, with the real input visually hidden. Both shapes work.

alpha The class names and states here are stable. The look is not: these styles can change in a minor release, without a major version bump.

ClassDoes what
toggleThe track, on a checkbox or on Kobalte's Control
toggle-thumbThe knob, on Kobalte's Thumb. Not needed on a checkbox

Basic

<label class="label">
  <input type="checkbox" class="toggle" checked />
  Email me about releases
</label>
<label class="label">
  <input type="checkbox" class="toggle" />
  Email me about everything else
</label>
<label class="label">
  <input type="checkbox" class="toggle" disabled />
  Locked off
</label>

Switch's parts carry no role or attribute of their own: Control, Thumb and the root are all divs with the same data-checked. So the classes go on the parts by hand, .label on the root included, which gives it the same row as a checkbox in a label. The input Kobalte renders is visually hidden with inline styles.