import-on-visibility

Lazy-load UI components when they enter the viewport using IntersectionObserver.

235|25|Updated Mar 24, 2026
One-click install
npx skills add https://github.com/PatternsDev/skills --skill import-on-visibility
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: import-on-visibility
Source: https://github.com/PatternsDev/skills/tree/main/javascript/import-on-visibility
Command: npx skills add https://github.com/PatternsDev/skills --skill import-on-visibility

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Below-the-fold UI components can delay the initial render; this skill provides a pattern to lazily import or render those components only when they become visible.

Core Features & Use Cases

  • Use the IntersectionObserver API to detect when a component enters the viewport
  • Leverage libraries such as react-lazyload or react-loadable-visibility for quick implementation
  • Provide a loading fallback component while the module or component loads

Quick Start

Install or import the visibility-based loader and wrap your component so it loads when it enters the viewport.

Frequently Asked Questions about import-on-visibility

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I lazy-load React components when they enter the viewport?

To lazy-load React components when they enter the viewport, use the IntersectionObserver API or libraries like react-lazyload to dynamically import below-the-fold content only when it becomes visible, improving initial render performance.

What is visibility-based lazy loading for web performance?

Visibility-based lazy loading is a web performance technique that delays the import or rendering of below-the-fold UI components until they enter the viewport, preventing heavy widgets and images from delaying the initial page render.

How do I show a loading fallback while lazy loading a component?

To show a loading fallback while lazy loading a component, wrap your component with a visibility-based loader that supports a loading fallback component, displaying it until the module or component fully loads for a smooth user experience.

Does IntersectionObserver work with Vue for lazy loading below-the-fold content?

IntersectionObserver works with Vue for lazy loading below-the-fold content by detecting when elements enter the viewport to trigger dynamic imports, reducing initial render delays for heavy widgets and images.

When should I use visibility-based lazy loading for UI components?

Use visibility-based lazy loading for UI components when you have below-the-fold content like heavy widgets or images that delay initial render, applying the IntersectionObserver API to import them only as they enter the viewport.