Article 1
What happened today, in a few words.
More as the reader nears the end — or the start, for a chat — with whatever scrolls. It keeps asking until the content fills the box, keeps the reading place, and gives a feed its keys.
What happened today, in a few words.
What happened today, in a few words.
What happened today, in a few words.
What happened today, in a few words.
What happened today, in a few words.
What happened today, in a few words.
What happened today, in a few words.
What happened today, in a few words.
import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScFrame, ScInfiniteScroll, ScSpinner } from '@semantic-components/ui';import { SiLoaderCircleIcon } from '@semantic-icons/lucide-icons';
interface Item { readonly id: number; readonly title: string; readonly text: string;} One part, around your items. The Load more button and the status are your markup: a button calling loadMore(), a role="status" with your words.
import { ScInfiniteScroll } from '@semantic-components/ui';<div scInfiniteScroll #feed="scInfiniteScroll" role="feed" aria-label="News" [loading]="loading()" [done]="done()" (more)="load()"> @for (item of items(); track item.id) { <article tabindex="0">…</article> }</div><p role="status">@if (loading()) { Loading… } @else if (done()) { That’s all. }</p><button (click)="feed.loadMore()">Load more</button>(more) when a marker after your items is within distance (200px) of the edge of what scrolls — itself, the box around it, or the page — and it is not loading, not done. auto off: only loadMore() asks — after an error, so a failing server isn't asked again and again. direction="start", a chat: it opens at the end, and older items come in above while the one being read stays put — no column-reverse needed. On a role="feed" with role="article" items (WAI-ARIA's feed):
aria-busy is on it while loading. For articles, a role="feed", each article with aria-posinset and aria-setsize (-1 until done). role="status" kept in the page: "Loading…", "That's all", an error. 5 results shown.
import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScButton, ScFrame, ScInfiniteScroll } from '@semantic-components/ui';
interface Item { readonly id: number; readonly title: string;}
/** auto off: only the button asks — the footer stays within reach, and the reader decides. */@Component({import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScButton, ScFrame, ScInfiniteScroll } from '@semantic-components/ui';
interface Item { readonly id: number; readonly title: string;}
/** A load fails: auto off, so it does not ask again by itself; the status says so and the button tries again. */@Component({import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScFrame, ScInfiniteScroll } from '@semantic-components/ui';
interface Message { readonly id: number; readonly text: string; readonly mine: boolean;}
/** direction="start": it opens at the end, and older messages come in above as the reader scrolls up — the one they were reading stays where it was. */import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScFrame, ScInfiniteScroll } from '@semantic-components/ui';
interface Item { readonly id: number; readonly name: string;}
/** Any layout: here a grid of products. The first page does not fill the box — it asks again, until the box is full or there is no more. */@Component({import { Dir } from '@angular/cdk/bidi';import { Component, LOCALE_ID, ViewEncapsulation, signal } from '@angular/core';import { ScFrame, ScInfiniteScroll, ScSpinner } from '@semantic-components/ui';import { SiLoaderCircleIcon } from '@semantic-icons/lucide-icons';
interface Item { readonly id: number; readonly title: string;}| Part | Selector | Description |
|---|---|---|
ScInfiniteScroll | [scInfiniteScroll] | Around your items: (more) near the end or the start; aria-busy; a feed’s keys. exportAs: loadMore(). |
| Input | Type | Default | Description |
|---|---|---|---|
loading | boolean | false | Your load is under way: nothing more is asked for. |
done | boolean | false | There is no more. |
distance | number | 200 | How near the end (px) asks for more. |
direction | 'end' | 'start' | 'end' | `start`: a chat — older items come in above. |
auto | boolean | true | Off: only loadMore() asks. |