Install
How it works
EachLazySection places a sentinel and watches it with an IntersectionObserver. When the
sentinel approaches the viewport the section joins the mount queue; the queue releases one
section at a time. A section that travels far enough past the viewport unmounts again, which is
what keeps a long page’s memory flat rather than monotonically rising.
The load margin adapts to the screen: 100px on a narrow viewport, 300px otherwise. A phone gets
less runway because it has less memory to spend on speculative mounting.
Props
Earlier documentation listed
section, priority, unmountDistance and disabled. None of
those is the current API — the name is label, and ordering comes from the queue and
document order rather than from a priority number.role="status" and an accessible label, so
a screen reader announces that something is loading rather than reading nothing.
Memory pressure
useMemoryPressure watches JavaScript heap usage and reports when it crosses a threshold. It
is a Chrome-only API, and the hook degrades to a no-op elsewhere rather than throwing.
isUnderPressure is false there — treat
it as a hint that lets you do better on the browsers that report, not as a guarantee you are
under the limit.
The design portal hosts a live demonstration of sequential mounting — the first section loads
eagerly while the rest wait in the queue and mount one at a time behind skeletons. That
interactive React surface does not port to this documentation site.