npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@humanspeak/svelte-virtual-list

v0.2.3

Published

A lightweight, high-performance virtual list component for Svelte 5 that renders large datasets with minimal memory usage. Features include dynamic height support, smooth scrolling, TypeScript support, and efficient DOM recycling. Ideal for infinite scrol

Downloads

895

Readme

@humanspeak/svelte-virtual-list

NPM version Build Status Coverage Status License Downloads CodeQL Code Style: Trunk TypeScript Types Maintenance

A high-performance virtual list component for Svelte 5 applications that efficiently renders large datasets with minimal memory usage.

Features

  • 📏 Dynamic item height handling - no fixed height required
  • 🔄 Bi-directional scrolling support (top-to-bottom and bottom-to-top)
  • 🔄 Automatic resize handling for dynamic content
  • 📝 TypeScript support with full type safety
  • 🚀 SSR compatible with hydration support
  • ✨ Svelte 5 runes and snippets support
  • 🎨 Customizable styling with class props
  • 🐛 Debug mode for development
  • 🎯 Smooth scrolling with configurable buffer zones
  • 🧠 Memory-optimized for 10k+ items
  • 🧪 Comprehensive test coverage (vitest and playwright)
  • 🚀 Progressive initialization for large datasets

Installation

npm install @humanspeak/svelte-virtual-list

Basic Usage

<script lang="ts">
    import SvelteVirtualList from '@humanspeak/svelte-virtual-list'

    const items = Array.from({ length: 1000 }, (_, i) => ({
        id: i,
        text: `Item ${i}`
    }))
</script>

<SvelteVirtualList {items}>
    {#snippet renderItem(item)}
        <div>{item.text}</div>
    {/snippet}
</SvelteVirtualList>

Advanced Features

Chat Application Example

<script lang="ts">
    import SvelteVirtualList from '@humanspeak/svelte-virtual-list'

    type Message = {
        id: number
        text: string
        timestamp: Date
    }

    const messages: Message[] = Array.from({ length: 100 }, (_, i) => ({
        id: i,
        text: `Message ${i}`,
        timestamp: new Date()
    }))
</script>

<div style="height: 500px;">
    <SvelteVirtualList items={messages} mode="bottomToTop" debug>
        {#snippet renderItem(message)}
            <div class="message-container">
                <p>{message.text}</p>
                <span class="timestamp">
                    {message.timestamp.toLocaleString()}
                </span>
            </div>
        {/snippet}
    </SvelteVirtualList>
</div>

Props

| Prop | Type | Default | Description | | ------------------- | -------------------------------- | --------------- | ------------------------------------------- | | items | T[] | Required | Array of items to render | | defaultItemHeight | number | 40 | Initial height for items before measurement | | mode | 'topToBottom' \| 'bottomToTop' | 'topToBottom' | Scroll direction | | bufferSize | number | 20 | Number of items to render outside viewport | | debug | boolean | false | Enable debug logging and visualizations | | containerClass | string | '' | Class for outer container | | viewportClass | string | '' | Class for scrollable viewport | | contentClass | string | '' | Class for content wrapper | | itemsClass | string | '' | Class for items container |

Performance Considerations

  • The bufferSize prop affects memory usage and scroll smoothness
  • Items are measured and cached for optimal performance
  • Dynamic height calculations happen automatically
  • Resize observers handle container/content changes
  • Virtual DOM updates are batched for efficiency

License

MIT © Humanspeak, Inc.

Credits

Made with ♥ by Humanspeak