How can I make a single floating element follow two different reference elements? #3391
SEOKKAMONI
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
While developing my product, I encountered a situation where a FAB (Floating Action Button) should normally follow Element A, but under certain triggers, it needs to follow Element B instead.
At the time, I chose to solve this by dynamically changing the setReference from useFloating depending on the situation, but I
believe there might be better approaches. I'm curious to know how others have solved similar problems.
The code below is what I implemented, and it works as shown in the video below.
I would love to hear opinions from developers viewing this issue about:
Code
2025-09-02.6.10.34.mov
Beta Was this translation helpful? Give feedback.
All reactions