Before auto layout, changing one button label in Figma meant resizing the button by hand, then nudging everything next to it. Auto layout fixes that. It turns a frame into a flexible container that arranges its children automatically, a lot like CSS Flexbox on the web. It is the foundation of every design system I build.
Step 1: Create your first auto layout
- Type a text layer, for example “Get started”.
- Select it and press Shift + A.
- Figma wraps it in a frame. Add a fill and corner radius, and you have a button.
Now edit the text. The button grows and shrinks with the label. That is auto layout working.
Step 2: Direction, gap and padding
In the Auto layout section of the right sidebar:
- Direction: vertical, horizontal, or wrap. Wrap moves items to a new row when they run out of space, which is ideal for tag lists.
- Gap between items: the space between each child.
- Padding: space between the edge of the frame and its content. You can set each side separately.
- Alignment: a 3×3 grid that controls where children sit.
Pro tip: Set the gap to Auto to push items to opposite ends, like a logo on the left and a menu on the right of a navbar.
Step 3: Understand resizing
Each frame and child has width and height settings:
| Setting | What it does | Typical use |
|---|---|---|
| Hug contents | Shrinks to fit the content | Buttons, chips, labels |
| Fill container | Stretches to fill the parent | Inputs, full-width cards |
| Fixed | Stays at an exact size | Icons, avatars, images |
You can also set min and max widths, so a card stretches on desktop but never becomes too wide to read.
Step 4: Nest auto layouts
Real interfaces are layouts inside layouts. A product card might be:
- A vertical auto layout card (image, text group, button).
- Inside it, a vertical text group (title, price).
- Inside that, a horizontal row (rating stars and review count).
Select a group of layers and press Shift + A at each level. When you change the title to two lines, everything below moves down automatically.
Step 5: Reorder with drag and arrow keys
Drag items inside an auto layout frame to reorder them, or select a child and use the arrow keys. Spacing stays perfect.
Watch out: If a child refuses to stretch, check both levels: the child needs Fill container and the parent must not be set to Hug in that direction.
Practice
Build a navbar: a horizontal auto layout with a logo, a nested horizontal group of four links with a 24 px gap, and a button. Set the main gap to Auto and the width to Fill. Resize the frame and watch the whole navbar adapt.