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

Using Tippy with custom hover logic #343

Open
nakamigo opened this issue Dec 20, 2021 · 2 comments
Open

Using Tippy with custom hover logic #343

nakamigo opened this issue Dec 20, 2021 · 2 comments

Comments

@nakamigo
Copy link

I'm using Tippy for showing a profile card when hovering on a user name:

const ProfilePopup = (props: User["profile"]) => {
  const [source, target] = useSingleton({
    overrides: ["placement"],
  });

  return (
    <>
      <Tippy singleton={source} delay={100} />
      <Tippy
        content={
          <Content {...props.user.profile} />
        }
        singleton={target}
        placement="left-end"
      >
        {props.user.name}
      </Tippy>
    </>
  );
}

This snippet works great when I'm hovering a cursor over a user name
But disappears (kind of expected) when I move a cursor to the tooltip itself where I have some buttons

Is it possible to set up Tippy to trigger close() only when going outside of Tippy itself and <Content />?

@atomiks
Copy link
Owner

atomiks commented Dec 20, 2021

<Tippy singleton={source} delay={100} interactive />

@nakamigo
Copy link
Author

Thanks! A bit confused since I was adding interactive to the second Tippy instance
Is it intentionally not working when properties are provided to the second one?

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