Chi Documentation

Toggle Switch

Toggle switches are used to switch between two possible states.

Examples

To render a toggle switch, apply the classes a-input and -toggle to an input type="checkbox". For proper styling, toggle switches require an empty label element defined immediately after their declaration.

Base

<input type="checkbox" class="a-input -toggle" id="toggle1">
<label for="toggle1"></label>

Disabled

<input type="checkbox" class="a-input -toggle" id="toggle2" disabled>
<label for="toggle2"></label>

No Label

By default, toggle switches are labeled with text ON/OFF. To disable this, apply the modifier -noText.

<input type="checkbox" class="a-input -toggle -noText" id="toggle3">
<label for="toggle3"></label>

Stacked

Group toggle switches in a-formGroup for easy stacking.

Notifications
Outage Alerts
<div class="a-formGroup -mb2">
  <input type="checkbox" class="a-input -toggle -noText" id="toggle4">
  <label for="toggle4"></label>
  <span class="-text">Notifications</span>
</div>
<div class="a-formGroup">
  <input type="checkbox" class="a-input -toggle -noText" id="toggle5">
  <label for="toggle5"></label>
  <span class="-text">Outage Alerts</span>
</div>

Inline

Apply the class -inline to a-formGroup to display toggle switches inline.

Notifications
Outage Alerts
<div class="a-formGroup -inline -mr3">
  <input type="checkbox" class="a-input -toggle -noText" id="toggle6">
  <label class="-mr1" for="toggle6"></label>
  <span class="-text">Notifications</span>
</div>
<div class="a-formGroup -inline">
  <input type="checkbox" class="a-input -toggle -noText" id="toggle7">
  <label class="-mr1" for="toggle7"></label>
  <span class="-text">Outage Alerts</span>
</div>