| 19 | type Fn = () => any; |
| 20 | |
| 21 | export interface Props extends AriaAttributes { |
| 22 | /** |
| 23 | * Total number of items currently rendered. Unlocks the next load when it |
| 24 | * changes. Always pass the length of your full accumulated list, not just |
| 25 | * the most recently fetched page. |
| 26 | */ |
| 27 | dataLength: number; |
| 28 | /** |
| 29 | * Called when the user scrolls near the end of the list. Must append new |
| 30 | * items to your list state (not replace them). The component calls this at |
| 31 | * most once per data load, guarded by an IntersectionObserver sentinel. |
| 32 | */ |
| 33 | next: Fn; |
| 34 | /** |
| 35 | * Whether more data exists to load. When false, the observer stops and |
| 36 | * `endMessage` is shown instead of `loader`. |
| 37 | */ |
| 38 | hasMore: boolean; |
| 39 | /** |
| 40 | * The full accumulated list of items to render. Pass every item loaded so |
| 41 | * far — the component is not paginated internally. |
| 42 | */ |
| 43 | children: ReactNode; |
| 44 | /** |
| 45 | * Element shown while the next page is being fetched (while `hasMore` is |
| 46 | * true and `next` has been triggered). |
| 47 | */ |
| 48 | loader: ReactNode; |
| 49 | /** |
| 50 | * How close to the end of the list before `next` fires. |
| 51 | * - Number 0–1: fraction of container height, e.g. `0.8` triggers at 80% |
| 52 | * scrolled (default). |
| 53 | * - Pixel string: absolute offset, e.g. `"200px"` triggers 200 px before |
| 54 | * the end. |
| 55 | * @default 0.8 |
| 56 | */ |
| 57 | scrollThreshold?: number | string; |
| 58 | /** Shown below the list once `hasMore` is false. */ |
| 59 | endMessage?: ReactNode; |
| 60 | /** Inline styles applied to the inner scroll container. */ |
| 61 | style?: CSSProperties; |
| 62 | /** |
| 63 | * Fixed height for the scroll container. When provided, a scrollable box |
| 64 | * of this height is rendered. Omit to scroll the window (document body). |
| 65 | */ |
| 66 | height?: number | string; |
| 67 | /** |
| 68 | * A scrollable parent element that already provides overflow scrollbars. |
| 69 | * Accepts a DOM element reference or the element's string `id`. Pass this |
| 70 | * instead of `height` when the scroll container is owned by the parent. |
| 71 | * |
| 72 | * @example |
| 73 | * // string id |
| 74 | * scrollableTarget="scrollableDiv" |
| 75 | * |
| 76 | * @example |
| 77 | * // ref value |
| 78 | * const ref = useRef(null); |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…