Back to Components

Data

InfiniteScroll

IntersectionObserver-based load-more sentinel. Wrap your list — when the sentinel scrolls into view, onLoadMore fires.

Examples

Lazy-loading rows

Row 1
Row 2
Row 3
Row 4
Row 5
Row 6
Row 7
Row 8
Row 9
Row 10
Row 11
Row 12
Row 13
Row 14
Row 15
Row 16
Row 17
Row 18
Row 19
Row 20
<InfiniteScroll {onLoadMore} {loading} {hasMore}>
  {#each items as id}
    <div>Row {id}</div>
  {/each}
</InfiniteScroll>

Props

PropTypeDefaultDescription
onLoadMore() => void | Promise<void>Fires when the sentinel scrolls into view.
loadingbooleanfalseSuppress firings while a request is in flight.
hasMorebooleantrueStops firing once data is exhausted.
rootMarginstring'0px 0px 200px 0px'IntersectionObserver root margin.
childrenSnippetYour scrollable list.
loaderSnippetOverride the loading indicator.

Install

CLI

npx @a3tai/mittsu add infinite-scroll