API ReferenceDesign Systems
Scrollbar
Themed retained scrollbar wrapping a scroll viewport.
use incular::prelude::*;
use incular::controls_prelude::Scrollbar;
fn main() {
let controller = ScrollController::new();
let app = Application::new(move |_cx| {
Container::builder()
.padding(EdgeInsets::all(24.0))
.alignment(Alignment::CENTER)
.child(
Scrollbar::new(
ListView::builder(100, |i| Text::new(format!("row {i}"))),
)
.controller(controller.clone())
.thumb_visibility(true),
)
.build()
.into()
})
.expect("valid application");
incular::run(app).expect("run application");
}| Prop | Type | Default |
|---|---|---|
controller | ScrollController | Viewport's own |
style | RawScrollbarStyle | Theme-derived |
thumb_visibility | bool | false (hover-reveal) |
Reuses the existing SingleChildScrollView controller when present.
Theme-derived style: theme.scrollbar.width (8), min_thumb_extent (24),
transparent track, foreground_muted thumb.
RawScrollbar is the stateful overlay (geometry(), pointer_down/move/up,
hit_test()); RawScrollbarGeometry { visible, track, thumb, … } carries
computed geometry; RawScrollbarOrientation: Right (default) / Left /
Bottom / Top.
Related: ScrollController.