You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/virtual-item.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,4 +62,5 @@ The size of the item. This is usually mapped to a css property like `width/heigh
62
62
lane: number
63
63
```
64
64
65
-
The 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).
65
+
The lane index of the item. Items are assigned to the shortest lane. Lane assignments are cached immediately based on the size estimated by `estimateSize` by default; set `laneAssignmentMode: 'measured'` to base assignments on measured sizes instead.
66
+
In regular lists it will always be set to `0` but becomes useful for masonry layouts (see variable examples for more details).
Copy file name to clipboardExpand all lines: docs/api/virtualizer.md
+14-1Lines changed: 14 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -230,7 +230,20 @@ This option allows you to set the spacing between items in the virtualized list.
230
230
lanes: number
231
231
```
232
232
233
-
The number of lanes the list is divided into (aka columns for vertical lists and rows for horizontal lists).
233
+
The number of lanes the list is divided into (aka columns for vertical lists and rows for horizontal lists). Items are assigned to the lane with the shortest total size. By default, lane assignments are cached immediately based on `estimateSize` to prevent items from jumping between lanes (see `laneAssignmentMode` below to change this behavior).
234
+
235
+
### `laneAssignmentMode`
236
+
237
+
```tsx
238
+
laneAssignmentMode?:'estimate'|'measured'
239
+
```
240
+
241
+
**Default**: `'estimate'`
242
+
243
+
Controls when lane assignments are cached in a masonry layout.
244
+
245
+
-`'estimate'` (default): lane assignments are cached immediately based on `estimateSize`. This keeps items from jumping between lanes, but assignments may be suboptimal when the estimate is inaccurate.
246
+
-`'measured'`: lane caching is deferred until items are measured via `measureElement`, so assignments reflect actual measured sizes. After the initial measurement, lanes are cached and remain stable.
0 commit comments