Props accepted by VirtualList

interface VirtualListProps {
    children: VirtualListItem;
    className?: string;
    height: number;
    innerClassName?: string;
    innerComponent?: VirtualInnerComponent;
    itemCount: number;
    itemData?: unknown;
    itemKey?: ((index: number, data: unknown) => Key);
    itemOffsetMapping: ItemOffsetMapping;
    layout?: ScrollLayout;
    maxCssSize?: number;
    minNumPages?: number;
    onScroll?: ((offset: number, newScrollState: ScrollState) => void);
    outerComponent?: VirtualOuterComponent;
    useIsScrolling?: boolean;
    width: number;
}

Hierarchy (view full)

Properties

children: VirtualListItem

Component used as a template to render items in the list. Must implement VirtualListItem interface.

className?: string

The className applied to the outer container element. Use when styling the entire component.

height: number

Component height

innerClassName?: string

The className applied to the inner container element. Use for special cases when styling only the inner container and items.

innerComponent?: VirtualInnerComponent

Component implementing VirtualInnerComponent. Used to customize VirtualList.

itemCount: number

Number of items in the list

itemData?: unknown

Passed as VirtualBaseItemProps.data to each child item

itemKey?: ((index: number, data: unknown) => Key)

Function that defines the key to use for each item given item index and value of VirtualBaseProps.itemData.

(index, _data) => index

itemOffsetMapping: ItemOffsetMapping

Implementation of ItemOffsetMapping interface that defines size and offset to each item in the list

Use useFixedSizeItemOffsetMapping or useVariableSizeItemOffsetMapping to create implementations for common cases.

layout?: ScrollLayout

Choice of 'vertical' or 'horizontal' layouts

'vertical'
maxCssSize?: number

Maximum size for CSS element beyond which layout breaks. You should never normally need to change this. The default value is compatible with all major browsers.

6000000
minNumPages?: number

The minimum number of virtual pages to use when inner container would otherwise be more than VirtualBaseProps.maxCssSize big. You should never normally need to change this.

100
onScroll?: ((offset: number, newScrollState: ScrollState) => void)

Callback after a scroll event has been processed and state updated but before rendering

Type declaration

    • (offset, newScrollState): void
    • Parameters

      Returns void

outerComponent?: VirtualOuterComponent

Component implementing VirtualOuterComponent. Used to customize VirtualList.

useIsScrolling?: boolean

Determines whether the component should track whether it's being actively scrolled and pass to child items as VirtualBaseItemProps.isScrolling.

false
width: number

Component width