How create dialog trigger with tooltip? #933
-
<Dialog>
<DialogTrigger asChild>
<Tooltip content="tooltip content">
<button>Button</button>
</Tooltip>
</DialogTrigger>
<DialogContent>Dialog Content</DialogContent>
</Dialog> |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
Hi @youngtype, When you use <Dialog>
<Tooltip content="tooltip content">
<DialogTrigger asChild>
<button>Button</button>
</DialogTrigger>
</Tooltip>
<DialogContent>Dialog Content</DialogContent>
</Dialog> Hope that makes sense. |
Beta Was this translation helpful? Give feedback.
-
These solution work , but when closing the modal. The tooltip is reopened again has anybody found a solution to that ? |
Beta Was this translation helpful? Give feedback.
Hi @youngtype,
When you use
asChild
on a part it will use the direct child of that part as the element to render.In your case it looks like you've created an abstraction around the
Tooltip
primitive.It sounds like you haven't forwarded ref in that abstraction.
Either way, you want to make sure the direct child is the button, so you probably need to do something like this:
Hope that makes sense.