Function freya_components::VirtualScrollView

source ·
pub fn VirtualScrollView<Builder: Clone + Fn(usize, &Option<BuilderArgs>) -> Element, BuilderArgs: Clone + PartialEq>(
    props: VirtualScrollViewProps<Builder, BuilderArgs>
) -> Element
Expand description

One-direction scrollable area that dynamically builds and renders items based in their size and current available size, this is intended for apps using large sets of data that need good performance.

Use cases: text editors, chats, etc.

§Example

fn app() -> Element {
    rsx!(
        VirtualScrollView {
            show_scrollbar: true,
            length: 5,
            item_size: 80.0,
            direction: "vertical",
            builder: move |i, _other_args: &Option<()>| {
                rsx! {
                    label {
                        key: "{i}",
                        height: "80",
                        "Number {i}"
                    }
                }
            }
        }
    )
}