Skip to content

How to handle nested group hover styles? #4485

Answered by hazem3500
hazem3500 asked this question in Q&A
Discussion options

You must be logged in to vote

What I ended up doing was add to my Button component an attribute data-component-name="Button"

then used it as a selector

{
  '[data-component-name="Button"]:hover &': {
    color: "green.500"
  }
}

Quite pragmatic, I think every component in Chakra-UI should have a data-component-name attribute as an escape-hatch

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@hazem3500
Comment options

@aaronkik
Comment options

@hazem3500
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@veloware
Comment options

Answer selected by hazem3500
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants