-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
ToggleGroup: Replace Dense
with Size
& Use relative scaling
#8676
Conversation
Sizes need to be 1:1 to buttons and the icons need to be the same font size as the button text. Currently looks like: video1.mp4@mckaragoz Do you think I'm on the right track? |
So |
I ran into a ton of issues with video1.mp4Please try it and let me know what your thoughts on this approach are. I strongly recommend transitioning to I've also addressed border artifacts but need my work checked. @mckaragoz @ScarletKuro @henon #1692 |
apply border radius to group, not items, to fix weird artifacts
dde96c0
to
65b7282
Compare
@ScarletKuro Could you give me a hand getting this up to date with |
Done |
@danielchalmers sorry, I messed up. I wasn't aware you removed |
We have to start somewhere and work out the kinks, no?
It didn't match the buttons originally. I know I said that in the first place but is it necesary to strictly match the buttons?
Yes, still needs work. Not sure why I took it off draft.
Thanks, will check that.
That's probably a good idea |
@Garderoben Is moving to relative units a realistic goal, or is the plan to stick with |
&.mud-toggle-group-size-small { | ||
font-size: 100% !important; | ||
} | ||
|
||
&.mud-toggle-group-size-medium { | ||
font-size: 120% !important; | ||
} | ||
|
||
&.mud-toggle-group-size-large { | ||
font-size: 140% !important; | ||
} |
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.
Set the root level of scaling, roughly inline with the buttons. This propagates to the other styles.
p { | ||
font-size: 0.875em !important; | ||
} |
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.
Text size is the default button (Medium). No need to set font-sizes for each size because this is automatically scaled from the group size as it's using em
.
@mckaragoz what do you say about this changes? i went over some concerns with @danielchalmers on discord about custom content size changing, he will fix that now, but overall i'm fine with the changes. |
@henon i approved this, we could merge it just want to see if @mckaragoz has any opinion about it first. However i think the rest of the library should be done all together, but i want to point out that even though we had some size changes in this PR i think the other components should not have any visible difference when implementing this. |
OK, but shouldn't then |
Oh I see, they are nearly the same size now. But not exactly. So later when |
@henon I chose to use slightly different values here because I was changing it from Dense/Norm, but it's entirely up to us. When it comes to the buttons, or any other component, we can keep the sizes the same. EM/REM doesn't force any decision. We could make this new toggle group match the buttons perfectly if we wanted to. |
I guess then toggle group's size should be exactly the same as button. That will also ease the transition, because you wouldn't even see the difference and we could really do it step by step, component by component. As long as you don't scale you wouldn't notice. Isn't that right @Garderoben ? |
@henon Are we sure we want to create that dependency and tie these two controls together? Even square icon buttons are not the same size as regular buttons. |
I would say that with exactly the same content all componnets should be of the same height. |
But it is literally a button group with selection functionality |
Sorry, this argument doesn't make much sense. I am talking about components which look alike and how it would be good from a design point of view if they are also the same size. |
@henon Surely if someone wants them to be the same size they would just set the container's dimensions themselves and let them scale. Do people rely on the given sizes? |
Great idea. Let's make every element different in size ... |
There is a 2.25px difference in those two components (40px vs 42.25px). 42.25px should be a REM height of 2.640625 at the default 16px scale if we want to stake it to that but it depends on the browser and system settings. Are we wanting to match the button sizes 1:1 down to the fraction? Is it possible we should be looking at changing the buttons to remove the fractions to be like other controls and avoid aliasing issues? I don't mind staking them but since we don't have a consensus can we do it in a follow up PR so I don't lose this iteration that's already tested? We can merge after preview1 if necessary. |
Yeah, that might be a good idea. I guess it can be done later. So what is the current size of the ToggleGroup in px? Is it fit to be the new standard size for all components after a switch to rem? |
@henon Currently:
None are a good standard right now. The new standard could be something like 28, 36, 44, which is 175%, 225%, 275%. For preview2 we could carefully take a look at all components and see if there are any other fractional units or ones that don't match. |
This sounds good. So shall we apply this scheme to the toggle group now to avoid having to change it again later? Standard M2 Button is exactly 36. I don't know why ours is 36.5 |
@henon Would definitely prefer to merge this PR then fix both the buttons and this in a follow up so I don't lose this iteration of the code. We can get a wider discussion going too. |
Or you copy the branch and create a new PR, then by keeping this branch you'll also not lose this iteration and we don't need to merge half-baked stuff |
@henon Do I change the buttons in this same PR? If not then it's not really half-baked considering we don't have any solid plans for what comes next. I understand not wanting PRs that seem like WIPs to be merged but this revision was already signed off on by @Garderoben and if we decide those numbers I suggested aren't right I'll have to go back and change it again, which makes it just as much of a WIP. Or have it go stale in the meantime and fix conflicts while we work on a new consensus. It's much easier to just come back and tweak the numbers since we have the luxury of working in previews right now. I have no intentions of letting this stay like this in v7 stable, but letting people play around with the dev versions can result in good feedback on different approaches, which is crucial for a major change like |
Fair enouch ;) |
Thanks @henon, I'll make sure to write up a proposal and get people's attention about your concerns because I think it makes a lot of sense. Let me know if you have any other components in mind other than MudButton and MudToggleGroup |
Description
Replaces the
Dense
property with aSize {Small, Medium, Large}
in MudToggleGroup. This sizing is done through relative units which flows to the childMudToggleItem
s without needing individual pixel measurements for each part of the component.Resolves #8224
How Has This Been Tested?
visually
Types of changes
video2.mp4
Checklist
dev
).