-
-
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
[material-ui][Button] Text not aligned vertically with icon #19584
Comments
This comment was marked as outdated.
This comment was marked as outdated.
Can someone look into this? It feels wrong that the default icons provided with Material UI used with the components aren't aligned properly. |
Still an issue, button with icons looks vertically aligned on Firefox but not in Chrome |
I found this helped in the theme:
|
Here is my solution
|
It seems like the lineHeight like @brstewart mentioned. Removing this seems to align them perfectly. |
@brstewart answer also overwrites other size buttons (e.g. "medium"), and breaks those buttons aesthetically. Is there a way to apply this to only size="small" buttons? |
We have a new report about this bug, now showing in Windows but not macOS: #43545. I can confirm this is present in the latest versions of v5 and v6, so I'm reopening this one and adding the ready-to-take label. Finally, I'm adding it to the v7 milestone so we remember to cover it when implementing Material Design 3. This doesn't mean we'll have to wait until v7; hopefully, we'll get a fix sooner. It's only a reminder, so we fix it once and for all by, at most, v7. The live repro link is still the demo: https://mui.com/material-ui/react-button/#buttons-with-icons-and-label |
It looks very close to #29965 for macOS. Do we consider those duplicates or we use #19584 for Windows? The diff --git a/packages/mui-material/src/styles/createTypography.js b/packages/mui-material/src/styles/createTypography.js
index 277808d2a7..11210f652f 100644
--- a/packages/mui-material/src/styles/createTypography.js
+++ b/packages/mui-material/src/styles/createTypography.js
@@ -69,7 +69,7 @@ export default function createTypography(palette, typography) {
subtitle2: buildVariant(fontWeightMedium, 14, 1.57, 0.1),
body1: buildVariant(fontWeightRegular, 16, 1.5, 0.15),
body2: buildVariant(fontWeightRegular, 14, 1.43, 0.15),
- button: buildVariant(fontWeightMedium, 14, 1.75, 0.4, caseAllCaps),
+ button: buildVariant(fontWeightMedium, 14, 1.7, 0.4, caseAllCaps),
caption: buildVariant(fontWeightRegular, 12, 1.66, 0.4),
overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps),
// TODO v6: Remove handling of 'inherit' variant from the theme as it is already handled in Material UI's Typography component. Also, remember to remove the associated types. which works with the couple of fonts that I could test on Windows and macOS. I have no idea why this works 🙃 |
When button has an icon, text is not aligned vertically.
You can see it at example page.
I made an screenshot and check at graphics designer - button "delete" has 12px from top to text and 14px from text to bottom. While icon has exactly 10px from top and from bottom.
The text was updated successfully, but these errors were encountered: