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
| Prop | Type | Default | Description |
|---|---|---|---|
onLoadMore | () => void | Promise<void> | — | Fires when the sentinel scrolls into view. |
loading | boolean | false | Suppress firings while a request is in flight. |
hasMore | boolean | true | Stops firing once data is exhausted. |
rootMargin | string | '0px 0px 200px 0px' | IntersectionObserver root margin. |
children | Snippet | — | Your scrollable list. |
loader | Snippet | — | Override the loading indicator. |
Install
CLI
npx @a3tai/mittsu add infinite-scroll