React on-off switch component
npm install react-onoff-switchReact component, on-off sliding button to keep track of a user choice or state.
npm install react-onoff-switch
Simple demo example here.
import OnOff from 'react-onoff-switch'
ReactDOM.render(
document.getElementById('app')
);
| name | type | default | description |
|---|---|---|---|
| initialValue | Boolean | false | The initial state |
| onChange | Function | Change callback, receives current value as argument | |
| width | Number | 100 | Component size, will be used as pixels |
| buttonColor | Stringe | '#FFFFFF' (white) | Button color |
| passiveColor | Stringe | '#FFFFFF' (white) | Passive background color |
| activeColor | Stringe | '#13BF11' (green) | Active background color |