Expand description
ScrollBar — pointer and keyboard affordance for a ScrollArea.
ScrollBar reads and writes a shared Signal<f32> scroll position and a
Signal<f32> viewport/content ratio, both supplied by its owning ScrollArea.
Interaction (thumb drag, track click, keyboard Up/Down/Home/End, hover) is
handled here; all painting is delegated to the active [ScrollBarStyle] impl so
the look is fully theme-overridable.
Most applications do not need to construct a ScrollBar directly — ScrollArea
creates and manages the bars automatically. Use this type when building a custom
scroll host (e.g. the RichTextEditor manages its own bars to avoid the
wrap/scrollbar circular dependency).
§Accessibility
Hidden from AT via set_hidden(). Scroll actions (Up/Down/Left/Right) are
advertised on the parent ScrollView node, not on the bar, so screen readers
navigate the content region directly without stopping on the thumb.
let position = Signal::new(0.0_f32);
let max_scroll = Signal::new(500.0_f32);
let viewport_ratio = Signal::new(0.4_f32);
let _bar = ScrollBar::new(
ScrollBarOrientation::Vertical,
position,
max_scroll,
viewport_ratio,
)
.thickness(8.0)
.variant(ScrollBarVariant::Overlay);Structs§
- Scroll
Bar - A scroll bar that shares reactive scroll-position state with a
ScrollArea.