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: Fix subtle layout differences #8884

Open
2 tasks done
danielchalmers opened this issue May 5, 2024 · 8 comments
Open
2 tasks done

Components: Fix subtle layout differences #8884

danielchalmers opened this issue May 5, 2024 · 8 comments
Labels
enhancement New feature or request epic Related issues that are summarized in one issue

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.

Describe the solution you'd like

Go over the sizes of various components and make sure they are exactly to our standard.

Many are 32px or 48px which is perfect already (200% or 300% default font size)

I've debated the idea of moving over to relative units but we really should just stick to pixels when the library is already this mature.

It's not just the raw size though, you have to take into account border sizes, misaligned borders, line height, etc.

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 epic Related issues that are summarized in one issue 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

@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

@danielchalmers danielchalmers moved this to Planned for v8 in Upcoming Breaking Changes Jun 28, 2024
@danielchalmers danielchalmers changed the title Components: Normalize dimensions and font sizes Components: Fix subtle layout differences Aug 5, 2024
@danielchalmers
Copy link
Contributor Author

danielchalmers commented Aug 13, 2024

Users adding a lot of content, or multiline text, to a button would complicate things

MD2 buttons remain at a fixed height of 36px no matter what content is added. In our Styled Button example, we manually change the height.

@dennisrahmen
Copy link
Contributor

@danielchalmers the button height is also very dependent on that text line height value.

Setting the line height to "1" results in the icon with buttons locking like this:
image

But other buttons now look like this (26px in height):
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 Related issues that are summarized in one issue
Projects
Status: In progress
Development

No branches or pull requests

3 participants