Skip to content

New render tooltip prop to allow for more customization #975

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

Merged
merged 3 commits into from
Mar 9, 2023

Conversation

gabrieljablonski
Copy link
Member

Closes #949

Signature:

render?: (render: {
  content: string | null
  activeAnchor: HTMLElement | null
}) => ChildrenType

Usage example:

<a data-tooltip-id="my-tooltip" data-tooltip-content="my-content" />
<Tooltip
  id="my-tooltip"
  render={({ content, activeAnchor }) => (
    <>
      content={content} from anchor with id={activeAnchor?.id}
    </>
  )}
/>

content comes from data-tooltip-content on the anchor.

@gabrieljablonski gabrieljablonski changed the title New render tooltip prop to allow for more customization New render tooltip prop to allow for more customization Mar 9, 2023
Copy link
Member

@danielbarion danielbarion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me! great job :)

@gabrieljablonski gabrieljablonski merged commit 06696b2 into master Mar 9, 2023
@gabrieljablonski gabrieljablonski deleted the feat/render-prop branch March 9, 2023 18:22
@j-greig
Copy link

j-greig commented Aug 12, 2023

Got this working with an API call inside the tooltip to fetch live data, nice 🤝

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

Successfully merging this pull request may close these issues.

[FEAT REQ] Better way to render custom content based on the active anchor element
3 participants