Skip to main content

yew_virtual/core/
scroll_behavior.rs

1/// Scroll behavior for programmatic scroll operations.
2///
3/// Controls the animation behavior when the virtualizer programmatically
4/// scrolls to an offset or index. Maps to the browser's native
5/// `ScrollBehavior` options.
6#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7pub enum ScrollBehavior {
8    /// Let the browser determine the scroll behavior.
9    Auto,
10
11    /// Animate the scroll smoothly to the target position.
12    Smooth,
13
14    /// Jump immediately to the target position without animation.
15    Instant,
16}
17
18impl Default for ScrollBehavior {
19    /// Returns the default scroll behavior.
20    ///
21    /// # Returns
22    ///
23    /// - `ScrollBehavior::Auto`: The default behavior.
24    fn default() -> Self {
25        // Default to auto to match browser defaults.
26        Self::Auto
27    }
28}