Skip to main content

Interface: VirtuosoMessageListMethods<Data, Context>

The imperative API of the message list component. You can access it with a ref, or by using the useVirtuosoMethods() hook from a child component.

Type parameters

NameTypeDescription
DataanyThe type of the data items in the list. Specifying this type gives you correct typing in the data methods.
ContextanyThe type of the context passed to the list. Specifying this type gives you correct typing in the data methods.

Properties

data

data: DataMethods<Data, Context>

A set of methods to manipulate the data in the list.


scrollToItem

scrollToItem: (location: ItemLocation) => void

Scrolls the list to the specified item. See ItemLocation for possible location details. Passing a number scrolls to the item at the specified index aligned to the top.

Type declaration

▸ (location): void

Parameters
NameType
locationItemLocation
Returns

void


scrollIntoView

scrollIntoView: (location: ItemLocation) => void

Scrolls the specified item into view if necessary. See ItemLocation for possible location details. Passing a number scrolls to the item at the specified index.

Type declaration

▸ (location): void

Parameters
NameType
locationItemLocation
Returns

void


scrollerElement

scrollerElement: () => HTMLDivElement

Lets you obtain a reference to the component's scroller DOM element.

Type declaration

▸ (): HTMLDivElement

Returns

HTMLDivElement


getScrollLocation

getScrollLocation: () => ListScrollLocation

Retrieves the current scroll location

Type declaration

▸ (): ListScrollLocation

Returns

ListScrollLocation


cancelSmoothScroll

cancelSmoothScroll: () => void

Cancels the current smooth scroll operation, if any.

Type declaration

▸ (): void

Returns

void


height

height: (item: Data) => number

Gets the known height of the item.

Type declaration

▸ (item): number

Parameters
NameType
itemData
Returns

number