Skip to main content
Version: 1.0.3

LazyLoad

Overview

The LazyLoad component defers the loading of off-screen content (like images, videos, or heavy components) until it is about to enter the viewport.
This improves initial page load times and enhances performance.

Preview

Loading...
Loading...
Loading...
Loading...
Loading...

Installation

ignix add component lazyload

Usage

Import the component:

import { LazyLoad } from './components/ui';

Example usage:

<LazyLoad 
threshold="100px"
animation="fade"
once={true}
placeholder={<Skeleton />}
>
<HeavyContent />
</LazyLoad>

Props

PropTypeDefaultDescription
childrenReact.ReactNoderequiredThe content to lazy load.
classNamestring""Custom CSS class names.
thresholdstring"100px"Distance from the viewport to start loading (e.g., "0px", "200px").
placeholderReact.ReactNodenullPlaceholder shown until the content is loaded.
oncebooleantrueIf true, content loads only once. If false, it toggles visibility when entering/exiting viewport.
animation"fade" | "slide" | "none""fade"Animation effect applied when content appears.