-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
[Popover] How to align the start of the popover with the center of the trigger? #1195
Comments
Yeah this is a good idea. This is what Floating UI's |
@benface Could you provide a screenshot of your design please? Or give a better idea of the kinds of UIs that require this? |
@colmtuite – Sure! Here's a simple mockup: The width of each column of the popover is fixed, so I would align the start of the popover with the center of the trigger, and then set |
@benface Ah ok, thanks. This would be our NavigationMenu component, which we haven't started work on yet. An example would be Radix Navigation Menu. But I understand that we can help in the meantime by tweaking something relatively trivial. |
First of all, amazing work on this library. The alpha version looks super solid already.
I've come across a potential limitation when using
Popover
. My design requires me to align the left / start of the popover with the center of the trigger (minus an offset, because actually the goal is to align the center of the first column of the popover, which has a fixed width... but that's irrelevant). With thealign
prop, it only seems possible to align thestart
of the popover with the start of the trigger, thecenter
of the popover with the center of the trigger, or theend
of the popover with the end of the trigger. Is there a solution I'm not seeing, given that the trigger has an unknown/dynamic width? If not, I have 2 potential (but very rough) ideas of how it could be handled (assuming you agree that it's a worthy use case!)triggerAlign
or something, which would default to the same value asalign
, but in my case I would set it tocenter
.alignOffset
prop could accept a function that would receive the dimensions of the trigger and of the popup, and could do some math based on those to return an offset value?Thanks so much again, I'm excited to see how this library evolves.
The text was updated successfully, but these errors were encountered: