IconButton default icon style not properly overriden by iconClassName
Description
Currently IconButton default icon style is not properly overriden by iconClassName property. If I set following properties with closeIcon class overriding icon color's
<IconButton
disableTouchRipple
iconClassName={classNames('ion-md-close', classes.closeIcon)}
/>
I get instead, black color which is the default one.
Images & references
See how the element appears in the console :
and the corresponding css rules:
which leads to this render:

Versions
- Material-UI: 0.16.4
That's expected, the inline-style has a higher specificity. We are referring to that point in the documentation. You have three options:
- Add
!importantwhen you need too. - Override the style using the
inline-style. - Wait for the
nextbranch that is moving away from theinline-stylefor that specific issue.
By the way, it's cool to see that convargo is using the lib. I have a friend working on truckfly.
Since MUI uses inline JS styles, you have to include '!important' with every CSS style declaration.
i.e.
.my-class {
margin: 0 !important;
}
If you use JS inline styles (with the props provided like 'iconStyle') you won't have to use '!important'
@oliviertassinari Ok, I agree that inline-style has higher specificity than className has. But , I was expecting to have DEFAULT inline style overriden by className passed in props overriden by style passed in props as it seems to me that even if inline style is more specific it's DEFAULT behavior and props should always take precedence over the default style written inside components. But that's a matter of taste. Nevertheless, I missed the doc where it was explained so, thanks for the reminder ;)
Aside: Yes, to be honest, we were using the lib for our POC and we are now moving away because of new homemade design, but it was nice and helped us to build quickly ! 👍
@chris-verclytte See ROADMAP.md on more info about the future of styling in this library.