-
-
Notifications
You must be signed in to change notification settings - Fork 534
[FEAT REQ] Expose place context for use with multiple anchors #868
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
Comments
Exposing At first glance, and if I understand correctly, your use case seems to fall a bit out of the scope of the project. I can't think of many other use cases in which exposing internal tooltip data (such as
Something that is easy to do would be to give the tooltip arrow element different css classes according to the If |
Thanks for the quick reply! I agree that an alternative could be adding different css classes to the arrow according to the Perhaps a prop named <Tooltip
classNameArrow={/* bunch of custom styling here ... */}
classNameArrowPlace={
top: 'rotate-[225deg]',
bottom: 'rotate-45',
left: '-rotate-45',
right: 'rotate-[135deg]',
}
/> What do you think? |
I'm happy to put together a PR for this -- just want to agree on the API first 👍 |
Go for it, that seems good enough. I was actually considering the extra class name as something like Submit the PR as you've suggested and we'll go from there. |
Hi guys, instead of:
why not:
Why not use |
It seems like manually keeping track of If it doesn't, feel free to reopen the issue so we can discuss other alternatives. |
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
I have customized the
Tooltip
arrow with a border and CSS mask which necessitates that the arrow is conditionally rotated based on theplace
that the arrow is rendered.I tried adding a thin wrapper around the
<TooltipProvider/>
which stores + allows context consumers to set theplace
. Then in a component containing a customizedTooltipWrapper
, I attempt to set theplace
when it changes. This does not work, as manyTooltipWrappers
are mounted simultaneously with listeners foronMouseover
which triggers the global tooltip instance to anchor onto the element within the hoveredTooltipWrapper
. So I then need to verbosely add state management to set the placement only of the currently hoveredTooltipWrapper
instance. This is essentially juggling alongside the internal state management of this library, which feels a bit hacky for my purposes.Describe the solution you'd like
I would like to be able to use the internal
useTooltip()
, publicly exported in thedist
, with the addition ofactivePlace
to theTooltipContextData
. Then I would easily be able to apply conditional Tailwind styles to the global tooltip instance based on:The text was updated successfully, but these errors were encountered: