1.1.13 • Published 4 years ago

react-switcher-rc v1.1.13

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

Swticher Component For React

npm npm Build Status Netlify Status gzip size

Demo

Switcher Component

Features

  • Draggable with the mouse or with a touch screen.
  • Customizable - Easy to customize size, color and more.
  • Very light weight
  • You can overide css properties

Installation

npm install react-switcher-rc

Usage

import React, {useState} from 'react';
import Switcher from 'react-switcher-rc';

function SwitcherExample() {
    const [switcherState, setSwitcherState] = useState(false);
    const onHandleChange = e => {
        setSwitcherState(e.target.checked);
    }
    return (
        <div>
            <Switcher 
                name="my-switcher"
                onChange={onHandleChange}
                checked={switcherState}
            />
        </div>
    )
}
PropsTypeDescription
checkedbooleanRequired. If true, the switch is set to checked. If false, it is not checked.
onChangefuncRequired. Invoked when the user clicks or drags the switch. It passed event
disabledbooleanDisabled the component
onColorStringCan be hash or color #000 or red

Development

You're welcome to contribute to react-switch. Keep in mind that big changes have to be thoroughly tested on lots of different browsers and devices before they can be merged.

To set up the project:

  1. Fork and clone the repository
  2. $ npm install
  3. $ npm run start

To Do

  • Convert it to styled components
  • Test Cases
  • Prelint configurations

Contributors

License

MIT

1.1.1

4 years ago

1.1.12

4 years ago

1.1.13

4 years ago

1.1.0

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago