Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Collections

  • QuestionCard
  • Table
  • Book3D
  • ProTable
  • PricingTable
  • JsonViewer
  • EditableTable
  • List
  • Descriptions
  • RowActions
  • Tree
  • Card
  • Carousel
  • Video
  • Audio
  • BentoGrid
  • Image
  • MagicCard
  • AnimatedList
  • Marquee
  • Sortable
  • Kanban
  • DesignCanvas
  • LayerTree
  • StageDraw
  • SlideDeck
  • PresenterView
  • ComponentPicker
  • EventStream
  • QueueLane
  • DocumentSheet
  • Novel reader
  • Scheduler
  • Org classroom
  • Danmaku
  • LiveChat
  • LivePlayer
  • LogViewer
  • FileTree
  • CodeReviewThread
  • VirtualList
  • InfiniteScroll
  • LogoLoop
  • BounceCards
  • CardSwap
  • ChromaGrid
  • CircularGallery
  • DomeGallery
  • FlyingPosters
  • InfiniteMenu
  • MagicBento
  • ScrollStack
  • ProfileCard
  • TiltedCard
  • PixelCard
  • DecayCard
  • ReflectiveCard
  • Folder

Charts and Diagrams

  • Flow
  • Diagram
  • Paper
  • SequenceDiagram
  • Sankey
  • Sparkline
  • Funnel
  • Treemap
  • Gantt
  • Heatmap
  • ContributionGraph
  • Legend
  • Chart
  • WorldMap

Information

  • ImageViewer
  • LiveProductCard
  • DiffStat
  • ScoreRing
  • ScoreScale
  • Badge
  • Dot
  • StatusDot
  • Chip
  • FilterChip
  • Coupon
  • Tag
  • Annotation
  • Avatar
  • AvatarCircles
  • User
  • QRCode
  • Comment
  • RelativeTime
  • GitCommit
  • DeployStatus
  • ShieldBadge
  • AwardBadge
  • CreditCard
  • IconTile

Metrics

  • Stat
  • Statistic
  • Meter
  • Timeline
  • NumberTicker

Placeholders

  • Empty
  • Skeleton
  • Watermark

InfiniteScroll

infinite-scroll

Loads additional content near the viewport boundary with pending and terminal states.

Usage

Automatically load when scrolling to the end

When the bottom sentry enters the viewport, it is adjusted to onLoadMore; the returned Promise will not be triggered repeatedly.

List items 1
List items 2
List items 3
List items 4
List items 5
List items 6
List items 7
List items 8
List items 9
List items 10
List items 11
List items 12
List items 13
List items 14
List items 15
tsx
<InfiniteScroll onLoadMore={loadMore} hasMore={hasMore}>
  {items.map((it) => (
    <Row key={it.id} data={it} />
  ))}
</InfiniteScroll>

Reached the end

When hasMore={false}, stop observing and display the completed copy (can be customized with finishedText).

List items 1
List items 2
List items 3
List items 4
List items 5
· The end ·
tsx
<InfiniteScroll onLoadMore={loadMore} hasMore={false} finishedText="· The end ·">
  {items.map((it) => (
    <Row key={it.id} data={it} />
  ))}
</InfiniteScroll>

When to use

Use InfiniteScroll to fetch another page as a moderate-sized list approaches its bottom, stopping when hasMore=false. Use VirtualList when rendering all rows would create too many DOM nodes; its onReachEnd can trigger the same pagination logic.

Import

ts
import { InfiniteScroll } from "@hulianui/ui"

Props

NameTypeDefaultDescription
hasMore*boolean-Whether more data exists; false stops observation and shows the finished content.
thresholdnumber100Distance in pixels before the bottom that triggers loading through rootMargin.
classNamestring-Custom class name.

Events

EventTypeDescription
onLoadMore*() => Promise<void>|voidLoads the next page; a returned Promise prevents repeat triggers while pending.

Slots

SlotTypeDescription
children*ReactNodeAlready rendered list content.
loadingTextReactNodeLoading message; the built-in runtime default is "\u52a0\u8f7d\u4e2d\u2026" ("Loading...").
finishedTextReactNodeCompletion message; the built-in runtime default is "\u6ca1\u6709\u66f4\u591a\u4e86" ("No more items").

Pitfalls

Return a Promise from asynchronous onLoadMore work so the pending-state lock can prevent duplicate requests. The sentinel automatically chooses a scrollable ancestor as the IntersectionObserver root; provide a clear overflow-y-auto container or it falls back to viewport observation.

Related

Table · Book3D · ProTable · PricingTable · JsonViewer · EditableTable

PreviousVirtualListData DisplayNextBadge

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • Props
    • Events
    • Slots
    • Pitfalls
    • Related