API Reference

Inputs

InputTypeDefaultDescription
itemsunknown[][]Array of data items to render
bufferSizenumber3Number of extra rows to render above and below the viewport
loadMoreThresholdnumber0.8Scroll ratio (0-1) at which the loadMore event fires
scrollParentHTMLElement | nullnullCustom scroll container. Uses window if null

Outputs

OutputTypeDescription
loadMorevoidEmits when the scroll position crosses the loadMoreThreshold. Resets when the items array length changes.

Methods

MethodDescription
scrollToIndex(index: number)Scroll to bring the item at the given index into view
scrollToOffset(px: number)Scroll to an absolute pixel offset within the grid
refresh()Re-measure dimensions and recalculate layout

Template Context

The ngxVirtualGridItem template receives the following context:

VariableTypeDescription
$implicitTThe data item
indexnumberThe item's index in the original array

Zoneless Apps

The library works with both zoned and zoneless Angular apps. In zoneless mode, the loadMore output emits from a raw scroll event listener. If your handler modifies component state, use signals so the view updates:

items = signal<Item[]>([]);

onLoadMore(): void {
  this.items.update(current => [...current, ...newItems]);
}