admin管理员组文章数量:1290966
createdByModal is basically a chakra modal and I'm using tooltip in it.Whenever i hover on the icons the tooltip shows me on the top of the screen instead of on top of the icon.In the photo you can see the ignore element is showing on the top left corner
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>
);
};
createdByModal is basically a chakra modal and I'm using tooltip in it.Whenever i hover on the icons the tooltip shows me on the top of the screen instead of on top of the icon.In the photo you can see the ignore element is showing on the top left corner
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>
);
};
Share
Improve this question
edited Jun 27, 2022 at 11:24
Jan Klimo
4,9502 gold badges38 silver badges44 bronze badges
asked Jun 27, 2022 at 11:18
sohaibsohaib
77411 silver badges22 bronze badges
1 Answer
Reset to default 10Have you wrapped your ponents that want the tooltip with forwardRef
?
https://chakra-ui./docs/ponents/tooltip#usage
Or wrap your icon ponent in a span
https://chakra-ui./docs/ponents/tooltip#with-an-icon
本文标签:
版权声明:本文标题:javascript - Chakra UI : Why tooltip is showing on the top left corner of the screen instead of showing on top of the element? - 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741518470a2383037.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论