Floating Portal
Portals the floating element into a given container element — by default, outside of the app root and into the body.
This is necessary to ensure the floating element can appear
outside any potential parent containers that cause clipping (such
as overflow: hidden
), while retaining its location in the React
tree.
Context is provided so that portals nested in one another are appended to their respective parent.
Props
root
Optionally specifies the root node the portal container will be appended to.
id
Optionally selects the node with the id if it exists, or create
it and append it to the specified root (by default
document.body
).
preserveTabOrder
default: true
When using non-modal focus management using
<FloatingFocusManager />
, this will preserve the tab order
context based on the React tree instead of the DOM tree.
useFloatingPortalNode()
Exposes the portal container node for custom use in other components.