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 programatically show/hide tooltip? #285

Open
ammojamo opened this issue Apr 30, 2023 · 1 comment
Open

How to programatically show/hide tooltip? #285

ammojamo opened this issue Apr 30, 2023 · 1 comment

Comments

@ammojamo
Copy link

I'm trying to get a tooltip to show/hide based on some boolean condition instead of on hover.

I see the docs say to pass trigger: 'manual' to programatically show/hide a tooltip, but I can't figure out how to actually show/hide it after passing that config.

@nip10
Copy link

nip10 commented May 29, 2023

I also couldn't find this in the docs, so I looked for similar issues. I was able to make this work by using a ref and calling the show and hide methods. I then expose the methods to the parent component

import { Tippy } from 'vue-tippy'

const tippyRef = ref<typeof Tippy | null>(null)
const showPopover = () => {
  tippyRef.value?.show()
}
const hidePopover = () => {
  tippyRef.value?.hide()
}

<tippy ref="tippyRef" trigger="manual">
...
</tippy>

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

No branches or pull requests

2 participants