Skip to main content
  1. Docs
  2. Components
  3. Forms

Switch

A setting, on or off, applied at once. A setting that waits for Save is a Checkbox.

Import
@qeetrix/react
Status
StableSince 0.0.2
Renders
<span role="switch">Server-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

When to use

Use it for
  • A setting that takes effect the moment it's switched.
  • Notification and feature settings, one to a row.
Not for

02

Anatomy

  1. 1switch<div>The row: its <label> makes all of it the target.
  2. 2switch-track<span role="switch">The 32×18 track; Ember while on.
  3. 3switch-thumb<span>The square thumb: at the end side while on, in either direction.

03

Do and don't

At once, or it's a checkbox
DoSwitched, and saved: nothing else to press.
Don'tA switch that waits for Save: that's a Checkbox.
Name the setting
DoWhat's on: "Two-step sign-in".
Don'tThe state as its label: "On".

04

Content

  • Label the setting, never its state.
  • A description says what it changes, or why it can't.
  • Confirm a change that's saved: "Saved."
Next — SwitchAPI