Skip to content

Switch

Turn a setting on or off.

alpina-ui/ui/switch

Interactive preview

Project archive

Job visibility

  • Trail mapIn progress

Usage notes

Use a switch for an immediate on/off setting. Pass its visible label as children, wrap an empty switch in Label, or supply an accessible name. Keep the label meaningful in both states. The ref points to the checkbox input.

When to use

Apply a persistent on/off preference immediately, such as receiving appointment reminders.

When to avoid

A choice collected with other answers for later submission belongs in a checkbox.

Accessibility

Keep a stable accessible name in both states and announce the stored state if an update fails.

Keys
KeyAction
SpaceToggle the focused control.
Tab / Shift+TabContinue to the next or previous control.

Content

Name the preference in a few words. The control communicates its current value, so the label can stay the same after activation.

Use
Appointment reminders
Avoid
Turn off reminders now

Copy in four languages

German
Terminerinnerungen18 characters
French
Rappels de rendez-vous22 characters
Italian
Promemoria appuntamenti23 characters
Romansh
Promemorias per termins23 characters
Add to your project
npx --no-install alpina add switch