Skip to content

Changing the hover color for Buttons #2107

Answered by issammani
Amogh-Bharadwaj asked this question in Q&A
Discussion options

You must be logged in to vote

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:

<Button sx={{'&&:hover':{background:'neutral.emphasis'}}}>Hello World</Button>

Here is a working example in codesandbox.

PS: I changed the color from neutral.muted to neutral.emphasis so you can see the difference. The default hover color and neutral.muted are very similar.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Amogh-Bharadwaj
Comment options

Answer selected by lesliecdubs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants