Naturally Produced Modules

    @dhiwise/react-switch

    1.0.1 • Public • Published

    @dhiwise/react-switch

    A simple switch component.

    Made with create-react-library

    NPM JavaScript Style Guide

    Install

    npm install --save @dhiwise/react-switch

    Usage

    import React, { Component } from 'react'
    
    import Switch from '@dhiwise/react-switch'
    import '@dhiwise/react-switch/dist/index.css'
    
    const BasicExample = () => {
      const [checked, setChecked] = useState(false);
      const handleChange = nextChecked => {
        setChecked(nextChecked);
      };
    
      return (
        <div className="example">
          <h2>Simple usage</h2>
          <label>
            <span>Switch with default style</span>
            <Switch
              onChange={handleChange}
              checked={checked}
              className="react-switch"
            />
          </label>
          <p>
            The switch is <span>{checked ? "on" : "off"}</span>.
          </p>
        </div>
      );
    };

    License

    MIT ©

    Install

    npm i @dhiwise/react-switch

    DownloadsWeekly Downloads

    8

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    162 kB

    Total Files

    7

    Last publish

    Collaborators

    • dhiwise