繁体   English   中英

Chakra UI:为什么工具提示显示在屏幕的左上角而不是显示在元素的顶部?

[英]Chakra UI : Why tooltip is showing on the top left corner of the screen instead of showing on top of the element?

createdByModal 基本上是一个脉轮模式,我在其中使用工具提示。每当我将鼠标悬停在图标上时,工具提示都会显示在屏幕顶部而不是图标顶部。在照片中,您可以看到忽略元素正在显示在左上角


在此处输入图像描述

const CreatedByModal = () => {
  return (
    <Stack
      spacing={"4"}
      margin={"0px !important"}
      alignItems={"center"}
      px={{ base: "2", lg: "6" }}
      pt={"2"}
    >
      <HStack justifyContent={"space-between"}>
        <Tooltip
          bg={"white"}
          textAlign={"center"}
          color={"black"}
          placement="top"
          label="Tip"
          aria-label="A tooltip"
        >
          <AiFillWallet size={"1.2rem"} color={"#b1bad3"} />
        </Tooltip>
        <Tooltip
          bg={"white"}
          textAlign={"center"}
          color={"black"}
          placement="top"
          label="Ignore"
          aria-label="A tooltip"
        >
          <AiFillEyeInvisible size={"1.2rem"} color={"#b1bad3"} />
        </Tooltip>
      </HStack>
    </Stack>
  );
};

您是否使用forwardRef包装了需要工具提示的组件?

https://chakra-ui.com/docs/components/tooltip#usage

或者将您的图标组件包装在一个跨度中

https://chakra-ui.com/docs/components/tooltip#with-an-icon

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM