Infinite Scroll

A high-performance infinite scroll component that automatically loads more content as users scroll.

Installation

Install the Infinite Scroll component using your preferred package manager.

npxshadcn@latest addhttps://rigidui.com/registry/infinite-scroll

Usage

The Infinite Scroll component provides seamless content loading as users scroll. It uses the Intersection Observer API for optimal performance and supports various configurations including reverse loading for chat interfaces.

Live Preview

📱 Interactive Demo: Scroll down to see more items load automatically!

Product Listing Feature

Showcase infinite scroll with product catalogs and inventory management.

Social Media Feed

Perfect for displaying posts, comments, and user-generated content.

Discover Its Features

The Infinite Scroll component is packed with powerful features designed to provide an exceptional user experience.

Automatic Loading

Automatically loads more content when user scrolls near the bottom using Intersection Observer API.

High Performance

Uses efficient Intersection Observer instead of scroll events for better performance and battery life.

Flexible Configuration

Customizable loading triggers, custom loaders, error states, and support for reverse loading.

Mobile Optimized

Touch-friendly scrolling with optimized performance for mobile devices and responsive design.

API Reference

PropTypeDefaultDescription
items*T[]Array of items to display
hasNextPage*booleanWhether there are more items to load
isLoading*booleanWhether the component is currently loading
onLoadMore*() => void | Promise<void>Function called when more items should be loaded
renderItem*(item: T, index: number) => React.ReactNodeFunction to render each item
thresholdnumber100Distance in pixels from bottom to trigger loading
loaderReact.ComponentTypeDefaultLoaderCustom loading component
endMessageReact.ReactNodeDefault end messageMessage shown when all items are loaded
errorMessageReact.ReactNodeundefinedError message to display when loading fails
classNamestring''Additional CSS classes for the container
itemClassNamestring''Additional CSS classes for each item wrapper
reversebooleanfalseWhether to load items in reverse order (useful for chat)
initialLoadbooleanfalseWhether to automatically load initial data on mount
scrollableTargetstringundefinedID of custom scroll container element