CSS Toggle Switch

Accessible CSS toggle switch using standard form controls

Light switch

Use the official switch, provided by Foundation, for for simple “On/Off” options.

Toggle switch

Use the toggle switches, instead of radio buttons, for two or more, specific options.

bower install --save css-toggle-switch
component install ghinda/css-toggle-switch
You can use the switches standalone, with Bootstrap or with Foundation.

Light switch

Use the official switch, provided by Foundation, for for simple “On/Off” options. The official Switch component is initially based on code from CSS Toggle Switches.

<div class="switch">
  <input id="y" name="switch-y" type="radio" checked>
  <label for="y" onclick="">Off</label>

  <input id="y1" name="switch-y" type="radio">
  <label for="y1" onclick="">On</label>

  <span></span>
</div>

Toggle switch

Use the toggle switches, instead of radio buttons, for two or more specific options.

<label>View</label>
<div class="switch-toggle panel">
  <input id="week" name="view" type="radio" checked>
  <label for="week" onclick="">Week</label>

  <input id="month" name="view" type="radio">
  <label for="month" onclick="">Month</label>

  <a class="button"></a>
</div>

Multiple options

You can add up to 5 items by using the .switch-3, .switch-4 and .switch-5 classes.

<label>View</label>
<div class="switch-toggle switch-5 panel">
  […]

Different looks

The switches are very flexible, so you can use and combine a number of classes provided by Foundation, along with it's grid, to make them look exactly like you need them.

Get Foundation.