Nepotistic Pontifex Maximus

    @rajatsehgal/toggle-switch

    0.0.1 • Public • Published

    toggle-switch

    A React component that can be used in place of a checkbox to toggle between two states.

    Live demo

    Demo

    Installation

    npm install @rajatsehgal/toggle-switch --save
    

    Usage

    import React, { Component } from 'react';
    import ToggleSwitch from '@rajatsehgal/toggle-switch/ToggleSwitch';
    
    class App extends Component {
    
      state = {
        status: false
      };
    
      handleToggleSwitchClick = () => {
        this.setState({ status: !this.state.status });
      };
    
      render() {
        return (
          <ToggleSwitch checked={this.state.status} onClick={this.handleToggleSwitchClick}/>
        );
      }
    }
    
    export default App;

    Install

    npm i @rajatsehgal/toggle-switch

    DownloadsWeekly Downloads

    0

    Version

    0.0.1

    License

    ISC

    Last publish

    Collaborators

    • rajatsehgal