Skip to content

Examples

Every example on these pages is the same thing twice: a running demo you can scroll, and the code that produces it in React, Vue, Svelte, and plain TypeScript. The demos call real, free, key-free public APIs, so what you see is what the engine actually does over a network — including the failures.

Start with Basic feed if you have never used ScrollStack; everything else builds on it.

The list

ExampleWhat it shows
Basic feedThe baseline: a sentinel that loads the next page when it scrolls into view.
Pagination strategiesCursor, offset, and page-number — one engine, three getNextPageParams.
Errors and retryBackoff, a manual retry, and why a failed load-more keeps the rows you already have.
Manual controlsloadNextPage(), reset(), and a load-more button instead of a sentinel.
CancellationIn-flight requests aborted on reset, and stale responses made inert.
Horizontal railA carousel: same engine, root scoped to the scroll container.
Virtual list10,000 rows, a dozen in the DOM — and virtualization with paging on top.
DevtoolsThe inspector panel: live state, an event timeline, manual controls.
Events and pluginsLifecycle events, and a plugin that turns them into behavior.

Reading the code blocks

Each block is a complete component, not a fragment — copy it into a file and it runs. Two things are deliberately left out of every one of them: styling, which is yours, and error UI beyond what the example is about.

The adapters differ only in how a framework binds a store, so the same three options appear in all four blocks:

ts
{
  initialPageParam, // what to fetch first
  fetchPage,        // how to fetch one page
  getNextPageParam, // where the next page param comes from — null ends the list
}

If you are looking for the reference rather than a worked example, the API pages are at @scrollstackjs/core and the adapters beside it.