DmInfiniteScroll
DmInfiniteScroll documents the DmInfiniteScroll export from duskmoon.
@duskmoon-dev/components/dm-infinite-scroll Usage
When to use
- Use it in DuskMoon application screens that need a packaged, opinionated workflow component.
- Reach for the lower-level standard component when the screen needs custom composition.
Implementation notes
Features
Wraps lower-level primitives into a higher-level DuskMoon-prefixed workflow API.
Examples show the defaults and composition points expected by internal DuskMoon app screens.
DmInfiniteScroll is most often configured through `id`, `prefix`, `dataLength`, `next`.
Renders prefixed scroll container and children
Feature Demos
Feature demos are authored for the component page, then supplemented with behavior scenarios from the component test coverage.
Basic usage
Import the component stylesheet and DmInfiniteScroll from its package subpath, then render it with the core props.
import "@duskmoon-dev/components/styles.css";
import { DmInfiniteScroll } from "@duskmoon-dev/components/dm-infinite-scroll";
export function Example() {
return (<DmInfiniteScroll>DuskMoon Dm Infinite Scroll</DmInfiniteScroll>);
} Renders prefixed scroll container and children
test-backedDmInfiniteScroll scenario from the component test coverage: renders prefixed scroll container and children.
import "@duskmoon-dev/components/styles.css";
import { DmInfiniteScroll } from "@duskmoon-dev/components/dm-infinite-scroll";
export function DmInfiniteScrollRendersPrefixedScrollContainerDemo() {
return (<DmInfiniteScroll>DuskMoon Dm Infinite Scroll</DmInfiniteScroll>);
} Calls next once when ratio threshold is reached
test-backedDmInfiniteScroll scenario from the component test coverage: calls next once when ratio threshold is reached.
import "@duskmoon-dev/components/styles.css";
import { DmInfiniteScroll } from "@duskmoon-dev/components/dm-infinite-scroll";
export function DmInfiniteScrollCallsNextOnceWhenDemo() {
return (<DmInfiniteScroll>DuskMoon Dm Infinite Scroll</DmInfiniteScroll>);
} Unlocks next when dataLength changes
test-backedDmInfiniteScroll scenario from the component test coverage: unlocks next when datalength changes.
import "@duskmoon-dev/components/styles.css";
import { DmInfiniteScroll } from "@duskmoon-dev/components/dm-infinite-scroll";
export function DmInfiniteScrollUnlocksNextWhenDataLengthDemo() {
return (<DmInfiniteScroll>DuskMoon Dm Infinite Scroll</DmInfiniteScroll>);
} Supports pixel threshold, inverse mode, custom prefix, and loader
test-backedDmInfiniteScroll scenario from the component test coverage: supports pixel threshold, inverse mode, custom prefix, and loader.
import "@duskmoon-dev/components/styles.css";
import { DmInfiniteScroll } from "@duskmoon-dev/components/dm-infinite-scroll";
export function DmInfiniteScrollSupportsPixelThresholdInverseDemo() {
return (<DmInfiniteScroll>DuskMoon Dm Infinite Scroll</DmInfiniteScroll>);
} Theme aware
Docs previews inherit the DuskMoon data-theme value. Use the header switch to compare light and dark rendering.
<div data-theme="sunshine">
<DmInfiniteScroll>DuskMoon Dm Infinite Scroll</DmInfiniteScroll>
</div>
<div data-theme="moonlight">
<DmInfiniteScroll>DuskMoon Dm Infinite Scroll</DmInfiniteScroll>
</div> API
The API reference below lists every parsed exported type or interface for DmInfiniteScroll. Start with `id`, `prefix`, `dataLength`, `next` for common usage.
packages/components/src/components/dm-infinite-scroll/DmInfiniteScroll.types.ts
Scenarios: packages/components/src/components/dm-infinite-scroll/DmInfiniteScroll.test.tsx | Prop | Type | Required | Description |
|---|---|---|---|
id | string | Yes | id configures DmInfiniteScroll. |
prefix | string | No | prefix configures DmInfiniteScroll. |
children | ReactNode | No | children configures DmInfiniteScroll. |
dataLength | number | Yes | dataLength configures DmInfiniteScroll. |
next | () => void | Promise<void> | Yes | next configures DmInfiniteScroll. |
hasMore | boolean | Yes | hasMore configures DmInfiniteScroll. |
loader | ReactNode | No | loader configures DmInfiniteScroll. |
endMessage | ReactNode | No | endMessage configures DmInfiniteScroll. |
scrollThreshold | DmScrollThreshold | No | scrollThreshold configures DmInfiniteScroll. |
height | number | string | No | height configures DmInfiniteScroll. |
hasChildren | boolean | No | hasChildren configures DmInfiniteScroll. |
inverse | boolean | No | inverse configures DmInfiniteScroll. |
initialScrollY | number | No | initialScrollY configures DmInfiniteScroll. |
onScroll | (event: UIEvent<HTMLDivElement>) => void | No | onScroll configures DmInfiniteScroll. |
number | `${number}px` | string