Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/AircastDev/yew-virtual-scroller

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/AircastDev/yew-virtual-scroller

  • v0.0.0-20201219212623-c26bd46a7d40
  • Source
  • Go
  • Socket score

Version published
Created
Source

yew-virtual-scroller

Crates.io Crates.io

A Yew component for virtual scrolling / scroll windowing -- Only renders the visible content into the dom.

Example:

struct MyItem { value: usize }

impl From<MyItem> for yew::Html {
    fn from(item: MyItem) -> Self {
        html! {
            // Each item must be the same height.
            <div key={item.value} style="height: 32px;">
                {format!("Item: {}", item.value)}
            </div>
        }
    }
}

fn view(&self) -> yew::Html {
    // Items is wrapped with an Rc to avoid cloning large lists.
    let items = Rc::clone(&self.items);
    html! {
        <div>
            <style>{"
                /* Scroller should be constrained in some way so it can scroll */
                .scroller {
                    height: 600px;
                }
            "}</style>

            <VirtualScroller<MyItem>
                items={items}
                row_height={32.0}
                class=Classes::from("scroller")
            />
        </div>
    }
}

License

Licensed under either of

  • Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

FAQs

Package last updated on 19 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc