Infinite Scroll
Overview
An infinite scroll container that loads more content using the IntersectionObserver API.
This data component is intended for interfaces that need an infinite scroll container that loads more content using the IntersectionObserver API, analytics dashboards, and reporting views. Its implementation is provided as editable source so the final behavior and styling stay inside your project.
Technologies
No additional package dependency is declared for this component.
Installation
Properties
| Prop | Type | Default | Description |
|---|---|---|---|
*isLoading | boolean | - | If |
*hasMore | boolean | - | If |
*next | () => unknown | - |
|
threshold | number | 1 | The threshold is the number of pixels from the bottom of the element where the next function will be called. The range of threshold is Since InfiniteScroll is implemented with IntersectionObserver, you can find more on MDN. |
root | number | null | This property will be used as the viewport for checking visibility of the last or the first item. Must be the ancestor of the item. Defaults to the browser viewport. Since InfiniteScroll is implemented with IntersectionObserver, you can find more on MDN. |
rootMargin | string | 0px | The rootMargin is the margin around the root. You can use any valid CSS unit like px, em, rem, %, etc. Since InfiniteScroll is implemented with IntersectionObserver, you can find more on MDN. |
reverse | boolean | false | Set this property to true means that InfiniteScroll will call If your |
children | ReactNode | undefined | This property is that user will see according to thethreshold position and call next on the viewpoint. |
Usage
The live preview and its Code tab above are the working example for this component. Copy the example after installation, then provide the required values from its TypeScript signature.
Use cases
- interfaces that need an infinite scroll container that loads more content using the IntersectionObserver API
- analytics dashboards
- reporting views
Features
- Copy-paste source that remains in your repository
- TypeScript source included with the component
- Tailwind CSS classes editable in the component source
- shadcn/ui dependencies: local UI primitives
- Spectrum UI registry dependencies: @spectrumui/infinite-scroll-dependecies
Accessibility
- Test focus order, keyboard operation, labels, contrast, and screen-reader output in the final application context.
Customization
- Edit the Tailwind utility classes in the copied source to match your spacing, color, and typography tokens.
- Edit the copied source directly for visual or structural changes.
Related components
Topic guides
See how this component fits into broader interface patterns, implementation decisions, and working examples.
Infinite Scroll FAQ
Is Infinite Scroll free to use in commercial projects?
Yes. The public Infinite Scroll source is available under the Apache License 2.0, including for commercial use, subject to the LICENSE terms.
How do I install Infinite Scroll?
Run npx shadcn@latest add @spectrumui/infinite-scroll-demo. The page also exposes the source for manual installation.
Does Infinite Scroll require Motion?
No Motion dependency was detected in the documented source or registry entry for Infinite Scroll.
Does Infinite Scroll use shadcn/ui or Radix UI?
Infinite Scroll uses local shadcn/ui primitives.
Can I use Infinite Scroll in Next.js?
The documented React source is used in this Next.js application. Keep its use client directive when copying it into the App Router. Install the detected dependencies and verify any application-specific data or image configuration.
What accessibility checks should I run for Infinite Scroll?
No component-specific accessibility mechanism was detected automatically. Test keyboard operation, focus, labels, contrast, and screen-reader output before shipping.