tippyjs-react icon indicating copy to clipboard operation
tippyjs-react copied to clipboard

Using Tippy with custom hover logic

Open nakamigo opened this issue 3 years ago • 2 comments

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 />?

nakamigo avatar Dec 20 '21 18:12 nakamigo

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

atomiks avatar Dec 20 '21 18:12 atomiks

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?

nakamigo avatar Dec 20 '21 18:12 nakamigo