Skip to content

How create dialog trigger with tooltip? #933

Discussion options

You must be logged in to vote

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:

<Dialog>
  <Tooltip content="tooltip content">
    <DialogTrigger asChild>
      <button>Button</button>
    </DialogTrigger>
  </Tooltip>
  <DialogContent>Dialog Content</DialogContent>
</Dialog>

Hope that makes sense.

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
8 replies
@graemen16
Comment options

@Alex-Mastin
Comment options

@yaralahruthik
Comment options

@adaptive-shield-matrix
Comment options

@yaralahruthik
Comment options

Answer selected by its-monotype
Comment options

You must be logged in to vote
1 reply
@carloslfu
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
9 participants
Converted from issue

This discussion was converted from issue #932 on October 26, 2021 07:32.