markusenglund / react-switch

A draggable toggle-switch component for React. Check out the demo at:
https://react-switch.netlify.com/
MIT License
1.33k stars 100 forks source link

Add custom hover colors to background and handle. Fixes #61 #62

Open sjarva opened 4 years ago

sjarva commented 4 years ago

Add custom onHoverColor, offHoverColor, onHoverHandleColor and offHoverHandleColor as optional props. Fixes #61

markusenglund commented 3 years ago

Hi, sorry for not responding earlier.

When dragging the handle of the switch, the color flickers when the handle goes to either end of the switch (Chrome 87, Ubuntu). react-switch-flicker Regardless of whether that can be fixed, I'm not sure I will accept this PR. Expanding the API with four new props for a small feature is probably not worth it. I'm open to changing my mind about it.

Currently, you can do hover styles with CSS although it's a bit hacky and I don't you can vary it depending on checked state.

.react-switch:hover .react-switch-bg {
  background: red;
}