Function leptos::Portal

source ·
pub fn Portal(props: PortalProps) -> impl IntoView
Expand description

Renders components somewhere else in the DOM.

Useful for inserting modals and tooltips outside of a cropping layout. If no mount point is given, the portal is inserted in document.body; it is wrapped in a <div> unless is_svg is true in which case it’s wrappend in a <g>. Setting use_shadow to true places the element in a shadow root to isolate styles.

§Required Props

  • children: ChildrenFn
    • The children to teleport into the mount element

§Optional Props

  • mount: impl Into<web_sys::Element>
    • Target element where the children will be appended
  • use_shadow: bool
    • Whether to use a shadow DOM inside mount. Defaults to false.
  • is_svg: bool
    • When using SVG this has to be set to true. Defaults to false.