Skip to content

Load more

Pro

The end of a list loaded a page at a time: loads as the end comes near, with Load more, a loading state and Retry. Not an M3 component (@windmorph/react-pro).

import { LoadMore } from '@windmorph/react-pro';

Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.

Props

LoadMore 11 props

  • statustype "idle" | "loading" | "error" | "done"Required

    Where the list is: more to load, loading, failed, or all loaded.

  • autotype booleandefault false

    Loads by itself as the end comes near, with Load more as the keyboard and screen-reader fallback (a feed). Off, Load more waits for a press, so the content after the list (a footer) stays reachable by scrolling and the keyboard (WCAG 2.1.1, 2.4.3).

  • rootMargintype stringdefault "800px 0px"

    How near, as the observer's rootMargin.

  • loadingIndicatortype ReactNodedefault a loading indicator

    What shows while loading, e.g. a skeleton of one item.

  • endMessagetype ReactNodedefault no end text

    What shows once all is loaded.

  • reftype Ref<HTMLDivElement>

    The root, which holds focus while a page loads. Its other props (id, aria-*, data-*) go to it too.

Events

  • onLoadMoretype () => voidRequired

    Loads the next page (and retries a failed one).

Text

  • labelstype Partial<LoadMoreLabels>

    Its words, for translation. A LabelsProvider sets them for the whole app.

Also accepts the root element's HTML attributes (id, data-*, event handlers).

Spec status

Not part of Material Design 3: a Windmorph Pro component, built on M3's colour roles, type scale, shapes and motion. Its variants and configurations each link to a live example.

  • Load more button (manual)

    Built

    Configuration · List

  • Loading as you scroll (auto)

    Built

    Configuration · Auto

  • Status: idle, loading, error, done

    Built

    Variant · List, Auto

  • Retry after a failed page

    Built

    Use case · List

  • Custom loading and end content

    Built

    Configuration · Auto

Theming & tokens

Set the tokens below on it or any ancestor. Style the parts with classNames (root, button, error).

Load more tokens
VariableDefaultPaints
--wm-load-more-gap16pxBetween what it shows (the message and Retry).
--wm-load-more-padding-block8pxAbove and below it.
--wm-load-more-error-colorvar(--md-sys-color-error)The message when a page fails.