A simple iOS inspired toggle switch.
npm install --save react-toggle-switch
importReactfrom'react';import{render}from'react-dom';importSwitchfrom'react-toggle-switch'exportdefaultclassMyComponentextendsReact.Component{render(){return(<div><SwitchonClick={()=>this.setState({prop: !this.state.prop})}/><SwitchonClick={this.toggle}><iclass="some-icon"/></Switch><Switchenabled={false}/><SwitchclassName='other-class'/></div>);}}onClick- Function handler to be called any time the switch is clicked.on- Sets the switch on or off. This can be useful if you want to update the state of the switch without actually clicking on it. Default isfalse.enabled- If set tofalse, the switch cannot be toggled. Default istrue.className- An optional classname for the root element
@import"node_modules/react-toggle-switch/dist/css/switch.min.css"