Changing the hover color for Buttons #2107
-
|
Is there a way to change hover and selected properties of a Button? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hi @Amogh-Bharadwaj, This is a specificity issue. This is actually very common with component libraries that allow overriding styles like this. You can use the <Button sx={{'&&:hover':{background:'neutral.emphasis'}}}>Hello World</Button>Here is a working example in codesandbox. PS: I changed the color from |
Beta Was this translation helpful? Give feedback.
Hi @Amogh-Bharadwaj,
This is a specificity issue. This is actually very common with component libraries that allow overriding styles like this. You can use the
&&operator to increase the specificity of your overriding hover styles like so:Here is a working example in codesandbox.
PS: I changed the color from
neutral.mutedtoneutral.emphasisso you can see the difference. The default hover color andneutral.mutedare very similar.