chakra-ui-docs icon indicating copy to clipboard operation
chakra-ui-docs copied to clipboard

Document how to use _hover with pseudo elements

Open brekk opened this issue 2 years ago • 6 comments

Subject

Using _hover attributes with pseudo-elements

Description

There is existing documentation regarding styling elements on_hover as well as documentation around using _before / _after to style pseudo-elements.

However, I wasn't able to find any documentation which specified how to style pseudo elements while hovering.

I eventually figured it out:

<Flex
  _hover={{
    background: 'red',
    '&::before': {
        content: '""',
        left: '4.25rem',
        width: 0,
        height: 0,
        border: '10px solid transparent',
        borderRightColor: colorMode === 'dark' ? 'black' : 'white',
        display: { base: 'flex', sm: 'none' },
    }
  }}
>
  cool
</Flex>

The &::before selector within the _hover object is the example I'd like to be better documented, I tried _before and ::before and before to no avail -- it wasn't until I looked at this file that I arrived at the correct answer.

brekk avatar Jun 07 '22 22:06 brekk

Good point, @brekk! Thanks for opening this issue.

nikolovlazar avatar Jun 08 '22 05:06 nikolovlazar

Hi! This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs within 5 days. Thank you for your contributions.

stale[bot] avatar Jul 31 '22 07:07 stale[bot]

Hi! This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs within 5 days. Thank you for your contributions.

stale[bot] avatar Sep 21 '22 03:09 stale[bot]

Hi! This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs within 5 days. Thank you for your contributions.

stale[bot] avatar Jan 08 '23 03:01 stale[bot]

Hi! This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs within 5 days. Thank you for your contributions.

stale[bot] avatar May 21 '23 20:05 stale[bot]

I believe this is still a valid issue

brekk avatar May 24 '23 00:05 brekk