-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Switch] Support small size #16620
[Switch] Support small size #16620
Conversation
Details of bundle changes.Comparing: b6182ce...94422d1
|
a281a75
to
c7de243
Compare
Fixed problems with prettier, lint etc |
Regarding the UI of the small size. What did you use as inspiration for coming up with the final values / look? For instance, we could make it really small. cc @VMasap. |
88049c1
to
0e5c533
Compare
@oliviertassinari I based the size (height) on size of the small version of the Button component - https://material-ui.com/components/buttons/#sizes (variant |
0e5c533
to
08d8fd7
Compare
@darkowic Ok, thanks for sharing the reflection. I have tried to give it a try. Here is the result I came up with. 1. BenchmarkingI'm looking for any design system that has solved this small problem in the past. I have found:
2. Average sizeWe have the following size: 32x16, 28x16, 28x16, 32x16. So I would propose a thumb size of 16px. Once we have the thumb size, the track size can be defined conserving the same ratio than with the normal size: 16 / 20 -> x0.8. I also want the slider dimensions to align on the 4px grid. 3. Result sizeSmall: {
width: 40,
height: 24,
padding: 7,
'& $thumb': {
width: 16,
height: 16,
},
'& $switchBase': {
padding: 4,
},
}, What do you think? |
17aeb74
to
fe3987b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added the TypeScript definitions and apply some of the review. Any more feedback is welcomed! Otherwise, I hope it's good enough.
fe3987b
to
47864d5
Compare
Rebased. |
47864d5
to
94422d1
Compare
@oliviertassinari Thanks for the research! Great job as always! I am totally ok with this size. Customizing the small size is easy if anyone needs something else. LGTM ;) |
I have added support for switch small size (Closes #16152).
This is how it looks like:

I need help with tests.
yarn test:watch Switch
is not working...should render the right class
What else should I do to merge this feature?