I tried to change menu color when hover. But, not working. How to change hover color in mantine.ui menu?
Asked
Active
Viewed 3,016 times
2
-
1add code also , so easily detect where we wrong – MAYUR SANCHETI Nov 24 '22 at 04:35
-
Without checking the code, it is not possible to give you solution. Add code snippet. – Akib Nov 24 '22 at 06:40
2 Answers
2
If you are familiar with the concept of Theming, you can get it pretty easily.
<MantineProvider theme={{
components: {
Button: {
// Subscribe to theme and component params
styles: (theme, params) => ({
root: {
backgroundColor:
params.variant === 'filled'
? theme.colors[params.color || theme.primaryColor][9]
: undefined,
'&:hover': { backgroundColor: params.variant === 'filled'
?'#ddd':'transparent'
}
},
}),
},
},
}}>
<Button> I have #ddd color on hover. </Button>
</ManitineProvider>
I don't understand which menu you're talking about, but I am giving an example for the button component. You can override style for all buttons from the theme.

Ashish Bhattarai
- 130
- 9
1
I'm using styled component from @emotion/styled
.
My example will show how to change bgcolor and color when hover on Button component.
import styled from "@emotion/styled";
import {Button as MantineButton} from "@mantine/core"
const Button = styled(MantineButton)`
&:hover {
color: red;
background-color: blue;
}`
export default function CustomizedButton() {
return <Button>Hover me!</Button>
}
I think Menu will work in this same way, you can explore more information following this source: Styled Componenets

CartoonNetwork
- 121
- 1
- 6