use leptos::*; use leptos_use::docs::{demo_or_body, BooleanDisplay}; use leptos_use::{use_scroll_with_options, ScrollBehavior, UseScrollOptions, UseScrollReturn}; #[component] fn Demo(cx: Scope) -> impl IntoView { let el = create_node_ref(cx); let (smooth, set_smooth) = create_signal(cx, false); let behavior = Signal::derive(cx, move || { if smooth.get() { ScrollBehavior::Smooth } else { ScrollBehavior::Auto } }); let UseScrollReturn { x, y, set_x, set_y, is_scrolling, arrived_state, directions, .. } = use_scroll_with_options(cx, el, UseScrollOptions::default().behavior(behavior)); view! { cx,