react-toolbox/components/switch
Javi Velasco 67ab8746a9 Proper import path for documentation files 2015-11-10 11:07:43 +01:00
..
_config.scss Csscomb and better style for switch scss 2015-10-21 01:21:01 +02:00
index.jsx Alphabetical Order for properties and methods 2015-11-07 09:36:51 +07:00
readme.md Proper import path for documentation files 2015-11-10 11:07:43 +01:00
style.scss Csscomb and better style for switch scss 2015-10-21 01:21:01 +02:00

readme.md

Switch

On/off switches toggle the state of a single settings option. The option that the switch controls, as well as the state its in, should be made clear from the corresponding inline label. Switches take on the same visual properties of the radio button.

import Switch from 'react-toolbox/lib/switch';

const SwitchTest = () => (
  <fieldset>
    <Switch label="Push notifications" />
    <Switch checked label="Mail notifications" />
    <Switch disabled label="Nothing, thanks"/>
  </fieldset>
);

Properties

Name Type Default Description
checked Boolean false If true, the switch will be enabled.
className String '' Sets a class to give custom styles to the switch.
disabled Boolean false If true, component will be disabled.
label String The text string to use for the floating label element.
name String The text string used as name of the input.
onBlur Function Callback function that is fired when when the switch is blurred.
onChange Function Callback function that is fired when the components's value changes.
onFocus Function Callback function fire when the switch is focused.