1

So I have several Target tooltips and one Source, I want to attach onTrigger or onShow callback to the Source tooltip. Is there an easy way to figure out inside callback which Target tooltip is shown?

I don't want to check against smth like outerHtml etc, but rather to somehow attach ID to the tooltip, or at least some data-*** attribute

Example: https://codesandbox.io/s/optimistic-paper-8or8vc?file=/src/App.js

  <Tippy content="OneOneOneOneOneOneOneOneOne" singleton={target}>
    <button>One</button>
  </Tippy>

  <Tippy content="TwoTwoTwoTwoTwoTwoTwoTwoTwo" singleton={target}>
    <button>Two</button>
  </Tippy>

  <Tippy
    singleton={source}
    onTrigger={function (instance, event) {
      // is there a way for me to figuereout which target was the trigger?
      console.log(instance, event);
    }}
  />

0 Answers0