Auto layout
This page shows you how to make a frame arrange its children for you, and how to size and pin them.
Example: a button with an icon and a label. With auto layout, the button grows when the label gets longer.
How to add auto layout
- Select a frame.
- In the panel, find Auto layout.
- Click Add auto layout (the + button). The frame becomes a column.
- To change this, pick Row, Column or Grid under Direction.
To remove it, click Remove auto layout.
How to set gap, padding and alignment
- Use the alignment pad to place the children.
- Set Gap to the space between children. Or click Space between or Space around.
- Set padding. One field is for top and bottom. One field is for left and right.
- To set each side alone, use Separate sides.
In a grid, you set Columns, Rows and Row gap.
Other settings are in Options: Stretch children, Text baselines, Wrap (not in a grid) and Include stroke. Turn on Wrap to let children flow onto more lines. Then a Line gap field shows.
How to size a layer
- Select a layer in an auto layout.
- In Position & appearance, click the Width or Height field.
- Choose one:
- Fixed: you type the size.
- Hug contents: the layer fits what is inside it.
- Fill container: the layer stretches to fill its parent.
- For limits, use Size limits: min and max width and height.
- Use Align self (Auto, Start, Center, End, Stretch) for one child. When the layer fills the main direction, a Grow field also shows.
Hug is offered for text, instances and frames. It is not offered for groups.
How to take a child out of the flow
- Select the child.
- Turn on Absolute position.
- Place it anywhere you like.
How to pin children in a free frame
A free frame has no auto layout. Pins keep a child in place when the frame is resized.
- Select the child.
- Open Pins.
- For Horizontal, pick Left, Right, Left and right, Center or Scale.
- For Vertical, pick Top, Bottom, Top and bottom, Center or Scale.
While you drag a frame edge, pinned children follow it live.
How to align a layer in its parent
- Select a layer that is in a frame without auto layout.
- At the top of Position & appearance, click one of the six Align buttons: left, horizontal centers, right, top, vertical centers or bottom.
How to change the order of children
- Drag a child inside its row, column or grid.
- The other children slide aside.
- Let go to drop it.
When you drag over another auto-layout frame, a dashed line shows where the layer will land. Near a frame edge, the layer goes beside that frame, not into it.