Skip to content

feat: Added virtual scroll component and sample implementation - #17281

Draft
rkaraivanov wants to merge 17 commits into
masterfrom
rkaraivanov/virtual-scroll-component
Draft

feat: Added virtual scroll component and sample implementation#17281
rkaraivanov wants to merge 17 commits into
masterfrom
rkaraivanov/virtual-scroll-component

Conversation

@rkaraivanov

Copy link
Copy Markdown
Member

Description

Expose a new virtual scroll component for horizontal/vertical scrolling.

Motivation / Context

  1. Self-contained viewport — The component is the scrollable element. igxForOf requires the developer to manually wire a separate scroll container, a VirtualHelperComponent/HVirtualHelperComponent DOM helper element, and pass igxForContainerSize explicitly. That's 3–4 pieces of setup vs. one tag.
  2. Signals-first reactive model.
  3. View pooling — Active views are kept in a pool and detached/reattached instead of destroyed/recreated on every scroll. igxForOf uses ViewContainerRef.move() but always keeps a fixed chunk alive, paying create/destroy cost when chunk size changes.
  4. Clean ChangeDetectionStrategy.OnPush throughout the implementation.
  5. Better DX for remote/infinite scrolling.
  6. No auxiliary helper components in the DOM.
  7. Typed template context.

Type of Change (check all that apply):

  • Bug fix
  • New functionality
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (no functional changes)
  • Documentation
  • Demos
  • CI/CD
  • Tests
  • Changelog
  • Skills/Agents

Component(s) / Area(s) Affected:

How Has This Been Tested?

  • Unit tests
  • Manual testing
  • Automated e2e tests

Test Configuration:

  • Angular version:
  • Browser(s):
  • OS:

Screenshots / Recordings

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them
  • Accessibility (ARIA, keyboard navigation, focus management) has been verified

Copilot AI review requested due to automatic review settings July 28, 2026 14:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new IgxVirtualScrollComponent entry point to Ignite UI for Angular, providing a self-contained virtualized viewport for vertical and horizontal scrolling (including variable-size items and remote/infinite loading), and adds a demo route + sample showcasing usage.

Changes:

  • Added a new igniteui-angular/virtual-scroll entry point with a virtual scroll component, item-template directive, supporting types, and a scroll-math engine.
  • Added unit tests covering the engine behavior, template context, orientations (including RTL), outputs, and basic rendering.
  • Added a demo/sample implementation and wired it into the demo app routing + navigation list.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/app/virtual-scroll/virtual-scroll.sample.ts Demo component showcasing vertical/horizontal + remote data scenarios.
src/app/virtual-scroll/virtual-scroll.sample.html Sample template demonstrating igxVirtualItem usage for multiple scenarios.
src/app/virtual-scroll/virtual-scroll.sample.scss Styling for the new demo page.
src/app/app.routes.ts Adds a /virtual-scroll route for the demo.
src/app/app.component.ts Adds “Virtual Scroll” to the demo navigation list.
projects/igniteui-angular/virtual-scroll/src/virtual-scroll/virtual-scroll.component.ts Core virtual scroll component implementation (signals-first + view pooling).
projects/igniteui-angular/virtual-scroll/src/virtual-scroll/virtual-scroll.component.html Component template for track/content positioning.
projects/igniteui-angular/virtual-scroll/src/virtual-scroll/virtual-scroll.component.scss Component styles for vertical/horizontal layouts.
projects/igniteui-angular/virtual-scroll/src/virtual-scroll/virtual-scroll-item.directive.ts Directive to capture ng-template[igxVirtualItem] as the item template.
projects/igniteui-angular/virtual-scroll/src/virtual-scroll/types.ts Typed template context + output payload types.
projects/igniteui-angular/virtual-scroll/src/virtual-scroll/scroll-engine.ts Scroll math engine (BIT-based sizing, visible range computation, coordinate compression).
projects/igniteui-angular/virtual-scroll/src/virtual-scroll/virtual-scroll.component.spec.ts Unit tests for engine + component behaviors (including RTL).
projects/igniteui-angular/virtual-scroll/src/public_api.ts Public exports for the new entry point.
projects/igniteui-angular/virtual-scroll/index.ts Entry-point barrel export.
projects/igniteui-angular/virtual-scroll/ng-package.json ng-packagr entry point config placeholder (consistent with other entry points).
projects/igniteui-angular/virtual-scroll/README.md Feature documentation and usage examples for the new component.
projects/igniteui-angular/src/public_api.ts Exposes igniteui-angular/virtual-scroll from the root package exports.
Comments suppressed due to low confidence (1)

src/app/virtual-scroll/virtual-scroll.sample.html:107

  • Section numbering in the sample comments labels this as section 6 even though it is the 5th sample block. Renumber to keep the sample easier to follow.
    <!-- 6. Remote / infinite scrolling                                      -->
    <!-- ------------------------------------------------------------------ -->

Comment on lines +1 to +6
<div
class="igx-vs__track"
[style.height.px]="_isVertical() ? _spaceSize() : null"
[style.width.px]="!_isVertical() ? _spaceSize() : null"
aria-hidden="true"
>
imports: [IgxVirtualScrollComponent, IgxVirtualItemDirective],
})
export class VirtualScrollSampleComponent {
protected readonly verticalItems = signal<VsSampleItem[]>(makeItems(0, 1_000_000));
Comment on lines +83 to +84
<!-- 5. Horizontal - fixed column widths -->
<!-- ------------------------------------------------------------------ -->
@@ -0,0 +1,3 @@
export { IgxVirtualScrollComponent} from './virtual-scroll/virtual-scroll.component';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants