Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to present and dismiss a tooltip on demand #20

Closed
chenium opened this issue Apr 20, 2022 · 1 comment · Fixed by #21
Closed

How to present and dismiss a tooltip on demand #20

chenium opened this issue Apr 20, 2022 · 1 comment · Fixed by #21
Assignees
Labels
enhancement New feature or request

Comments

@chenium
Copy link
Contributor

chenium commented Apr 20, 2022

Is your feature request related to a problem? Please describe.
Is there a recommended procedure to accomplish the ability present and dismiss tooltips on demand? I've noticed several forks of this library that attempt to add this into the tooltip api and was wondering if there was a different recommendation from the authors.

Describe the solution you'd like
An api that allows us to quickly present and dismiss the tooltip.

Describe alternatives you've considered
I was able to achieve this functionality by having two versions of the same view with a control statement. One with a tooltip attached and one without.

if showTip {
    Text("Target View")
      .tooltip {
           Text("Just the tip")
      }
} else {
    Text("Target View")
}
@bring-shrubbery
Copy link
Member

bring-shrubbery commented Apr 22, 2022

Good question, there's not, but it's definitely needed, so I'll add it and close this issue when it's done ;)

The API will look something like:

Text("how much?")
  .tooltip(self.$enabled) {
    Text("Just the tip")
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants