Open History to see the last commit
1---
2title: VirtualItem
3---
4β
5The `VirtualItem` object represents a single item returned by the virtualizer. It contains information you need to render the item in the coordinate space within your virtualizer's scrollElement and other helpful properties/functions.
6β
7```tsx
8export interface VirtualItem {
9 key: string | number | bigint
10 index: number
11 start: number
12 end: number
13 size: number
14}
15```
16β
17The following properties and methods are available on each VirtualItem object:
18β
19### `key`
20β
21```tsx
22key: string | number | bigint
23```
24β
25The unique key for the item. By default this is the item index, but should be configured via the `getItemKey` Virtualizer option.
26β
27### `index`
28β
29```tsx
30index: number
31```
32β
33The index of the item.
34β
35### `start`
36β
37```tsx
38start: number
39```
40β
41The starting pixel offset for the item. This is usually mapped to a css property or transform like `top/left` or `translateX/translateY`.
42β
43### `end`
44β
45```tsx
46end: number
47```
48β
49The ending pixel offset for the item. This value is not necessary for most layouts, but can be helpful so we've provided it anyway.
50β
51### `size`
52β
53```tsx
54size: number
55```
56β
57The size of the item. This is usually mapped to a css property like `width/height`. Before an item is measured with the `VirtualItem.measureElement` method, this will be the estimated size returned from your `estimateSize` virtualizer option. After an item is measured (if you choose to measure it at all), this value will be the number returned by your `measureElement` virtualizer option (which by default is configured to measure elements with `getBoundingClientRect()`).
58β
59### `lane`
60β
61```tsx
62lane: number
63```
64β
65The lane index of the item. In regular lists it will always be set to `0` but becomes useful for masonry layouts (see variable examples for more details).