Skip to content
Enact

ui/Placeholder

Exports the ui/Placeholderui/Placeholder.PlaceholderControllerDecorator and ui/Placeholderui/Placeholder.PlaceholderDecorator higher-order components.

The default export is ui/Placeholderui/Placeholder.PlaceholderDecorator.

PlaceholderControllerDecorator   Higher-Order Component

Section titled “PlaceholderControllerDecorator   Higher-Order Component ”

A higher-order component (HOC) that renders placeholder components.

Components are rendered based on their position relative to the 'scrollTop' from the 'onScroll''s parameter. They are not unmounted once rendered.

Configuration

The bounds of the container represented by an object with height and width members.

If the container is a static size, this can be specified at design-time to avoid calculating the bounds at run-time (the default behavior).

Default: null

Event callback which indicates that the viewport has scrolled and placeholders should be notified.

Default: onScroll

Multiplier used with the wrapped component's height and width to determine the threshold for replacing the placeholder component with the true component.

Default: 1.5

PlaceholderDecorator   Higher-Order Component

Section titled “PlaceholderDecorator   Higher-Order Component ”

A higher-order component that enables a container to notify the wrapped component when scrolling.

Containers must provide registerPlaceholder, unregisterPlaceholder, and invalidateBounds methods via React's context for PlaceholderDecorator instances.

No additional properties are passed to the wrapped component.

Configuration

Configures the style of the placeholder element

Default: {height: 0, width: 'auto'}

The component to use as a placeholder.

Default: 'div'