Props of WindowVirtualizer.
children:
ReactNode
| (index
) =>ReactElement
<any
, string | JSXElementConstructor<any>>
Elements rendered by this component.
You can also pass a function and set WindowVirtualizerProps.count to create elements lazily.
src/react/WindowVirtualizer.tsx:63
optional
count:number
If you set a function to WindowVirtualizerProps.children, you have to set total number of items to this prop.
src/react/WindowVirtualizer.tsx:67
optional
overscan:number
Number of items to render above/below the visible bounds of the list. Lower value will give better performance but you can increase to avoid showing blank items in fast scrolling.
4
src/react/WindowVirtualizer.tsx:72
optional
itemSize:number
Item size hint for unmeasured items. It will help to reduce scroll jump when items are measured if used properly.
- If not set, initial item sizes will be automatically estimated from measured sizes. This is recommended for most cases.
- If set, you can opt out estimation and use the value as initial item size.
src/react/WindowVirtualizer.tsx:79
optional
shift:boolean
While true is set, scroll position will be maintained from the end not usual start when items are added to/removed from start. It's recommended to set false if you add to/remove from mid/end of the list because it can cause unexpected behavior. This prop is useful for reverse infinite scrolling.
src/react/WindowVirtualizer.tsx:83
optional
horizontal:boolean
If true, rendered as a horizontally scrollable list. Otherwise rendered as a vertically scrollable list.
src/react/WindowVirtualizer.tsx:87
optional
cache:CacheSnapshot
You can restore cache by passing a CacheSnapshot on mount. This is useful when you want to restore scroll position after navigation. The snapshot can be obtained from WindowVirtualizerHandle.cache.
The length of items should be the same as when you take the snapshot, otherwise restoration may not work as expected.
src/react/WindowVirtualizer.tsx:93
optional
ssrCount:number
A prop for SSR. If set, the specified amount of items will be mounted in the initial rendering regardless of the container size until hydrated.
src/react/WindowVirtualizer.tsx:97
optional
as:CustomContainerComponent
| keyof IntrinsicElements
Component or element type for container element.
"div"
src/react/WindowVirtualizer.tsx:102
optional
item:CustomItemComponent
| keyof IntrinsicElements
Component or element type for item element. This component will get CustomItemComponentProps as props.
"div"
src/react/WindowVirtualizer.tsx:107
optional
onScroll: () =>void
Callback invoked whenever scroll offset changes.
void
src/react/WindowVirtualizer.tsx:111
optional
onScrollEnd: () =>void
Callback invoked when scrolling stops.
void