Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

appendTo element inside Div #352

Open
jerrygzy opened this issue Feb 27, 2022 · 1 comment
Open

appendTo element inside Div #352

jerrygzy opened this issue Feb 27, 2022 · 1 comment

Comments

@jerrygzy
Copy link

jerrygzy commented Feb 27, 2022

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>
@cwnuramirah
Copy link

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants