aaronshaf / react-toggle

Elegant, accessible toggle component for React. Also a glorified checkbox.
http://aaronshaf.github.io/react-toggle/
MIT License
949 stars 157 forks source link

Added the new classes and improved tests #158

Closed Kikketer closed 2 years ago

Kikketer commented 4 years ago

I needed the ability to set the class names of the specific elements within the toggle. An example would be using something like Bootstrap where you get classes like .bg-good: https://getbootstrap.com/docs/4.4/utilities/colors/

Currently react-toggle is designed in the fact that you edit your own CSS but in my case I needed to change the classNames because the CSS file was generated and provided elsewhere.

Disabled variants are not needed right now since the opacity and general "can't click it" interaction is already there. Potential future additions like trackClassNameDisabled may be useful.

These types of "inject a class name to an inner component" was inspired by https://github.com/wojtekmaj/react-date-picker#readme where you are able to provide a few more individual class names to internal components.

As a bonus I've added an additional test for disabled + click.

Kikketer commented 2 years ago

Closing due to inactivity