Struct leptos::AnimatedShowProps
source · pub struct AnimatedShowProps {
pub children: ChildrenFn,
pub when: MaybeSignal<bool>,
pub show_class: &'static str,
pub hide_class: &'static str,
pub hide_delay: Duration,
}
Expand description
Props for the AnimatedShow
component.
A component that will show its children when the when
condition is true
.
Additionally, you need to specify a hide_delay
. If the when
condition changes to false
,
the unmounting of the children will be delayed by the specified Duration.
If you provide the optional show_class
and hide_class
, you can create very easy mount /
unmount animations.
let show = create_rw_signal(false);
view! {
<div
class="hover-me"
on:mouseenter=move |_| show.set(true)
on:mouseleave=move |_| show.set(false)
>
"Hover Me"
</div>
<AnimatedShow
when=show
show_class="fade-in-1000"
hide_class="fade-out-1000"
hide_delay=Duration::from_millis(1000)
>
<div class="here-i-am">
"Here I Am!"
</div>
</AnimatedShow>
}
§Required Props
- children:
ChildrenFn
- The components Show wraps
- when:
impl Into<MaybeSignal<bool>>
- If the component should show or not
- hide_delay:
Duration
- The timeout after which the component will be unmounted if
when == false
- The timeout after which the component will be unmounted if
§Optional Props
- show_class: [
&'static str
]- Optional CSS class to apply if
when == true
- Optional CSS class to apply if
- hide_class: [
&'static str
]- Optional CSS class to apply if
when == false
- Optional CSS class to apply if
Fields§
§children: ChildrenFn
The components Show wraps
when: MaybeSignal<bool>
If the component should show or not
show_class: &'static str
Optional CSS class to apply if when == true
hide_class: &'static str
Optional CSS class to apply if when == false
hide_delay: Duration
The timeout after which the component will be unmounted if when == false
Implementations§
source§impl AnimatedShowProps
impl AnimatedShowProps
sourcepub fn builder() -> AnimatedShowPropsBuilder<((), (), (), (), ())>
pub fn builder() -> AnimatedShowPropsBuilder<((), (), (), (), ())>
Create a builder for building AnimatedShowProps
.
On the builder, call .children(...)
, .when(...)
, .show_class(...)
(optional), .hide_class(...)
(optional), .hide_delay(...)
to set the values of the fields.
Finally, call .build()
to create the instance of AnimatedShowProps
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AnimatedShowProps
impl !RefUnwindSafe for AnimatedShowProps
impl !Send for AnimatedShowProps
impl !Sync for AnimatedShowProps
impl Unpin for AnimatedShowProps
impl !UnwindSafe for AnimatedShowProps
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