Skip to main content

LazyColumn

Function LazyColumn 

Source
pub fn LazyColumn<F>(
    modifier: Modifier,
    state: LazyListState,
    spec: LazyColumnSpec,
    content: F,
) -> usize
Expand description

Composes and measures the rows needed for a vertical viewport. The content closure declares rows through LazyListScope. Use stable keys for item identity across changes and content types for distinct row shapes. The state retains the scroll position; the spec sets item space and content insets.

ยงExample

use cranpose_ui::*;

#[composable]
fn Messages() {
    let state = rememberLazyListState();
    LazyColumn(
        Modifier::empty().fill_max_size(),
        state,
        LazyColumnSpec::default(),
        |scope| {
            scope.items(LazyItems::new(1000), |index| {
                Text(
                    format!("Message {index}"),
                    Modifier::empty().padding(16.0),
                    TextStyle::default(),
                );
            });
        },
    );
}