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

Additional Props: backgroundBorderStyle, disableBackground #39

Closed mgrubinger closed 5 years ago

mgrubinger commented 5 years ago

Hi!

Thanks for creating this cool react switch!

I was missing the possibility to create an "outline"-style switch using the available props. Like this:

bildschirmfoto 2019-02-28 um 08 54 01 bildschirmfoto 2019-02-28 um 08 54 16

I added two props to make this possible:

I also updated the README.md to reflect those two new props.

Let me know what you thing or if anything is missing.

Thanks, -Martin

markusenglund commented 5 years ago

Hi,

I like that look for the component, but I have some concerns about the implementation.

  1. I want to keep the public API as small and simple as possible, since more props adds confusion for library users and everything that's added has to be basically supported forever. Adding two new props can be ok, but since they're not really useful for anything other than this use case I'm hesitant.
  2. By setting the background to 'border-box' we break the positioning of the icons inside the switch.

Overall I feel like this adds more overhead than it's worth.

mgrubinger commented 5 years ago

Hi!

Thanks for your answer and explanation. I understand your point, and I realized I can do most of this using css anyway. :)