Responsive gui positioning

How can I make it so the bottom frame’s position is dependent on how many objects are in the frame above? The frame above has a GridLayout.