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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@scrollstackjs/virtual

v0.1.2

Published

Headless list virtualization for ScrollStack — render 50 rows out of 50,000, with dynamic measurement, window scrolling and an infinite-scroll bridge. Framework-agnostic.

Readme

@scrollstackjs/virtual

npm gzipped license

Headless list virtualization for ScrollStack — render 50 rows out of 50,000. Dynamic row measurement, window or container scrolling, and a bridge that keeps loading pages once the sentinel a virtual list can't render is no longer an option. 2.70 KB gzipped, framework-agnostic, SSR-safe.

📖 Docs · API reference · Live demo

npm i @scrollstackjs/virtual

Useful with or without the scroll engine — a static 50,000-row table needs no pagination. Framework bindings ship with the adapters you already have: @scrollstackjs/react/virtual, /vue/virtual, /svelte/virtual.

Quick start (React)

import { useVirtualizer } from '@scrollstackjs/react/virtual';

function Rows({ rows }: { rows: Row[] }) {
  const { items, totalSize, scrollRef, measureRef } = useVirtualizer({
    count: rows.length,
    estimateSize: () => 48, // a ballpark; measured rows replace it
  });

  return (
    <div ref={scrollRef} style={{ overflow: 'auto', height: 400 }}>
      <div style={{ height: totalSize, position: 'relative' }}>
        {items.map((item) => (
          <div
            key={item.key}
            data-index={item.index}
            ref={measureRef}
            style={{
              position: 'absolute',
              top: 0,
              left: 0,
              right: 0,
              transform: `translateY(${item.start}px)`,
            }}
          >
            {rows[item.index].label}
          </div>
        ))}
      </div>
    </div>
  );
}

Three pieces do all the work: a spacer sized to totalSize so the scrollbar is honest, item.start to place each row, and data-index + measureRef so rows of unequal height correct their own estimates.

Headless (any framework)

import { createVirtualizer } from '@scrollstackjs/virtual';

const virtualizer = createVirtualizer({ count: rows.length, estimateSize: () => 48 });
virtualizer.setScrollElement(document.querySelector('#scroller')); // or `window`

virtualizer.subscribe(() => {
  const { items, totalSize } = virtualizer.getSnapshot();
  render(items, totalSize);
});

The snapshot changes only when the rendered window changes, so scrolling within the current window costs a binary search rather than a render.

With infinite scrolling

A virtual list can't rely on a sentinel — the element after the last row usually isn't in the DOM. connectInfiniteScroll watches the rendered window instead and asks the engine for another page as it nears the end:

import { useInfiniteScroll } from '@scrollstackjs/react';
import { useVirtualizer } from '@scrollstackjs/react/virtual';
import { connectInfiniteScroll } from '@scrollstackjs/virtual';

function Feed() {
  const { pages, engine } = useInfiniteScroll({
    initialPageParam: 0,
    fetchPage,
    getNextPageParam: (last) => last.nextCursor,
  });

  // The only thing the two stores share is how many rows there are.
  const rows = useMemo(() => pages.flatMap((page) => page.items), [pages]);

  const { items, totalSize, scrollRef, measureRef, virtualizer } = useVirtualizer({
    count: rows.length,
    estimateSize: () => 64,
  });

  useEffect(
    () => connectInfiniteScroll(virtualizer, engine, { threshold: 5 }),
    [virtualizer, engine],
  );

  // …render as above, reading rows[item.index]
}

It loads the first page too, leaves a failed load to the engine's retry policy, and requests one page per count so a slow API can't stack up duplicate requests.

Vue and Svelte wire up the same way — see the worked examples for all of them.

License

MIT