Theme
InfiniteScroll
Loads more content when user scrolls near bottom
Start Here
Start from the smallest working snippet, then move to interactive examples and the full API contract below.
Styled quick start
Copy this entrypoint first. It includes the imports required to get the component on screen.
svelte
<script lang="ts">
import '@dryui/ui/themes/default.css';
import '@dryui/ui/themes/dark.css';
import { InfiniteScroll } from '@dryui/ui';
</script>
<InfiniteScroll>Content</InfiniteScroll>Import options
Root package
ts
import { InfiniteScroll } from '@dryui/ui'Per-component subpath
ts
import { InfiniteScroll } from '@dryui/ui/infinite-scroll'Customize
Use the interactive examples to see common variants, states, and composition patterns before building your own.
Load More on Scroll
Post 1
Post 2
Post 3
Post 4
Post 5
Post 6
Post 7
Post 8
Post 9
Post 10
Post 11
Post 12
Post 13
Post 14
Post 15
Post 16
Post 17
Post 18
Post 19
Post 20
svelte
<script lang="ts">
let items = $state(Array.from({ length: 20 }, (_, i) => ({ id: i + 1, name: `Post ${i + 1}` })));
let hasMore = $state(true);
let loading = $state(false);
async function loadMore() {
loading = true;
await new Promise(r => setTimeout(r, 800));
loading = false;
}
</script>
<InfiniteScroll onLoadMore={loadMore} {hasMore} {loading} class="scroll-container">
{#each items as item (item.id)}
<div class="scroll-item">{item.name}</div>
{/each}
{#snippet loadingIndicator()}
<div class="scroll-status">Loading…</div>
{/snippet}
{#snippet endMessage()}
<div class="scroll-status scroll-status--muted">All items loaded</div>
{/snippet}
</InfiniteScroll>Compose
The full API contract lives here: props, CSS variables, and the public data attributes you can target when styling.
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
onLoadMore | () => void | Promise<void> | — | ✓ | — |
hasMore | boolean | true | — | — |
loading | boolean | false | — | — |
rootMargin | string | '200px' | — | — |
children | Snippet | — | ✓ | — |
loadingIndicator | Snippet | — | — | — |
endMessage | Snippet | — | — | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.