ngx-infinite-scroll vs ngx-virtual-scroller vs react-infinite-scroll-component vs react-virtualized vs react-window vs vue-virtual-scroller
Infinite Scroll and Virtual Scrolling Libraries
ngx-infinite-scrollngx-virtual-scrollerreact-infinite-scroll-componentreact-virtualizedreact-windowvue-virtual-scrollerSimilar Packages:

Infinite Scroll and Virtual Scrolling Libraries

These libraries provide solutions for implementing infinite scrolling and virtual scrolling in web applications, enhancing the user experience by efficiently loading and displaying large datasets without overwhelming the browser. Infinite scrolling allows users to continuously load more content as they scroll down, while virtual scrolling optimizes rendering by only displaying the items currently in view, significantly improving performance and responsiveness in applications with extensive lists or grids.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
ngx-infinite-scroll01,25370.3 kB166 months agoMIT
ngx-virtual-scroller0985-1536 years agoMIT
react-infinite-scroll-component03,085217 kB134an hour agoMIT
react-virtualized027,0722.24 MB4a year agoMIT
react-window017,187209 kB14 months agoMIT
vue-virtual-scroller010,770461 kB19617 days agoMIT

Feature Comparison: ngx-infinite-scroll vs ngx-virtual-scroller vs react-infinite-scroll-component vs react-virtualized vs react-window vs vue-virtual-scroller

Integration

  • ngx-infinite-scroll:

    Seamlessly integrates with Angular's lifecycle and change detection, making it easy to implement and manage within Angular applications.

  • ngx-virtual-scroller:

    Designed specifically for Angular, it leverages Angular's features to provide a smooth integration experience for developers.

  • react-infinite-scroll-component:

    Offers a simple API that works well with both class and functional components, making it versatile for different React project structures.

  • react-virtualized:

    Provides a rich set of components designed for complex use cases, integrating well with existing React applications and offering extensive customization options.

  • react-window:

    Lightweight and easy to integrate into any React application, focusing on performance with minimal configuration required.

  • vue-virtual-scroller:

    Built for Vue.js, it integrates well with Vue's reactivity system, allowing developers to implement virtual scrolling effortlessly.

Performance Optimization

  • ngx-infinite-scroll:

    Optimizes loading of additional content only when the user scrolls near the bottom of the page, reducing unnecessary data fetching and improving performance.

  • ngx-virtual-scroller:

    Efficiently manages rendering by only displaying items in the viewport, significantly reducing the number of DOM nodes and improving rendering speed.

  • react-infinite-scroll-component:

    Uses a threshold to determine when to load more items, ensuring that the application remains responsive even with large datasets.

  • react-virtualized:

    Highly optimized for performance, it minimizes re-renders and efficiently manages large datasets with features like windowing and dynamic row heights.

  • react-window:

    Focuses on rendering only the visible portion of lists, leading to improved performance in applications with extensive data sets.

  • vue-virtual-scroller:

    Efficiently renders only the visible items in a list, reducing memory usage and improving the overall performance of Vue applications.

Ease of Use

  • ngx-infinite-scroll:

    Simple to set up with minimal configuration, making it accessible for developers new to Angular or infinite scrolling.

  • ngx-virtual-scroller:

    Provides a straightforward API that is easy to understand, allowing developers to implement virtual scrolling quickly.

  • react-infinite-scroll-component:

    Designed for ease of use, it requires minimal setup and provides clear documentation for quick implementation.

  • react-virtualized:

    While powerful, it has a steeper learning curve due to its extensive features, requiring more time to master.

  • react-window:

    Offers a simple API that is easy to learn, making it suitable for developers looking for a quick solution to virtual scrolling.

  • vue-virtual-scroller:

    User-friendly with a clear API, allowing Vue developers to implement virtual scrolling without a steep learning curve.

Customizability

  • ngx-infinite-scroll:

    Allows customization of loading indicators and thresholds, giving developers flexibility in how infinite scrolling behaves.

  • ngx-virtual-scroller:

    Highly customizable, enabling developers to define item sizes and customize rendering behavior for different use cases.

  • react-infinite-scroll-component:

    Provides props for customizing loading behavior and thresholds, allowing for tailored user experiences.

  • react-virtualized:

    Extensive customization options for rendering components, row heights, and more, catering to complex application needs.

  • react-window:

    Offers basic customization for item rendering, focusing on simplicity while still allowing for some degree of flexibility.

  • vue-virtual-scroller:

    Customizable item rendering and sizes, making it adaptable for various use cases in Vue applications.

Community and Support

  • ngx-infinite-scroll:

    Supported by a growing community of Angular developers, with documentation and examples available for assistance.

  • ngx-virtual-scroller:

    Has a dedicated user base within the Angular community, providing resources and support for developers.

  • react-infinite-scroll-component:

    Well-documented with a robust community, making it easy to find solutions and examples for common issues.

  • react-virtualized:

    A mature library with extensive documentation and a strong community, offering numerous resources for troubleshooting and implementation.

  • react-window:

    Backed by the same community as react-virtualized, it benefits from shared knowledge and resources, ensuring good support.

  • vue-virtual-scroller:

    Supported by the Vue community, with documentation and examples readily available for developers.

How to Choose: ngx-infinite-scroll vs ngx-virtual-scroller vs react-infinite-scroll-component vs react-virtualized vs react-window vs vue-virtual-scroller

  • ngx-infinite-scroll:

    Choose ngx-infinite-scroll if you are working with Angular and need a straightforward solution for infinite scrolling that integrates seamlessly with Angular's change detection and lifecycle hooks.

  • ngx-virtual-scroller:

    Select ngx-virtual-scroller for Angular applications where you need to efficiently render large lists or grids by only displaying items in the viewport, reducing memory usage and improving performance.

  • react-infinite-scroll-component:

    Opt for react-infinite-scroll-component if you are using React and want an easy-to-implement infinite scrolling solution that supports both functional and class components with customizable loading indicators.

  • react-virtualized:

    Choose react-virtualized for complex React applications that require a comprehensive set of features for rendering large lists and tables, including support for fixed headers, variable row heights, and dynamic loading.

  • react-window:

    Select react-window for a lightweight alternative to react-virtualized, ideal for simple use cases where you need efficient rendering of large lists with minimal overhead and a straightforward API.

  • vue-virtual-scroller:

    Use vue-virtual-scroller if you are developing with Vue.js and need a performant solution for rendering long lists or grids, providing a simple API to manage virtual scrolling.

README for ngx-infinite-scroll

Build Status Backers on Open Collective Sponsors on Open Collective npm version npm version npm downloads a month npm downloads a week

Consider Becoming a sponsor

Angular Infinite Scroll

versions now follow Angular's version to easily reflect compatibility.
Meaning, for Angular 10, use ngx-infinite-scroll @ ^10.0.0

Angular - Older Versions Support

Starting Angular 6 and Above - ngx-infinite-scroll@THE_VERSION.0.0
For Angular 4 and Angular = ^5.5.6 - use version ngx-infinite-scroll@0.8.4
For Angular 5.x with rxjs =<5.5.2 - use version ngx-infinite-scroll@0.8.3
For Angular version <= 2.3.1, you can use npm i angular2-infinite-scroll (latest version is 0.3.42) - please notice the angular2-infinite-scroll package is deprecated

Used By

and much more.

These analytics are made available via the awesome Scarf package analytics library

Opt-Out Of Scarf

Scarf can be disabled by following these directions

Front End Consulting Services

I'm a Senior Front End Engineer & Consultant at Orizens. My services include:

  • Angular/React/Javascript Consulting
  • Front End Architecture Consulting
  • Project Code Review
  • Project Development

Contact Here

Webpack and Angular

Installation

npm install ngx-infinite-scroll --save

Supported API

Properties

@Input()TypeRequiredDefaultDescription
infiniteScrollDistancenumberoptional2the bottom percentage point of the scroll nob relatively to the infinite-scroll container (i.e, 2 (2 * 10 = 20%) is event is triggered when 80% (100% - 20%) has been scrolled). if container.height is 900px, when the container is scrolled to or past the 720px, it will fire the scrolled event.
infiniteScrollUpDistancenumberoptional1.5should get a number
infiniteScrollThrottlenumberoptional150should get a number of milliseconds for throttle. The event will be triggered this many milliseconds after the user stops scrolling.
scrollWindowbooleanoptionaltruelistens to the window scroll instead of the actual element scroll. this allows to invoke a callback function in the scope of the element while listenning to the window scroll.
immediateCheckbooleanoptionalfalseinvokes the handler immediately to check if a scroll event has been already triggred when the page has been loaded (i.e. - when you refresh a page that has been scrolled)
infiniteScrollDisabledbooleanoptionalfalsedoesn't invoke the handler if set to true
horizontalbooleanoptionalfalsesets the scroll to listen for horizontal events
alwaysCallbackbooleanoptionalfalseinstructs the scroller to always trigger events
infiniteScrollContainerstring / HTMLElementoptionalnullshould get a html element or css selector for a scrollable element; window or current element will be used if this attribute is empty.
fromRootbooleanoptionalfalseif infiniteScrollContainer is set, this instructs the scroller to query the container selector from the root of the document object.

Events

@Output()TypeEvent TypeRequiredDescription
scrolledEventEmitterIInfiniteScrollEventoptionalthis will callback if the distance threshold has been reached on a scroll down.
scrolledUpEventEmitterIInfiniteScrollEventoptionalthis will callback if the distance threshold has been reached on a scroll up.

Behavior

By default, the directive listens to the window scroll event and invoked the callback.
To trigger the callback when the actual element is scrolled, these settings should be configured:

  • [scrollWindow]="false"
  • set an explict css "height" value to the element

DEMO

Try the Demo in StackBlitz

Usage

In this example, the onScroll callback will be invoked when the window is scrolled down:

import { Component } from '@angular/core';
import { InfiniteScrollDirective } from 'ngx-infinite-scroll';

@Component({
  selector: 'app',
  template: `
    <div
      class="search-results"
      infiniteScroll
      [infiniteScrollDistance]="2"
      [infiniteScrollThrottle]="50"
      (scrolled)="onScroll()"
    ></div>
  `,
  imports: [InfiniteScrollDirective]
})
export class AppComponent {
  onScroll() {
    console.log('scrolled!!');
  }
}

in this example, whenever the "search-results" is scrolled, the callback will be invoked:

import { Component } from '@angular/core';
import { InfiniteScrollDirective } from 'ngx-infinite-scroll';

@Component({
  selector: 'app',
  styles: [
    `
      .search-results {
        height: 20rem;
        overflow: scroll;
      }
    `,
  ],
  template: `
    <div
      class="search-results"
      infiniteScroll
      [infiniteScrollDistance]="2"
      [infiniteScrollThrottle]="50"
      (scrolled)="onScroll()"
      [scrollWindow]="false"
    ></div>
  `,
  imports: [InfiniteScrollDirective]
})
export class AppComponent {
  onScroll() {
    console.log('scrolled!!');
  }
}

In this example, the onScrollDown callback will be invoked when the window is scrolled down and the onScrollUp callback will be invoked when the window is scrolled up:

import { Component } from '@angular/core';
import { InfiniteScroll } from 'ngx-infinite-scroll';

@Component({
  selector: 'app',
  directives: [InfiniteScroll],
  template: `
    <div
      class="search-results"
      infiniteScroll
      [infiniteScrollDistance]="2"
      [infiniteScrollUpDistance]="1.5"
      [infiniteScrollThrottle]="50"
      (scrolled)="onScrollDown()"
      (scrolledUp)="onScrollUp()"
    ></div>
  `,
})
export class AppComponent {
  onScrollDown() {
    console.log('scrolled down!!');
  }

  onScrollUp() {
    console.log('scrolled up!!');
  }
}

In this example, the infiniteScrollContainer attribute is used to point directive to the scrollable container using a css selector. fromRoot is used to determine whether the scroll container has to be searched within the whole document ([fromRoot]="true") or just inside the infiniteScroll directive ([fromRoot]="false", default option).

import { Component } from '@angular/core';
import { InfiniteScrollDirective } from 'ngx-infinite-scroll';

@Component({
  selector: 'app',
  styles: [
    `
      .main-panel {
        height: 100px;
        overflow-y: scroll;
      }
    `,
  ],
  template: `
    <div class="main-panel">
      <div
        infiniteScroll
        [infiniteScrollDistance]="2"
        [infiniteScrollThrottle]="50"
        [infiniteScrollContainer]="selector"
        [fromRoot]="true"
        (scrolled)="onScroll()"
      ></div>
    </div>
  `,
  imports: [InfiniteScrollDirective]
})
export class AppComponent {
  selector: string = '.main-panel';

  onScroll() {
    console.log('scrolled!!');
  }
}

It is also possible to use infiniteScrollContainer without additional variable by using single quotes inside double quotes:

[infiniteScrollContainer]="'.main-panel'"

Showcase Examples

Contributors

This project exists thanks to all the people who contribute. [Contribute].

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors