Sigil

Virtual list

A list that builds only the visible rows.

render returns any IntoNode, such as text(..) or a widget builder.

GUITUIRuns in the browservirtual_list

Preview

Virtual list, Default, light themeVirtual list, Default, dark theme

Usage example

fn virtual_list_demo(selected: bool) -> impl IntoNode + 'static {    let items: Vec<String> = (1..=20).map(|i| format!("Item {i}")).collect();    virtual_list(items, move |index, item| {        list_row(selected && index == 1, item.clone(), format!("{index}"))    })    .selection(SelectionMode::Single)    .viewport_height(140.0)}
fn virtual_list_demo(  selected: bool,) -> impl IntoNode + 'static {  let items: Vec<String> = (1..=20)    .map(|i| format!("Item {i}"))    .collect();  virtual_list(    items,    move |index, item| {      list_row(        selected && index == 1,        item.clone(),        format!("{index}"),      )    },  )  .selection(SelectionMode::Single)  .viewport_height(140.0)}

States

All 6 captured states, each drawn by the window host and by the terminal host.

Default

  • Virtual list, Default, light themeVirtual list, Default, dark theme
    Default
  • Virtual list, Hover, light themeVirtual list, Hover, dark theme
    Hover
  • Virtual list, Pressed, light themeVirtual list, Pressed, dark theme
    Pressed
  • Virtual list, Focused, light themeVirtual list, Focused, dark theme
    Focused
  • Virtual list, Selected, light themeVirtual list, Selected, dark theme
    Selected

Fill

  • Virtual list, Fill: Default, light themeVirtual list, Fill: Default, dark theme
    Default

API

NameSignaturePurpose
virtual_listfn virtual_list<T, R: Fn(usize, &T) -> N, N: IntoNode, I: IntoList<T, R>>(items: I, render: R) -> VirtualListBuilder<T, R>A list that builds only the visible rows. render returns any IntoNode, such as text(..) or a widget builder.