Add support for custom portal container in floating components (Dialog, Dropdown, Popover, etc.) #3698
rezasohrabi
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, First of all, thank you for your amazing work on Headless UI.
I'm working on a browser extension project where the app is rendered inside a shadow DOM.
In this context, it's important to have control over where portals are mounted.
Currently, libraries like shadcn/ui and Hero UI allow passing a custom container to their portal components (e.g., Dialogs, Dropdowns, Popovers, Listboxes).
However, Headless UI's floating components currently hardcode the portal target (typically document.body) without exposing a way to override it.
Since Headless UI is meant to be "headless", it would be great to allow developers to specify a custom container for portals.
This would make the library even more flexible and suitable for advanced use cases like Shadow DOM.
Thank you for considering this feature request!
Beta Was this translation helpful? Give feedback.
All reactions