react-onoff-switch

1.0.0 • Public • Published

OnOff switch button

React component, on-off sliding button to keep track of a user choice or state.

React on off switch button

Install from npm

npm install react-onoff-switch

Demo

Simple demo example here.

API

Usage

import OnOff from 'react-onoff-switch'
ReactDOM.render(
	<OnOff onChange={(value) => console.log('New value is:', value)}/>,
	document.getElementById('app')
);

props

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

Readme

Keywords

Package Sidebar

Install

npm i react-onoff-switch

Weekly Downloads

4

Version

1.0.0

License

ISC

Last publish

Collaborators

  • sergiocrisostomo