Components / VirtualList
VirtualList
A list of any length with rows of any height, which jumps to a row and stays at the end.
Example
The component itself, running in WebAssembly, beside its code in a playground. Try it.
Code
use ravenrs::prelude::*;
fn virtual_list() -> impl View {
// Ten thousand rows of different heights: only what shows exists.
let selected = State::new(None::<usize>);
VirtualList::new(10_000, |index| {
let tall = 1 + index % 3;
let words = vec!["A row that says how tall it is"; tall].join("\n");
VStack::new((Text::new(format!("Row {index}")), Text::new(words))).padding(8.0)
})
.key(|index| index as u64)
.selection(selected.binding())
.height(260.0)
}