Stack Elements
Stacks are containers that group multiple elements together in a horizontal or vertical layout.
They act like a flexible canvas within your page, allowing you to precisely position and arrange elements to keep them from overlapping or drifting apart as the screen resizes.
How to create a Stack
Steps:
Click an element that you want to be in the Stack.
Hold down the Shift key and select the other elements to stack them together.
Once you use a stack, nested elements will be set to auto-space between.
You can't apply constraints to any elements within the stack. However, you can still apply constraints to the stack itself.
To detach an element from a stack, simply select it and drag it out.
To add a new element to a stack, drag it over the stack until you see the blue indicator and drop it.
How to manage a Stack
Steps:
Select the Stack you want to edit
In the Inspector panel, make relevant changes to the settings.
Besides other common settings (colors, backgrounds, effects, etc.), settings specialized for Stack are included in the Design tab > Auto layout.
Direction: Set the way the stack will flow:
Distribute: Set the alignment of the element when stacked horizontally.
Align: Set the alignment of the element when stacked vertically.
Gap: Change the gap (margin) between the rows and columns within the stack.
If the stack direction is set to vertical or horizontal, you'll be able to set the gap between elements vertically (row gap) or horizontally (column gap), respectively.
When you select a stack in the editor, the margins between the elements are indicated by the pink strips. Move elements further apart or closer together by dragging these handles to adjust the spacing of all the elements at once.
Pro tip: The margins (pink strips) between the elements included in a stack are equally set. If you want to make an element that is further apart from others, you can set more spacing to that element specifically.
Padding: Padding controls the empty or white space between the boundary of a stack and the elements within it. You can adjust padding uniformly for all sides, or fine-tune it individually for top, right, bottom, or left.
Last updated