InfiniteScroll
Data Display
stable
Sentinel-based infinite scroll that fires a load event when the user reaches the start or end of a scrollable area.
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- sideTInfiniteScrollSide'end'
- Which edge(s) of the scroll area to observe. "both" watches top and bottom simultaneously.
- modeTInfiniteScrollMode'intersect'
- How the next page is triggered. "intersect" fires automatically when the sentinel enters the viewport; "manual" shows a Load More button.
- loadMoreTextstring'Load more'
- Label for the Load More button shown in manual mode.
- emptyTextstring'No more items'
- Message displayed when the done callback is called with "empty".
- marginstring
- Root margin passed to the IntersectionObserver. Expands the detection zone, e.g. "0px 0px 200px 0px" to load ahead.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- colorTColor
- Color applied to the progress spinner and the Load More button.
- bgColorTColor
- heightnumber | string
- Explicit height. Set this to make the component itself the scroll container.
- maxHeightnumber | string
- Maximum height before the scroll container clips and scrolls.
- maxWidthnumber | string
- minHeightnumber | string
- minWidthnumber | string
- widthnumber | string
- tagstring'div'
- HTML element rendered at the root of the scroll container.
- directionTDirection'vertical'
- Scroll axis to observe.
- fontSizeTFontSize
API
Slots
Emplacements de contenu exposés par ce composant.
- #error
- Content shown after done("error") is called. Use props.onClick to retry.
- #empty
- Content shown after done("empty") is called. The default renders the emptyText string.
- #loading
- Custom loading indicator shown while a page fetch is in flight. The default renders an OrigamProgress spinner.
- #loadMore
- Custom Load More trigger shown in manual mode. The default renders an OrigamBtn.
- #default
- The scrollable list content. Items are appended here as new pages load.
API
Emits
Événements émis par ce composant.
- @load{ side: TInfiniteScrollSide, done: (status: 'ok' | 'empty' | 'error') => void }
- Fired when the sentinel enters the viewport (or the user clicks Load More in manual mode). Call done("ok") after appending data, done("empty") when there are no more pages, or done("error") on failure.
Interactif
Playground
Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.
Rendu de l’aperçu en cours…
Usage
Exemples
Extraits de code prêts à coller dans vos templates.
Automatic infinite scroll
Manual load mode