Skip to content

How to apply styles to a child element on parent hover? #4313

Discussion options

You must be logged in to vote

It's definitely possible to achieve with Paste! I just don't believe the Customization Provider currently supports the type of selector you're looking to use. If you add the hover styles directly onto the Box you should see the results you're expecting.

      <Box
        _hover={
          {
            "& [data-paste-element='CHILD']": {
              visibility: "visible",
            },
          } as BoxProps["_hover"]
        }
      >
        Hover over me
        <Box visibility="hidden" data-paste-element="CHILD">
          I show on hover!
        </Box>
      </Box>

Here's a CodeSandbox @PixeledCode made showing the behavior.

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dmitriy-kudelko
Comment options

Comment options

You must be logged in to vote
3 replies
@dmitriy-kudelko
Comment options

@nkrantz
Comment options

Answer selected by dmitriy-kudelko
@dmitriy-kudelko
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
External This Discussion was posted by a non-Twilio Paste consumer
3 participants