Skip to content
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

Components: Normalize dimensions and font sizes #8884

Open
1 of 2 tasks
danielchalmers opened this issue May 5, 2024 · 6 comments
Open
1 of 2 tasks

Components: Normalize dimensions and font sizes #8884

danielchalmers opened this issue May 5, 2024 · 6 comments

Comments

@danielchalmers
Copy link
Contributor

danielchalmers commented May 5, 2024

Is your feature request related to a problem?

Dimensions are not always consistent between components and some use fractional pixels by default.

MudButton 100% scaling is not pixel perfect which can cause aliasing issues.

Describe the solution you'd like

We keep in mind our ultimate goal of using relative scaling units while defining integer pixel sizes at 100% scaling.

MudButton and ToggleGroup sizes should be staked together.
Current (px - small, medium, large):

  • Button: 30.75, 36.5, 42.25
  • ToggleGroup: 28.88, 36.09, 43.31

New (px - small, medium, large):

  • Button: 28, 36, 44
  • ToggleGroup: 28, 36, 44

These new sizes are 175%, 225%, and 275% of the default root font size of 16px.
A default M2 button is exactly 36px tall. We should compare all to Material Design.

Which other components should be taken care of in this pass? (sizes taken from measuring the docs):

Important things to consider:

  • The sizes could be measured in REM (225% = 2.25rem), but that would not necessarily scale the content and this is something we want to take care of all at once in the same release. Still possible for v7 but a big undertaking.
  • Borders will affect size and may need to be converted to outlines

Have you seen this feature anywhere else?

https://m2.material.io/components
https://m2.material.io/components/buttons#specs
https://m2.material.io/components/snackbars#specs

Describe alternatives you've considered

No response

Pull Request

  • I would like to do a Pull Request

Code of Conduct

  • I agree to follow this project's Code of Conduct
@danielchalmers danielchalmers added enhancement New feature or request triage labels May 5, 2024
@danielchalmers
Copy link
Contributor Author

The sizes in the ToggleGroup were changed in #8676 and @henon suggested staking them to the Button sizes for consistency. I said we should explore changing both to a new standard to improve the quality. This issue was opened to let us discuss this idea in a wider context. We need to at least make a decision on the Button and ToggleGroup sizes before v7 is released.

cc @Garderoben @mckaragoz @ScarletKuro @Mr-Technician

@henon
Copy link
Collaborator

henon commented May 6, 2024

I am all for standardization of sizes. Currently the elements feel like a zoo if you align them next to each other ;).

Off-Topic: Maybe in the process we could aslo finally center the button text vertically. Currently it is slightly off-center (due to the font underline??) which is funny as the button caption is all capitalized. And even if it weren't, it would still look better were it perfectly centered.

@danielchalmers danielchalmers changed the title Normalize component sizes & Avoid fractions Components: Normalize sizing & Avoid aliasing May 6, 2024
@danielchalmers danielchalmers changed the title Components: Normalize sizing & Avoid aliasing Components: Normalize sizing May 6, 2024
@henon henon added this to TODO in The Big Break: Breaking Changes in v7 via automation May 6, 2024
@henon henon added epic and removed triage labels May 7, 2024
@danielchalmers
Copy link
Contributor Author

@henon Just to confirm, if the density changes then the dimensions will change with it? Ex: Button 36px, Button Low Margin 34px #8946

@henon
Copy link
Collaborator

henon commented May 14, 2024

Yes of course the component dimensions will have to shrink accordingly

@henon henon moved this from TODO to TODO in v8 in The Big Break: Breaking Changes in v7 May 19, 2024
@danielchalmers danielchalmers changed the title Components: Normalize sizing Components: Normalize dimensions and font sizes May 20, 2024
@danielchalmers
Copy link
Contributor Author

We need to consider font sizes as well. Button and ToggleGroup (for example) should have the same dimensions AND text size. What does it look like in Material Design 2? That's what we should aim for.

@danielchalmers
Copy link
Contributor Author

The reason some controls look vertically offset is probably due to the excessive line height in the default typographies:

image

M2

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request epic
Development

No branches or pull requests

2 participants