pub fn lazy_column<F>(
args: LazyColumnArgs,
state: Arc<LazyListState>,
configure: F,
)where
F: FnOnce(&mut LazyColumnScope<'_>),Expand 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.
§Parameters
args— configures the list’s layout and scrolling behavior; seeLazyColumnArgs.state— a clonableLazyListStateto manage scroll position and item measurement caching.configure— a closure that receives aLazyColumnScopefor adding items to the list.
§Examples
use std::sync::Arc;
use tessera_ui_basic_components::{
lazy_list::{lazy_column, LazyColumnArgs, LazyListState},
text::{text, TextArgsBuilder},
};
let list_state = Arc::new(LazyListState::new());
lazy_column(LazyColumnArgs::default(), list_state, |scope| {
scope.items(1000, |i| {
let text_content = format!("Item #{}", i);
text(TextArgsBuilder::default().text(text_content).build().unwrap());
});
});