yew-virtualized

Crates.ioyew-virtualized
lib.rsyew-virtualized
version0.2.0
sourcesrc
created_at2022-06-01 12:07:36.970396
updated_at2023-03-20 20:30:01.610632
descriptionA yew component that renders only the on-screen part of a scrollable list
homepage
repositoryhttps://github.com/WorldSEnder/yew-virtualized
max_upload_size
id598182
size32,352
(WorldSEnder)

documentation

README

yew-virtualized

A VirtualList yew component that renders only the visible part of a scrollable list.

This component uses the ResizeObserver API to allow dynamically sized items in the list.

Quick Example

# Cargo.toml
yew-virtualized = "0.1.0"
fn items(idx: usize) -> Html {
    html! { format!("Item #{idx}") }
}

#[function_component(App)]
fn app() -> Html {
    html! {
        <VirtualList
            // An approximate item height that will be used to guess
            // space usage before the first render of an item. Subsequent renders
            // use the exact item height
            height_prior={30}
            // How many items to render, in total.
            item_count={100}
            // Callback function to render individual items by index in 0..item_count
            items={VirtualList::item_gen(items)}
            // Additional classes to apply to the root node
            classes={"scrollbar"} />
    }
}
Commit count: 16

cargo fmt