0.1.1 • Published 5 years ago

mi-toggle-switch v0.1.1

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

Mi-Toggle-Switch

version license type npm

Mi-Toggle-Switch is a React component library build with styled-components. It will help you create a Toggle Switch component very fast and extremely easy in ReactJS.

Mi-Toggle-Switch component

Installation

You can use either npm

npm i mi-toggle-switch

or yarn

yarn add mi-toggle-switch

Basic Usage

import React from 'react';
import { MiToggleSwitch } from 'mi-toggle-switch';

class App extends React.Component {
  render() {
    return (
      <MiToggleSwitch />
    );
  }
}

export default App;

PropTypes and defaultProps

PropTypeDefaultDescription
isEnablebooleanfalseIf true, the switch is set to checked. If false, it is not checked.
typeoneOf('rectangular', 'rounded')'rounded'If 'rectangular' => create Rectangular Toggle Switch. If 'rounded' => create Rounded Toggle Switch
activeColorstring'#62c28e'Set color when it is checked
deactiveColorstring'#cccccc'Set color when it is not checked
widthnumber32*1.625Set width of the Toggle Switch
heightnumber32Set height of the Toggle Switch
ballColorstring'#ffffff'Set ball background color
spacingnumber2Set space between ball and Toggle Switch container
onClickFunctionundefinedCallback when click Toggle Switch
onStateChangedFunctionundefinedCallback when change state Toggle Switch
isStateChangebooleantrueEnable and disable change state Toggle Switch when click it.

License

Mi-Toggle-Switch is MIT licensed.