MaterialUI Icon fontSize overwrriten by Materialicons font CSS when using injectFirst
See original GitHub issueI am using injectFirst
so I can overwrite some MUI styles in my stylesheets. The problem is that the .material-icons
class from https://fonts.googleapis.com/icon?family=Material+Icons now overwrites the CSS that <Icon fontSize='small'>
sets. So the font-size
is always the 24px
.
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
.material-icons {}
CSS overwrites the one generated my MUI for icons (such as font-size
).
Expected Behavior 🤔
The Google MaterialIcons CSS is included before any changes made by MUI.
Steps to Reproduce 🕹
Steps:
- Use
injectFirst
on StylesProvider <StylesProvider injectFirst>. - Include Material Icons in your CSS (head):
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
- Use an
Icon
component and try to change the size:<Icon fontSize='small'>help</Icon>
. - The fontSize is still the initial
24px
from the.material-icons
CSS class.
Context 🔦
Your Environment 🌎
Windows 10, Chrome 80.
Tech | Version |
---|---|
Material-UI | v4.9.3 |
React | v16.2 |
Browser | Chrome 80 |
TypeScript | 3.7.5 |
I don’t have a perfect solution for , maybe injectFirst
should somehow only inject after the MUI CSS dependencies.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
MaterialUI Icon fontSize overwrriten by Materialicons font CSS ...
I am using injectFirst so I can overwrite some MUI styles in my stylesheets. The problem is that the .material-icons class from ...
Read more >Change MaterialUI icons font size in css - Stack Overflow
MaterialUI icons use the default size 24px . If you want to change this size without using the icons size classes provided by...
Read more >Icon API - Material UI - MUI
Learn about the props, CSS, and other APIs of this exported module. ... class that suits the icon font you're using (e.g. material-icons-rounded,...
Read more >@material-ui/icons | Yarn - Package Manager
This package provides the Google Material icons packaged as a set of React components. Installation. Install the package in your project directory with:...
Read more >Icon Fonts — Vuetify
Vuetify is a Material Design component framework for Vue.js. ... with support for Material Design Icons, Material Icons, Font Awesome 4 and ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Cristy94 We document alternatives to the HTML comment.
I just now tried your solution and it worked. Thank you!