<Portal> is a component that allows you to render children into a DOM node that exists outside the DOM hierarchy of the parent component.
This is useful when your UI has some elements that need to appear on top of everything else, such as modals and tooltips.
1 2 3 4 5 6
This inserts the element in the mount node. Useful for inserting Modals outside of the page layout. Events still propagate through the Component Hierarchy.
The portal is mounted in a
<div> unless the target is the document head. useShadow places the element in a Shadow Root for style isolation, and isSVG is required if inserting into an SVG element so that the
<div> is not inserted.
1 2 3
||document.body||The DOM node to mount the portal in.|
||false||Whether to use a Shadow Root for style isolation.|
||false||Whether the mount node is an SVG element.|