material-ui-search-bar icon indicating copy to clipboard operation
material-ui-search-bar copied to clipboard

Cant change the Icon hover effect

Open jerviechronix opened this issue 4 years ago • 1 comments

image

I cant override the hover effect of the Icon.

jerviechronix avatar Apr 23 '21 13:04 jerviechronix

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

SnekCode avatar Aug 01 '21 13:08 SnekCode