0

I am trying to add React-Tooltip to my React app, and when I just statically add data-tip="hello world" to an element, it is working, however, when I append the attribute to an element inside of svg it is not. I see that the attribute is added inside html:

enter image description here

But hovering over the element does not show the tooltip. I am using collapsible tree code:

https://bl.ocks.org/mbostock/4339083

And trying to make tooltip working like that:

node.attr("data-tip", "helloworld");

Any suggestions would be greatly appreciated.

Nikita Vlasenko
  • 4,004
  • 7
  • 47
  • 87

2 Answers2

2

If you want to show tooltip inside SVG you can have look on following link: How to add a tooltip to an svg graphic?

Piyush Zalani
  • 3,686
  • 1
  • 13
  • 29
2

I have recently open-sourced react-svg-tooltip, a React component to create tooltips for SVG elements. It is still wet from birth, but maybe you still find it useful.

Rahel Lüthy
  • 6,837
  • 3
  • 36
  • 51