2.0.0 • Published 6 months ago

awesome-react-toggles v2.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

Features

  • Customizable styles and toggle duration. ✅
  • Support onToggle callback. 🔄
  • In-built multiple toggle switch variants. (in-progress) 🚀

Installation

npm install awesome-react-toggles

OR

yarn add awesome-react-toggles

Usage

import { ToggleDefault } from "awesome-react-toggles";

const App = (props: any): JSX.Element => {

    const handleToggle = () => {
      console.log("Toggle works!")
    }

    return (
      <ToggleDefault
        size={5}
        width={4}
        onToggle={handleToggle}
      />
    );
}

Props

namedescriptiontypedefault
sizeOverall size of the entire toggle component.number3.2
widthWidth of the toggle component.number2
onToggleCallback funtion for when the switch is toggled on or off.() => voidundefined
isToggledSets the switch's toggled state on or off based on the given value.booleanundefined
buttonShadowButton's box shadow.string (must be a valid CSS box-shadow value)"rgba(0, 0, 0, 0.35) 0px 5px 15px"
backgroundShadowBackground's box shadow.string (must be a valid CSS box-shadow value)"rgba(50, 50, 93, 0.25) 0px 15px 30px -15px inset, rgba(0, 0, 0, 0.3) 0px 18px 36px -18px inset"
outlineOnFocusWhether the toggle component is outlined when focused or not.booleantrue
outlineColorColor of the outline.string (must be a valid CSS color value)"gray"
outlineWidthWidth of the outline.string (must be a number followed by a valid CSS unit)"1px"
transitionDurationDuration of the transition of the switch from off to on and vice versa.string (must be a number followed by a valid CSS unit)"200ms"
bgColorCheckedBackground color when the switch is toggled onstring (must be a valid CSS color value)"#4cda64"
bgColorUncheckedBackground color when the switch is toggled offstring (must be a valid CSS color value)"#dbdbdb"

Report a bug

If you found a bug in this library, please file a GitHub issue here.

2.0.0

6 months ago

1.0.0

6 months ago

0.0.8

6 months ago

0.0.7

6 months ago

0.0.6

6 months ago

0.0.5

6 months ago

0.0.4

6 months ago

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago