Quick answer: flex-wrap: wrap in USS. Children flow to next row when first fills.
Inventory grid in UI Toolkit. Items just keep extending right and clip. Default flex-wrap is nowrap.
The Fix
/* USS */
.inventory-row {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
align-content: flex-start;
}
.inventory-cell {
width: 64px;
height: 64px;
margin: 4px;
}
Wrap is the trigger; cell width must be fixed (or have grow=0) so the layout knows when to break to next row.
Verifying
Resize the parent narrow: cells reflow to multiple rows. Resize wide: collapses to single row.
“flex-wrap wrap. Cells flow.”
Related Issues
For UXML binding, see binding. For Canvas Scaler, see Canvas Scaler.
Wrap on. Cells reflow.