Table Virtuoso API Reference

All properties are optional - by default, the component will render empty.

If you are using TypeScript and want to use correctly typed component ref, you can use the VirtuosoHandle.

import { TableVirtuoso, VirtuosoHandle } from 'react-virtuoso'
const ref = useRef<VirtuosoHandle>(null)
<TableVirtuoso ref={ref} /*...*/ />

Table Virtuoso Properties


Type parameters



  • {}




Optional alignToBottom: boolean

Defined in component-interfaces/TableVirtuoso.ts:191

Setting alignToBottom to true aligns the items to the bottom of the list if the list is shorter than the viewport. Use followOutput property to keep the list aligned when new items are appended.


Optional atBottomStateChange: (atBottom: boolean) => void

Defined in component-interfaces/TableVirtuoso.ts:170

Called with true / false when the list has reached the bottom / gets scrolled up. Can be used to load newer items, like tail -f.


Optional atBottomThreshold: number

Defined in component-interfaces/TableVirtuoso.ts:216

By default 4. Redefine to change how much away from the bottom the scroller can be before the list is not considered not at bottom.


Optional atTopStateChange: (atTop: boolean) => void

Defined in component-interfaces/TableVirtuoso.ts:175

Called with true / false when the list has reached the top / gets scrolled down.


Optional atTopThreshold: number

Defined in component-interfaces/TableVirtuoso.ts:211

By default 0. Redefine to change how much away from the top the scroller can be before the list is not considered not at top.


Optional components: TableComponents<D, C>

Defined in component-interfaces/TableVirtuoso.ts:21

Use the components property for advanced customization of the elements rendered by the table.


Optional computeItemKey: ComputeItemKey<D, C>

Defined in component-interfaces/TableVirtuoso.ts:84

If specified, the component will use the function to generate the key property for each list item.


Optional customScrollParent: HTMLElement

Defined in component-interfaces/TableVirtuoso.ts:201

Pass a reference to a scrollable parent element, so that the table won't wrap in its own.


Optional data: readonly D[]

Defined in component-interfaces/TableVirtuoso.ts:41

The data items to be rendered. If data is set, the total count will be inferred from the length of the array.


Optional defaultItemHeight: number

Defined in component-interfaces/TableVirtuoso.ts:95

By default, the component assumes the default item height from the first rendered item (rendering it as a "probe").

If the first item turns out to be an outlier (very short or tall), the rest of the rendering will be slower, as multiple passes of rendering should happen for the list to fill the viewport.

Setting defaultItemHeight causes the component to skip the "probe" rendering and use the property value as default height instead.


Optional endReached: (index: number) => void

Defined in component-interfaces/TableVirtuoso.ts:154

Gets called when the user scrolls to the end of the list. Receives the last item index as an argument. Can be used to implement endless scrolling.


Optional firstItemIndex: number

Defined in component-interfaces/TableVirtuoso.ts:143

Use when implementing inverse infinite scrolling - decrease the value this property in combination with data or totalCount to prepend items to the top of the list.

Warning: the firstItemIndex should be a positive number, based on the total amount of items to be displayed.


Optional fixedFooterContent: FixedFooterContent

Defined in component-interfaces/TableVirtuoso.ts:31

Set the contents of the table footer.


Optional fixedHeaderContent: FixedHeaderContent

Defined in component-interfaces/TableVirtuoso.ts:26

Set the contents of the table header.


Optional fixedItemHeight: number

Defined in component-interfaces/TableVirtuoso.ts:108

Can be used to improve performance if the rendered items are of known size. Setting it causes the component to skip item measurements.


Optional followOutput: FollowOutput

Defined in component-interfaces/TableVirtuoso.ts:135

If set to true, the list automatically scrolls to bottom if the total count is changed. Set to "smooth" for an animated scrolling.

By default, followOutput scrolls down only if the list is already at the bottom. To implement an arbitrary logic behind that, pass a function:

 followOutput={(isAtBottom: boolean) => {
   if (expression) {
     return 'smooth' // can be 'auto' or false to avoid scrolling
   } else {
     return false
 }} />


Optional increaseViewportBy: number | { bottom: number ; top: number }

Defined in component-interfaces/TableVirtuoso.ts:56

Set the increaseViewportBy property to artificially increase the viewport size, causing items to be rendered before outside of the viewport. The property causes the component to render more items than the necessary, but can help with slow loading content. Using { top?: number, bottom?: number } lets you set the increase for each end separately.


Optional initialItemCount: number

Defined in component-interfaces/TableVirtuoso.ts:74

Use for server-side rendering - if set, the list will render the specified amount of items regardless of the container / item size.


Optional initialScrollTop: number

Defined in component-interfaces/TableVirtuoso.ts:68

Set this value to offset the initial location of the list. Warning: using this property will still run a render cycle at the scrollTop: 0 list window. If possible, avoid using it and stick to initialTopMostItemIndex instead.


Optional initialTopMostItemIndex: number

Defined in component-interfaces/TableVirtuoso.ts:61

Set to a value between 0 and totalCount - 1 to make the list start scrolled to that item.


Optional isScrolling: (isScrolling: boolean) => void

Defined in component-interfaces/TableVirtuoso.ts:148

Called when the list starts/stops scrolling.


Optional itemContent: ItemContent<D, C>

Defined in component-interfaces/TableVirtuoso.ts:79

Set the callback to specify the contents of the item.


Optional itemSize: SizeFunction

Defined in component-interfaces/TableVirtuoso.ts:102

Allows customizing the height/width calculation of Item elements.

The default implementation reads el.getBoundingClientRect().height and el.getBoundingClientRect().width.


Optional itemsRendered: (items: ListItem<D>[]) => void

Defined in component-interfaces/TableVirtuoso.ts:185

Called with the new set of items each time the list items are rendered due to scrolling.


Optional overscan: number | { main: number ; reverse: number }

Defined in component-interfaces/TableVirtuoso.ts:49

Set the overscan property to make the component "chunk" the rendering of new items on scroll. The property causes the component to render more items than the necessary, but reduces the re-renders on scroll. Setting { main: number, reverse: number } lets you extend the list in both the main and the reverse scrollable directions. See the increaseViewportBy property for a similar behavior (equivalent to the overscan in react-window).


Optional rangeChanged: (range: ListRange) => void

Defined in component-interfaces/TableVirtuoso.ts:164

Called with the new set of items each time the list items are rendered due to scrolling.


Optional scrollSeekConfiguration: ScrollSeekConfiguration | false

Defined in component-interfaces/TableVirtuoso.ts:115

Use to display placeholders if the user scrolls fast through the list.

Set components.ScrollSeekPlaceholder to change the placeholder content.


Optional scrollerRef: (ref: HTMLElement | Window | null) => any

Defined in component-interfaces/TableVirtuoso.ts:206

Provides access to the root DOM element


Optional startReached: (index: number) => void

Defined in component-interfaces/TableVirtuoso.ts:159

Called when the user scrolls to the start of the list.


Optional totalCount: number

Defined in component-interfaces/TableVirtuoso.ts:36

The total amount of items to be rendered.


Optional totalListHeightChanged: (height: number) => void

Defined in component-interfaces/TableVirtuoso.ts:180

Called when the total list height is changed due to new items or viewport resize.


Optional useWindowScroll: boolean

Defined in component-interfaces/TableVirtuoso.ts:196

Uses the document scroller rather than wrapping the list in its own.




  • VirtuosoHandle



autoscrollToBottom(): void

Defined in component-interfaces/Virtuoso.ts:286

Use this with combination with follow output if you have images loading in the list. Listen to the image loading and call the method.

Returns: void


scrollBy(location: ScrollToOptions): void

Defined in component-interfaces/Virtuoso.ts:282

Scrolls the component with the specified amount. See ScrollToOptions (MDN)



Returns: void


scrollIntoView(location: FlatScrollIntoViewLocation): void

Defined in component-interfaces/Virtuoso.ts:274

Scrolls the item into view if necessary. See the website example for an implementation.



Returns: void


scrollTo(location: ScrollToOptions): void

Defined in component-interfaces/Virtuoso.ts:278

Scrolls the component to the specified location. See ScrollToOptions (MDN)



Returns: void


scrollToIndex(location: number | FlatIndexLocationWithAlign): void

Defined in component-interfaces/Virtuoso.ts:270

Scrolls the component to the specified item index. See IndexLocationWithAlign for more options.


locationnumber | FlatIndexLocationWithAlign

Returns: void