Provide a way to make GuiObjects expand to fill unused space in a layout

Currently it is impossible to make a GuiObject expand to fill unused space using just instances.
This is a frequent issue I run into when trying to design UIs without supporting code. The only way to do this currently is via script, using code roughly like so:

-- Filling unused vertical space.
local UsedSpaceY = FrameA.AbsoluteSize.Y + PaddingY
FrameB.Size = UDim2.new(1, 0, 1, -UsedSpaceY)

Diagram of desired behavior:

You can observe that the aspect ratio of FrameB can vary arbitrarily relative to FrameA, which contributes to preventing solutions that use existing features.

Note that I am talking about the situation where the container (the white box) has a specific size. This is different from the situation where the container can be any size, as in that scenario you can use AutomaticSize cleverly to achieve the desired behavior (though a solution to the problem described in this topic could potentially make that AutomaticSize solution more ergonomic).

Ideally this solution should be able to support having more than one GuiObject trying to expand to fill the same area of space. (Android does this by distributing space to objects proportionally to their “layout weight” attributes.)

14 Likes