Function leptos::AnimatedShow

source ·
pub fn AnimatedShow(props: AnimatedShowProps) -> impl IntoView
Expand description

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

§Optional Props

  • show_class: [&'static str]
    • Optional CSS class to apply if when == true
  • hide_class: [&'static str]
    • Optional CSS class to apply if when == false