Skip to content

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OnOff switch button

React component, on-off sliding button to keep track of a user choice or state.
Click or drag to change state, no extra CSS file(s).

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

About

On-Off switch React component

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages