Skip to content

Search Feitio

↵ opens the first↑↓ chooseEsc closes

Switch

An on and off switch for a setting, with the state written next to it. It applies when the person saves, like any field.

On this page

Playground

State
Background
HTML
<label class="feitio-switch" data-on="On" data-off="Off"><input type="checkbox" role="switch">E-mail notices<span class="state">Off</span></label>

When to use

When not to use

Examples

In a settings form

The switch changes the written state right away, but the setting only applies when the person saves; feedback shows on the form.

Show code
HTML
<label class="feitio-switch">
  <input type="checkbox" role="switch" name="lembretes" checked>
  Lembretes do dia
  <span class="state">Ligado</span>
</label>

States

Off
On
Disabled

Accessibility

Attributes

AttributeValuesWhat for
class="feitio-switch"on the <label>The switch, the text and the state.
role="switch"on the inputScreen readers announce on or off.
class="state"the state"On" or "Off", in words.
Top