Struct leptos::PortalProps
source · pub struct PortalProps {
pub mount: Option<Element>,
pub use_shadow: bool,
pub is_svg: bool,
pub children: ChildrenFn,
}
Expand description
Props for the Portal
component.
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
- The children to teleport into the
§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 tofalse
.
- Whether to use a shadow DOM inside
- is_svg:
bool
- When using SVG this has to be set to
true
. Defaults tofalse
.
- When using SVG this has to be set to
Fields§
§mount: Option<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
.
children: ChildrenFn
The children to teleport into the mount
element
Implementations§
source§impl PortalProps
impl PortalProps
sourcepub fn builder() -> PortalPropsBuilder<((), (), (), ())>
pub fn builder() -> PortalPropsBuilder<((), (), (), ())>
Create a builder for building PortalProps
.
On the builder, call .mount(...)
(optional), .use_shadow(...)
(optional), .is_svg(...)
(optional), .children(...)
to set the values of the fields.
Finally, call .build()
to create the instance of PortalProps
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PortalProps
impl !RefUnwindSafe for PortalProps
impl !Send for PortalProps
impl !Sync for PortalProps
impl Unpin for PortalProps
impl !UnwindSafe for PortalProps
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more