A simple iOS inspired toggle switch.
npm install --save react-toggle-switch
importReactfrom'react';importSwitchfrom'react-toggle-switch'exportdefaultclassMyComponentextendsReact.Component{toggle(value){// do something with value}render(){return(<div><Switchvalue={'some string or integer value'}on={true}onClick={this.toggle}/><SwitchonClick={()=>this.setState({prop: !this.state.prop})}/><SwitchonClick={this.toggle}><iclass="some-icon"/></Switch></div>);}}onClick- Required function handler for when the switch is clicked.value- Required value that will be passed to the onClick handler.on- Optional prop to set switch on or off. Default is false.
@import"node_modules/react-toggle-switch/dist/css/switch.min.css"