0.0.1 • Published 7 years ago

react-ui-toggler v0.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

License: MIT Build Status Coverage Status

A simple and effective react toggle component.

webp net-gifmaker 2

Props

The component takes the following props.

PropTypeDefaultDescription
disabledbooleanfasleIf true, the toggler is disabled. If false, the toggler is enabled.
isActivebooleanfalseIf true, the toggler is checked. If false, the toggler is unchecked.
offLabelstringYou can pass any string to be shown when toggler is off.
onChangefunctionCallback function to invoke when the user clicks on the toggler. The function signature should be the following: const func = (e, isActive) => { }. Function returns event and toggler status whether it's active or not.
onLabelstringYou can pass any string to be shown when toggler is on.

Examples

Find more examples here

Installation

npm install react-ui-toggler --save

Usage

Include the component's CSS with

import "react-ui-toggler/dist/react-ui-toggler.min.css" // for ES6 modules
// or
require("react-ui-toggler/dist/react-ui-toggler.min.css") // for CommonJS

Development

npm install
npm start

Test

npm test

Build

npm run build

License

MIT