atomiks / tippyjs

Tooltip, popover, dropdown, and menu library
https://atomiks.github.io/tippyjs/
MIT License
11.91k stars 518 forks source link

Nesting demo in plain JavaScript #1010

Closed michaelborromeo closed 2 years ago

michaelborromeo commented 2 years ago

How would you create the nesting demo but in plain JavaScript, not React?

Thanks!

atomiks commented 2 years ago

A sub-button is inside the root button tippy's content. You call tippy() on the sub-button too, ad infinitum for further nesting

tippy(rootButton, {
  content: elementContainingSubButton,
});

tippy(subButton, {
  content: 'nested'
});