I am using CSS modules for my project, but Material Icon is not making the changes specified via className prop
import SettingsIcon from "@mui/icons-material/Settings";
import css from "./LandingPage.module.css";
<SettingsIcon className = {css.settingsButton}/>
LandingPage.module.css file
.settingsButton{
position: absolute;
right: 20;
top: 20;
display: block;
height: 70px;
width: 70px;
transition: transform .7s ease-in-out;
color: white;
}
.settingsButton:hover{
transform: rotate(360deg);
}
The problem is the default
transitionproperty of.MuiSvgIcon-rootis more specified than yours.You need to increase the priority of your css in your
module.cssfile using:globalnotation like this:Note that, in this case
.Appexists my app, if it does not exist in your app, you can wrap your icon with another customdivwith a specific className and use it instead of.App.You can take a look at this StackBlitz for a live working example of this solution.