pub struct AnimatedShowProps {
pub children: Arc<dyn Fn() -> AnyView + Sync + Send>,
pub when: Signal<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 = RwSignal::new(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<Signal<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: Arc<dyn Fn() -> AnyView + Sync + Send>The components Show wraps
when: Signal<bool>If the component should show or not
show_class: &'static strOptional CSS class to apply if when == true
hide_class: &'static strOptional CSS class to apply if when == false
hide_delay: DurationThe 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> 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