pub fn lazy_column() -> LazyColumnBuilderExpand description
§lazy_column
A vertically scrolling list that only renders items visible in the viewport.
§Usage
Display a long, vertical list of items without incurring the performance cost of rendering every item at once. Remeasurement preserves the first item start visible in the viewport. If no item start is visible, the partially visible item retains its offset.
§Parameters
modifier— optional modifier for the scroll container.cross_axis_alignment— how items align along the cross axis.item_spacing— gap between successive items.overscan— number of extra items instantiated before and after the viewport.estimated_item_size— estimated main-axis size used before real measurements exist.content_padding— symmetric padding around the lazy list content.max_viewport_main— optional maximum viewport length, also limiting initial item construction before the viewport is measured.scroll_smoothing— fraction of the remaining distance kept per 60Hz frame while animating a scroll step; defaults to the scrollable default.scrollbar_behavior— scrollbar visibility; visible by default.controller— optional external controller for scroll position and cache.viewport_controller— optional shared controller for the actual scroll viewport.keep_composed_items— retain visited item state until this list unmounts; hidden items are unplaced, except the active focused item kept for reveal.- item declarations are appended through builder methods like
item,items, andsticky_header.
§Examples
use tessera_components::{lazy_list::lazy_column, text::text};
use tessera_ui::tessera;
#[tessera]
fn demo() {
lazy_column().items(1000, |i| {
let text_content = format!("Item #{i}");
text(text_content);
});
}