ScrollView
ScrollView is a viewport over a single child.
Smallest example
let transcript = ScrollView::new()
.offset(self.offset)
.on_scroll(Message::ScrollTo)
.layout(Layout { width: Length::Fill, height: Length::Fixed(4) })
.child(Paragraph::new(self.log.clone()).build())
.build();Use ScrollView when
- one child may become taller than the viewport
- the scroll offset is part of your app state or runtime continuity
- you want to pair content with a
Scrollbar
Key builder methods
ScrollView::new().offset(...).follow_bottom(...).on_scroll(...).child(...)
Common pairing
The most common pairing is:
ScrollViewfor the content viewportScrollbarfor visual position- one shared offset in state
Where to see it in examples
- Scroll Sync: the clearest
ScrollView + Scrollbarexample - OpenAPI Explorer: long detail panes inside a browser layout
Last updated on
