Skip to main content

Scroll

Scroll is the general-purpose scroll container.

It gives one child a scrollable viewport, clips the visible region, and lets the runtime track scroll offset for that node. Use it for long forms, article content, settings screens, horizontally scrolling strips, or any subtree that should remain fully built but only partly visible.

Use Scroll when building the whole child subtree is acceptable. Do not use it for very large uniform-height lists where virtualization matters. That is the job of LazyColumn.

Example

use fission::core::ui::{Column, Scroll, Text};
use fission_ir::op::FlexDirection;

let node = Scroll {
direction: FlexDirection::Column,
flex_grow: 1.0,
child: Some(Box::new(
Column {
gap: Some(16.0),
children: vec![
Text::new("Section 1").into_node(),
Text::new("Section 2").into_node(),
Text::new("Section 3").into_node(),
],
..Default::default()
}
.into_node(),
)),
..Default::default()
}
.into_node();

Field table

FieldTypeMeaningNotes / default behavior
idOption<NodeId>Stable node identity used for scroll offset tracking.Defaults to None.
childOption<Box<Node>>The scrollable content.Defaults to None.
directionFlexDirectionScroll axis.Defaults to FlexDirection::Column, which means vertical scrolling.
widthOption<f32>Fixed viewport width.Defaults to None.
heightOption<f32>Fixed viewport height.Defaults to None.
show_scrollbarboolWhether to render a scrollbar indicator.Defaults to true.
flex_growf32Extra space the scroll viewport may absorb.Defaults to 0.0. Set this when the scroll area should fill a panel.
flex_shrinkf32How much the scroll viewport may shrink.Defaults to 0.0.

How it differs from LazyColumn

Scroll still builds its entire child subtree. It simply makes that subtree scrollable. A LazyColumn goes further by virtualizing which items are lowered.

That means Scroll is the right default for normal content screens, especially when item heights vary or the subtree is not list-like. LazyColumn is the optimization path for large, uniform-height lists.

Specific advice

Give the scroll area room to exist. In many screen layouts, that means setting flex_grow: 1.0 so the viewport can expand to fill the panel rather than collapsing to the child's natural height.

Also avoid nesting two vertical scroll containers unless you are deliberately designing nested scroll behavior. It is usually harder to use and harder to test.

LazyColumn, Column, Row, and SafeArea.