While utilizing IconButton from @material-ui/core in my React application, I assigned the className classes.myCloseButtonstyle
. However, it appears that this specific class has a lower specificity compared to the CSS classes
.css-1743419-MuiButtonBase-root-MuiIconButton-root
(refer to the screenshot below).
https://i.sstatic.net/s7RnT.png
Upon checking the documentation here at https://next.material-ui.com/components/dialogs/#customized-dialogs, I noticed that the order is different than what was displayed in the aforementioned screenshot. In the material ui example code, the classes.myCloseButtonstyle
actually takes precedence over the
.css-1uaxfgw-MuiButtonBase-root-MuiIconButton-root
classes (see the screenshot below).
https://i.sstatic.net/8Lkhy.png
I am puzzled by what might be going wrong in my React Material UI setup. My main goal is to ensure that classes.myCloseButtonstyle
gains higher specificity. To clarify, I aim to reverse the order of
.css-1uaxfgw-MuiButtonBase-root-MuiIconButton-root
and classes.myCloseButtonstyle
.
Here is the correct styles order based on the material-ui doc:
classes.myCloseButtonstyle
2.
.css-1uaxfgw-MuiButtonBase-root-MuiIconButton-root
And here is how the styles are currently ordered in my app:
.css-1uaxfgw-MuiButtonBase-root-MuiIconButton-root
classes.myCloseButtonstyle
I urgently need to rearrange the order as follows:
classes.myCloseButtonstyle
.css-1uaxfgw-MuiButtonBase-root-MuiIconButton-root