Using Rebass/Forms in react and I cannot properly resize the Switch component using styles properly. (I also am using @emotion/styled)
I have tried using a size attribute, but that does not give the desired effect of simply changing the scale of the switch.
I have tried using the sx property and giving it a width and a height, but that only resizes the button element and not the inner div which is the "sliding dot"
I know that I could write some styling targeting the inner div itself, but I would like to find a way to give it a height and width a single time and it apply to both the button and the inner div.
<Switch
sx={{ width: "30px", height: "15px" }}
/>
It is not possible to do what you want 'out of the box' because the height and width are hard coded in the source
Luckily the internals of
rebassare very nice, so it's possible to create your own with a little copy-pasta from the rebass source code.https://codesandbox.io/s/styling-rebass-switch-r6tmx?file=/src/App.js