react-simple-switch
A customizable multi state toggle switch library for react
Install
npm i react-simple-switch
Documentation
Read the full Documentation here
Advantages
Create highly customizable toggle switches with ease. Create toggle switches with 3 states.
Usage
Basic usage
import React Component from 'react';import ToggleButton from 'react-simple-switch'; state = toggleState: null ; { this; }; { const toggleState = thisstate; return <div> <p> Do you like Pizzas:' ' <span => toggleState ? 'YES' : 'NO' </span> </p> <ToggleButton = = ="angled" = /> </div> ; }
Creating toggle button with 3 states
import React Component from "react";import ToggleButton from "react-simple-switch"; state = toggleState: false ; { this; }; { const toggleState = thisstate; const genders = 'Female' 'Male' 'Other'; return genderstoggleState - 1; } { return <div> <p>Choose your gender <span>this</span></p> <ToggleButton = = ='rounded' = ='12px' = /> </div> ; }
License
MIT © Manoj Bhat