TeamWertarbyte / material-ui-search-bar

Material design search bar
https://mui.wertarbyte.com/#material-ui-search-bar
MIT License
260 stars 82 forks source link

Cant change the Icon hover effect #98

Open jerviechronix opened 3 years ago

jerviechronix commented 3 years ago

image

I cant override the hover effect of the Icon.

SnekCode commented 3 years ago

Hello!

Start with a style hook like so

const useStyles = makeStyles((theme) => ({
  searchIconButton: {
    backgroundColor: "#EFD26E",
    position: "relative",
    "&:hover": {
      backgroundColor: "green",
    },
  },
}));

grab the classes object that is returned from that hook const classes = useStyles();

then in your component use the classes

const Component = () => {
const classes = useStyles();

     return ( 
       <SearchBar
           classes={{
            searchIconButton: classes.searchIconButton, 
            }}
      />
)
}
Screen Shot 2021-08-01 at 3 55 56 AM Screen Shot 2021-08-01 at 3 55 32 AM

This stack overflow helped a lot for this answer! https://stackoverflow.com/a/67920344