I tried doing as shown below but could not achieve it. using plain CSS and it works but I need to use makeStyles provide by material-ui.
I want to show a drop-down list of items whenever a user hovers on the button without having to click on the button.
const makeStyles= (theme) => ({
button: {
backgroundColor: "#4CAF50",
color: "white",
padding: "16px",
fontSize: "16px",
border: "none",
"&:hover": {
dropdown: {
display: "block"
}
}
},
dropdown: {
display: "none",
position: "absolute",
backgroundColor: "#f1f1f1",
minWidth: "160px",
boxShadow: `0px 8px 16px 0px rgba(0,0,0,0.2)`,
zIndex: 1
}
})
export default function DropDown() {
const classes = useStyles();
return (
<>
<Button
className={classes.button}
>
{title}
</Button>
<Menu className={classes.dropdown}>
<Item/>
<Item/>
<Item/>
</Menu>
</>
)}
