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

Allow styling using other units #81

Open joshdotblack opened 4 years ago

joshdotblack commented 4 years ago

We're trying to use react-switch in one of our projects & we've hit a bit of a snag with scaling the switch. Most of our layout & sizing is done with rem units, which we change at different breakpoints to let us do responsive design, but react-switch only allows us to set the width/height in px values. Is supporting other units on the roadmap?

lmend22 commented 3 years ago

Having the same issue is there any way to set width/height with CSS?

markusenglund commented 3 years ago

Since these props are used to calculate the handle position internally I don't it would be possible to let the library user specify height="10em" for example. One idea would be to have a separate prop called lengthUnit where the user could specify "em", "rem" or whatever. Is that something people would like?

markusenglund commented 3 years ago

@lmend22 See issue #63

Rafaellarsa commented 2 years ago

Since these props are used to calculate the handle position internally I don't it would be possible to let the library user specify height="10em" for example. One idea would be to have a separate prop called lengthUnit where the user could specify "em", "rem" or whatever. Is that something people would like?

Yes, that would be very useful!