Skip to content
This repository has been archived by the owner on Nov 9, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants