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

appendTo element inside Div

Open jerrygzy opened this issue 4 years ago • 1 comments

Hi, new to tippy here, how can I append tooltip to <HiExclamationCircle /> element inside <div></div> ?

import * as React from 'react';
import Tippy from '@tippyjs/react';
import { HiExclamationCircle } from 'react-icons/hi';
          <Tippy content={<span >{errors[id].message}</span>} appendTo={HiExclamationCircle}  >
            <div  className='absolute inset-y-0 right-0 flex items-center pr-3'>
                <HiExclamationCircle id="icon" className='text-xl text-red-500' />
            </div>
          </Tippy>

jerrygzy avatar Feb 27 '22 19:02 jerrygzy

Hi I'm quite new too. I think you need to useRef hook? I use as its example in image 👇 Screenshot 2022-07-14 181021

const ref = useRef();
	<Tippy appendTo={(ref) => ref} >
		<div ref={ref}>
			<HiExclamationCircle />
		</div>
	</Tippy>

cwnuramirah avatar Jul 14 '22 10:07 cwnuramirah