Skip to content

DocsFormsSwitch

PT

Forms

Switch

Turns on and off right away, no save button.

CSS only

Example

Installation

Switch ships in the full package, in unslop.css:

curl -fsSL unslop.leallabs.dev/i | sh

No build It's just CSS: with unslop.css on the page, the classes already work.

Classes and variants

ClassWhat it does
u-switchThe label that wraps the input and the track.
u-switch__trackThe track with the knob.

Accessibility and keyboard

State and roles

WhereAttributeWhat it says
role="switch"on the checkbox inputScreen readers announce on and off.
checkednative attributeOn.

Keyboard

KeyDoes
Tabfocuses the switch
Spacingturns it on and off

Type to search. Arrows pick, Enter opens.