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

Post a simple HTML example for `withTooltip`?

Open amandapouget opened this issue 8 years ago • 2 comments

Trying this: image Produces this error: image ... can you post something in the documentation about how to use html with withTooltip?

Thank you!!

Muchos kudos. :-)

amandapouget avatar Jan 11 '18 02:01 amandapouget

Try like this:

    const a = withTooltip(AerialMap, {
      title: 'blabla',
      followCursor: true,
      html: <div>5</div>, // without curly brackets
    });

Armanio avatar Mar 29 '18 16:03 Armanio

Thank @amandapouget for your question.

html accept every react component, thus, you just need to pass them normally like

// pass directly
html: <div>test</div>
html: (<div>test</div>) <- they are both the same

// pass via variable
a = <div>test</div>
html: a

// pass via function call
A = () => <div>test</div>
html: <A />
html: A()

and FYI, using curly bracket is incorrect, as incorrect is for creating object not react component.

tuanthieu2993 avatar Oct 03 '18 01:10 tuanthieu2993