0

Hey I have been unable to get a tooltip to show up when I hover over this badge. I am using Chakra UI code below thanks

     <Tooltip
       hasArrow
       label="hi there"
       padding={2}
       width="50px"
       bgColor="gray.1200"
       borderRadius={8}
       py={2}
       px={3}
       fontWeight={400}
       fontSize="xs"
       color="white"
       placement="top"
     >
       <Badge
         label={status.replaceAll('_', ' ')}
         colorScheme={
           (showLabel
             ? styles.alternateStyle?.colorScheme
             : styles.colorScheme) ?? styles.colorScheme
         }
         variant={styles.variant}
         icon={styles.icon}
         showLabel={showLabel || styles.showLabel}
         showIcon
         alternateStyle={styles.alternateStyle}
       />
     </Tooltip>```
codernoob8
  • 434
  • 1
  • 9
  • 24

1 Answers1

0

Place a span tag between the tooltip and the badge like so:

  <Tooltip label={reason} placement="bottom">
      <span>
        <Badge
          label={status.replaceAll('_', ' ')}
          colorScheme={
            (showLabel
              ? styles.alternateStyle?.colorScheme
              : styles.colorScheme) ?? styles.colorScheme
          }
          variant={styles.variant}
          icon={styles.icon}
          showLabel={showLabel || styles.showLabel}
          showIcon
          alternateStyle={styles.alternateStyle}
        />
      </span>
    </Tooltip>
codernoob8
  • 434
  • 1
  • 9
  • 24