Infinite Scroll

Load the next page when a sentinel scrolls into view, with a loading row, an end of list message and a Load more button as the accessible fallback.

src/registry/ui/infinite-scroll.tsx/r/infinite-scroll.json

Installation#

bash
npx shadcn@latest add https://ui.minidev.pro/r/infinite-scroll.json

Usage#

tsx
import { InfiniteScroll } from "@/components/ui/infinite-scroll"

export function Example() {
  return <InfiniteScroll />
}

API reference#

InfiniteScroll props
PropTypeDefault
loadMore(page: number) => Promise<{ items: T[]; hasMore: boolean }>-
renderItem(item: T, index: number) => React.ReactNode-
rootMarginstring"240px"
classNamestring-

Dependencies#

npm

React only

Built from

All data table components