• Skip to main content
  • Select language
  • Skip to search
MDN Web Docs
  • Technologies
    • HTML
    • CSS
    • JavaScript
    • Graphics
    • HTTP
    • APIs / DOM
    • WebExtensions
    • MathML
  • References & Guides
    • Learn web development
    • Tutorials
    • References
    • Developer Guides
    • Accessibility
    • Game development
    • ...more docs
B2G OS
  1. MDN
  2. Archive of obsolete content
  3. B2G OS
  4. Firefox OS apps
  5. Firefox OS Building Blocks
  6. Firefox OS 1.x building blocks
  7. Switch

Switch

In This Article
  1. Characteristics
  2. Visuals
    1. Placement
      1. Edit switches
      2. All other switches
  3. See also

A switch is any control which presents two mutually exclusive options or states. Switches are also used to select items within lists. See the Coding guide for details on implementing switches in your apps.

Characteristics

  • A switch presents two mutually exclusive choices or states.
  • There are three types of switch:
    • On/Off toggle switches
    • Checkboxes
    • Radio buttons

Visuals

Below are the various available states of the different styles of switches.

  Checkbox Radio button Toggle
  Normal Danger Normal Danger
Off
On

There are also function buttons. These are buttons in a toolbar that are used to toggle features on and off. For example:

Off On

Placement

Depending on the context in which a switch is used, you will position it differently.

Edit switches

Edit switches, such as these switches being used to let the user choose multiple messages to delete, are placed to the left of the content to which they refer while in edit mode.

All other switches

All other switches, including checkboxes and on/off switches, are always placed to the right of their labels or context.

See also

  • Switch coding guide
  • Firefox OS user experience

Document Tags and Contributors

Tags: 
  • Apps
  • B2G
  • Firefox OS
  • Firefox OS UX
  • UX
 Contributors to this page: chrisdavidmills, Sheppy
 Last updated by: chrisdavidmills, Feb 27, 2017, 2:57:22 AM