Skip to content

Grid, masonry, and spatial layouts

Choose the layout that matches the structure already present in the surface. Every code tab follows the Usage environment selected in the top navigation.

Track grid

Use a track grid when rows and columns are both independently large. This example contains 300 rows × 300 columns, or 90,000 cells with equal axis counts. Scrolling in either direction keeps only the cells inside the viewport and overscan in the DOM.

Overscan120 px
R7 · C1
R7 · C2
R7 · C3
R7 · C4
R7 · C5
R7 · C6
R7 · C7
R7 · C8
R7 · C9
R7 · C10
R7 · C11
R7 · C12
R7 · C13
R7 · C14
R8 · C1
R8 · C2
R8 · C3
R8 · C4
R8 · C5
R8 · C6
R8 · C7
R8 · C8
R8 · C9
R8 · C10
R8 · C11
R8 · C12
R8 · C13
R8 · C14
R9 · C1
R9 · C2
R9 · C3
R9 · C4
R9 · C5
R9 · C6
R9 · C7
R9 · C8
R9 · C9
R9 · C10
R9 · C11
R9 · C12
R9 · C13
R9 · C14
R10 · C1
R10 · C2
R10 · C3
R10 · C4
R10 · C5
R10 · C6
R10 · C7
R10 · C8
R10 · C9
R10 · C10
R10 · C11
R10 · C12
R10 · C13
R10 · C14
R11 · C1
R11 · C2
R11 · C3
R11 · C4
R11 · C5
R11 · C6
R11 · C7
R11 · C8
R11 · C9
R11 · C10
R11 · C11
R11 · C12
R11 · C13
R11 · C14
R12 · C1
R12 · C2
R12 · C3
R12 · C4
R12 · C5
R12 · C6
R12 · C7
R12 · C8
R12 · C9
R12 · C10
R12 · C11
R12 · C12
R12 · C13
R12 · C14
R13 · C1
R13 · C2
R13 · C3
R13 · C4
R13 · C5
R13 · C6
R13 · C7
R13 · C8
R13 · C9
R13 · C10
R13 · C11
R13 · C12
R13 · C13
R13 · C14
R14 · C1
R14 · C2
R14 · C3
R14 · C4
R14 · C5
R14 · C6
R14 · C7
R14 · C8
R14 · C9
R14 · C10
R14 · C11
R14 · C12
R14 · C13
R14 · C14
R15 · C1
R15 · C2
R15 · C3
R15 · C4
R15 · C5
R15 · C6
R15 · C7
R15 · C8
R15 · C9
R15 · C10
R15 · C11
R15 · C12
R15 · C13
R15 · C14
R16 · C1
R16 · C2
R16 · C3
R16 · C4
R16 · C5
R16 · C6
R16 · C7
R16 · C8
R16 · C9
R16 · C10
R16 · C11
R16 · C12
R16 · C13
R16 · C14
R17 · C1
R17 · C2
R17 · C3
R17 · C4
R17 · C5
R17 · C6
R17 · C7
R17 · C8
R17 · C9
R17 · C10
R17 · C11
R17 · C12
R17 · C13
R17 · C14
R18 · C1
R18 · C2
R18 · C3
R18 · C4
R18 · C5
R18 · C6
R18 · C7
R18 · C8
R18 · C9
R18 · C10
R18 · C11
R18 · C12
R18 · C13
R18 · C14
R19 · C1
R19 · C2
R19 · C3
R19 · C4
R19 · C5
R19 · C6
R19 · C7
R19 · C8
R19 · C9
R19 · C10
R19 · C11
R19 · C12
R19 · C13
R19 · C14
R20 · C1
R20 · C2
R20 · C3
R20 · C4
R20 · C5
R20 · C6
R20 · C7
R20 · C8
R20 · C9
R20 · C10
R20 · C11
R20 · C12
R20 · C13
R20 · C14
R21 · C1
R21 · C2
R21 · C3
R21 · C4
R21 · C5
R21 · C6
R21 · C7
R21 · C8
R21 · C9
R21 · C10
R21 · C11
R21 · C12
R21 · C13
R21 · C14
R22 · C1
R22 · C2
R22 · C3
R22 · C4
R22 · C5
R22 · C6
R22 · C7
R22 · C8
R22 · C9
R22 · C10
R22 · C11
R22 · C12
R22 · C13
R22 · C14
R23 · C1
R23 · C2
R23 · C3
R23 · C4
R23 · C5
R23 · C6
R23 · C7
R23 · C8
R23 · C9
R23 · C10
R23 · C11
R23 · C12
R23 · C13
R23 · C14
R24 · C1
R24 · C2
R24 · C3
R24 · C4
R24 · C5
R24 · C6
R24 · C7
R24 · C8
R24 · C9
R24 · C10
R24 · C11
R24 · C12
R24 · C13
R24 · C14
R25 · C1
R25 · C2
R25 · C3
R25 · C4
R25 · C5
R25 · C6
R25 · C7
R25 · C8
R25 · C9
R25 · C10
R25 · C11
R25 · C12
R25 · C13
R25 · C14
R26 · C1
R26 · C2
R26 · C3
R26 · C4
R26 · C5
R26 · C6
R26 · C7
R26 · C8
R26 · C9
R26 · C10
R26 · C11
R26 · C12
R26 · C13
R26 · C14
R27 · C1
R27 · C2
R27 · C3
R27 · C4
R27 · C5
R27 · C6
R27 · C7
R27 · C8
R27 · C9
R27 · C10
R27 · C11
R27 · C12
R27 · C13
R27 · C14
R28 · C1
R28 · C2
R28 · C3
R28 · C4
R28 · C5
R28 · C6
R28 · C7
R28 · C8
R28 · C9
R28 · C10
R28 · C11
R28 · C12
R28 · C13
R28 · C14

A track grid manages row heights and column widths separately. Spanning regions can occupy multiple tracks in the same coordinate system. In Vue, connect trackGridLayoutStrategy to VirtualizerRoot.

For a product-card grid that only flows vertically and changes its column count with viewport width, VirtualGrid is the smaller API. minLaneSize derives its responsive column count.

Masonry

Masonry places variable-height cards across lanes while reducing empty space. This example measures the actual DOM height of 30,000 cards and creates only those around the viewport.

Overscan120 px
CARD 00009Refresh search index

Changes before the viewport preserve the item currently being read.

CARD 00010Review payment records

Measured content updates the position of every item that follows it.

CARD 00012Update access policy

Changes before the viewport preserve the item currently being read.

CARD 00013Refresh search index

Measured content updates the position of every item that follows it.

CARD 00014Review payment records

Content can wrap across lines without an application-owned height calculator.

CARD 00015Sync documents

Changes before the viewport preserve the item currently being read.

CARD 00016Update access policy

Measured content updates the position of every item that follows it.

CARD 00017Refresh search index

Content can wrap across lines without an application-owned height calculator.

CARD 00018Review payment records

Changes before the viewport preserve the item currently being read.

CARD 00019Sync documents

Measured content updates the position of every item that follows it.

CARD 00020Update access policy

Content can wrap across lines without an application-owned height calculator.

CARD 00021Refresh search index

Changes before the viewport preserve the item currently being read.

CARD 00022Review payment records

Measured content updates the position of every item that follows it.

CARD 00023Sync documents

Content can wrap across lines without an application-owned height calculator.

CARD 00024Update access policy

Changes before the viewport preserve the item currently being read.

CARD 00025Refresh search index

Measured content updates the position of every item that follows it.

CARD 00026Review payment records

Content can wrap across lines without an application-owned height calculator.

CARD 00027Sync documents

Changes before the viewport preserve the item currently being read.

CARD 00028Update access policy

Measured content updates the position of every item that follows it.

CARD 00029Refresh search index

Content can wrap across lines without an application-owned height calculator.

CARD 00030Review payment records

Changes before the viewport preserve the item currently being read.

CARD 00031Sync documents

Measured content updates the position of every item that follows it.

CARD 00032Update access policy

Content can wrap across lines without an application-owned height calculator.

CARD 00033Refresh search index

Changes before the viewport preserve the item currently being read.

CARD 00034Review payment records

Measured content updates the position of every item that follows it.

CARD 00035Sync documents

Content can wrap across lines without an application-owned height calculator.

CARD 00036Update access policy

Changes before the viewport preserve the item currently being read.

CARD 00037Refresh search index

Measured content updates the position of every item that follows it.

CARD 00038Review payment records

Content can wrap across lines without an application-owned height calculator.

CARD 00039Sync documents

Changes before the viewport preserve the item currently being read.

CARD 00040Update access policy

Measured content updates the position of every item that follows it.

CARD 00041Refresh search index

Content can wrap across lines without an application-owned height calculator.

CARD 00042Review payment records

Changes before the viewport preserve the item currently being read.

CARD 00043Sync documents

Measured content updates the position of every item that follows it.

CARD 00044Update access policy

Content can wrap across lines without an application-owned height calculator.

CARD 00045Refresh search index

Changes before the viewport preserve the item currently being read.

CARD 00046Review payment records

Measured content updates the position of every item that follows it.

CARD 00047Sync documents

Content can wrap across lines without an application-owned height calculator.

CARD 00048Update access policy

Changes before the viewport preserve the item currently being read.

CARD 00049Refresh search index

Measured content updates the position of every item that follows it.

CARD 00050Review payment records

Content can wrap across lines without an application-owned height calculator.

CARD 00051Sync documents

Changes before the viewport preserve the item currently being read.

CARD 00052Update access policy

Measured content updates the position of every item that follows it.

CARD 00053Refresh search index

Content can wrap across lines without an application-owned height calculator.

CARD 00054Review payment records

Changes before the viewport preserve the item currently being read.

CARD 00055Sync documents

Measured content updates the position of every item that follows it.

CARD 00056Update access policy

Content can wrap across lines without an application-owned height calculator.

CARD 00057Refresh search index

Changes before the viewport preserve the item currently being read.

CARD 00058Review payment records

Measured content updates the position of every item that follows it.

CARD 00059Sync documents

Content can wrap across lines without an application-owned height calculator.

CARD 00060Update access policy

Changes before the viewport preserve the item currently being read.

CARD 00061Refresh search index

Measured content updates the position of every item that follows it.

VirtualMasonry derives its lane count from viewport width and minLaneSize. Once a card is measured, only the affected tail of the layout is updated.

Spatial

Use spatial layout when a diagram or editor already owns each item's x-y coordinates and size. This example arranges 40,000 service nodes in irregular clusters. With no row-column rule or fixed node size, moving in either direction queries only nodes intersecting the viewport.

Overscan120 px
Review payment recordsSERVICE 00002 · Review
Sync documentsSERVICE 00003 · Complete
Refresh search indexSERVICE 00005 · Review
Review payment recordsSERVICE 00006 · Complete
Refresh search indexSERVICE 00009 · Complete
Sync documentsSERVICE 00011 · Review
Update access policySERVICE 00012 · Complete
Review payment recordsSERVICE 00014 · Review
Refresh search indexSERVICE 00017 · Review
Review payment recordsSERVICE 00018 · Complete
Update access policySERVICE 00020 · Review
Refresh search indexSERVICE 00021 · Complete
Sync documentsSERVICE 00023 · Review
Update access policySERVICE 00024 · Complete
Review payment recordsSERVICE 00026 · Review
Sync documentsSERVICE 00027 · Complete
Review payment recordsSERVICE 00030 · Complete
Update access policySERVICE 00032 · Review
Refresh search indexSERVICE 00033 · Complete
Sync documentsSERVICE 00035 · Review
Review payment recordsSERVICE 00038 · Review
Sync documentsSERVICE 00039 · Complete
Refresh search indexSERVICE 00041 · Review
Review payment recordsSERVICE 00042 · Complete
Update access policySERVICE 00044 · Review
Refresh search indexSERVICE 00045 · Complete
Sync documentsSERVICE 00047 · Review
Update access policySERVICE 00048 · Complete
Sync documentsSERVICE 00051 · Complete
Refresh search indexSERVICE 00053 · Review
Review payment recordsSERVICE 00054 · Complete
Update access policySERVICE 00056 · Review
Sync documentsSERVICE 00059 · Review
Update access policySERVICE 00060 · Complete
Review payment recordsSERVICE 00062 · Review
Sync documentsSERVICE 00063 · Complete
Refresh search indexSERVICE 00065 · Review
Review payment recordsSERVICE 00066 · Complete
Update access policySERVICE 00068 · Review
Refresh search indexSERVICE 00069 · Complete
Update access policySERVICE 00072 · Complete
Review payment recordsSERVICE 00074 · Review
Sync documentsSERVICE 00075 · Complete
Refresh search indexSERVICE 00077 · Review
Update access policySERVICE 00080 · Review
Refresh search indexSERVICE 00081 · Complete
Sync documentsSERVICE 00083 · Review
Update access policySERVICE 00084 · Complete
Review payment recordsSERVICE 00086 · Review
Sync documentsSERVICE 00087 · Complete
Refresh search indexSERVICE 00089 · Review
Review payment recordsSERVICE 00090 · Complete
Refresh search indexSERVICE 00093 · Complete
Sync documentsSERVICE 00095 · Review
Update access policySERVICE 00096 · Complete
Review payment recordsSERVICE 00098 · Review
Refresh search indexSERVICE 00101 · Review
Review payment recordsSERVICE 00102 · Complete
Update access policySERVICE 00104 · Review
Sync documentsSERVICE 00107 · Review
Update access policySERVICE 00108 · Complete
Review payment recordsSERVICE 00110 · Review
Sync documentsSERVICE 00111 · Complete
Review payment recordsSERVICE 00114 · Complete
Update access policySERVICE 00116 · Review
Refresh search indexSERVICE 00117 · Complete
Sync documentsSERVICE 00119 · Review
Review payment recordsSERVICE 00122 · Review
Sync documentsSERVICE 00123 · Complete
Refresh search indexSERVICE 00125 · Review
Update access policySERVICE 00128 · Review
Refresh search indexSERVICE 00129 · Complete
Sync documentsSERVICE 00131 · Review
Update access policySERVICE 00132 · Complete
Sync documentsSERVICE 00135 · Complete
Refresh search indexSERVICE 00137 · Review
Review payment recordsSERVICE 00138 · Complete
Update access policySERVICE 00140 · Review
Sync documentsSERVICE 00143 · Review
Update access policySERVICE 00144 · Complete
Review payment recordsSERVICE 00146 · Review
Refresh search indexSERVICE 00149 · Review
Review payment recordsSERVICE 00150 · Complete
Refresh search indexSERVICE 00153 · Complete
Update access policySERVICE 00156 · Complete
Review payment recordsSERVICE 00158 · Review
Sync documentsSERVICE 00159 · Complete
Refresh search indexSERVICE 00161 · Review
Sync documentsSERVICE 00167 · Review
Review payment recordsSERVICE 00170 · Review
Sync documentsSERVICE 00171 · Complete
Review payment recordsSERVICE 00174 · Complete
Sync documentsSERVICE 00179 · Review
Update access policySERVICE 00180 · Complete
Update access policySERVICE 00004 · Running
Sync documentsSERVICE 00007 · Running
Review payment recordsSERVICE 00010 · Running
Refresh search indexSERVICE 00013 · Running
Update access policySERVICE 00016 · Running
Sync documentsSERVICE 00019 · Running
Refresh search indexSERVICE 00025 · Running
Update access policySERVICE 00028 · Running
Sync documentsSERVICE 00031 · Running
Review payment recordsSERVICE 00034 · Running
Refresh search indexSERVICE 00037 · Running
Update access policySERVICE 00040 · Running
Review payment recordsSERVICE 00046 · Running
Refresh search indexSERVICE 00049 · Running
Update access policySERVICE 00052 · Running
Sync documentsSERVICE 00055 · Running
Review payment recordsSERVICE 00058 · Running
Refresh search indexSERVICE 00061 · Running
Sync documentsSERVICE 00067 · Running
Review payment recordsSERVICE 00070 · Running
Refresh search indexSERVICE 00073 · Running
Update access policySERVICE 00076 · Running
Sync documentsSERVICE 00079 · Running
Review payment recordsSERVICE 00082 · Running
Update access policySERVICE 00088 · Running
Sync documentsSERVICE 00091 · Running
Review payment recordsSERVICE 00094 · Running
Refresh search indexSERVICE 00097 · Running
Update access policySERVICE 00100 · Running
Sync documentsSERVICE 00103 · Running
Refresh search indexSERVICE 00109 · Running
Update access policySERVICE 00112 · Running
Sync documentsSERVICE 00115 · Running
Update access policySERVICE 00124 · Running
Review payment recordsSERVICE 00130 · Running
Refresh search indexSERVICE 00133 · Running
Update access policySERVICE 00136 · Running
Review payment recordsSERVICE 00142 · Running
Refresh search indexSERVICE 00145 · Running
Sync documentsSERVICE 00151 · Running
Review payment recordsSERVICE 00154 · Running
Refresh search indexSERVICE 00157 · Running
Sync documentsSERVICE 00163 · Running
Review payment recordsSERVICE 00166 · Running
Update access policySERVICE 00172 · Running
Sync documentsSERVICE 00175 · Running
Review payment recordsSERVICE 00178 · Running
Update access policySERVICE 00008 · Review
Sync documentsSERVICE 00015 · Complete
Review payment recordsSERVICE 00022 · Running
Refresh search indexSERVICE 00029 · Review
Update access policySERVICE 00036 · Complete
Sync documentsSERVICE 00043 · Running
Review payment recordsSERVICE 00050 · Review
Refresh search indexSERVICE 00057 · Complete
Update access policySERVICE 00064 · Running
Sync documentsSERVICE 00071 · Review
Review payment recordsSERVICE 00078 · Complete
Refresh search indexSERVICE 00085 · Running
Sync documentsSERVICE 00099 · Complete
Review payment recordsSERVICE 00106 · Running
Update access policySERVICE 00120 · Complete
Sync documentsSERVICE 00127 · Running
Refresh search indexSERVICE 00141 · Complete
Update access policySERVICE 00148 · Running
Review payment recordsSERVICE 00162 · Complete
Refresh search indexSERVICE 00169 · Running
Refresh search indexSERVICE 00001 · Running

Pass x, y, width, and height through getRect. Sectile keeps those coordinates and performs the viewport intersection query.

Choose by data shape

Structure already present in the dataLayout
Order and item sizeLinear
Independent rows and columnsTrack grid
Order and variable card heightsMasonry
Existing x-y rectanglesSpatial

Released under the MIT License.