Skip to content

Auto layout: stacks that lay themselves out

Turn a group into a stack: its items line up across or down with even gaps and padding, and it grows with its text, like Figma's auto layout.

Auto layout turns a group into a stack: its items sit one after the other, across or down, with the same gap between them and padding around them, and the stack grows and shrinks with what's in it. Type a longer word in a button and the button gets wider; add a line to a list and the list gets longer. It works like auto layout in Figma.

Making a stack

  • Select a group and press ⇧A, or choose Add auto layout in the inspector, the right-click menu or the command search (⌘/). Its elements stay as they're laid out now: across or down, whichever they're closer to, with their average gap.
  • Select several elements and press ⇧A to put them in a new stack. A group among them becomes a stack of its own inside the new one.
  • Start from a preset: open Auto layout in the bottom bar for a Button, a Price tag, a Row of icons or a List.

A stack is drawn on a box behind its items, empty at first. Select it (Style its background in the inspector, or double-click into the stack and click between its items) to give it a fill, a stroke, rounded corners or a shadow: that's how a button or a price tag gets its color.

Settings

Select the stack to see Auto layout in the inspector:

  • Direction: across, down, or across in rows that wrap where the stack ends (wrapping needs a fixed width).
  • Gap: the space between items. Auto spreads the room left over between them instead, and the gap is then the least they keep apart. A wrapping stack has a second gap, between its rows.
  • Padding: the space inside the box, the same on every side, or each side on its own.
  • Alignment: the grid of nine places where the items sit. Items as wide as it (or as tall) stretches every item across the stack.
  • Width and Height: Hug makes the stack as big as its items plus the padding; Fixed keeps the size you give it. A hugging stack can have a least width and height, so buttons with short words stay the same size.

To resize a stack, select it and drag the handles on its box. A side that hugged becomes fixed.

Sizing items

Select an item to choose how it's sized, under In a stack:

  • Fixed: the size it has.
  • Hug: a text as wide as its words on one line, so it never wraps.
  • Fill: the room left in the stack along it (shared by the items that fill), or the stack's whole inside across it.

A text's height always follows its lines. Resizing an item that hugs or fills makes it fixed, as in Figma.

Moving items

The items' order is their order in Layers, top first. Drag an item along its stack to move it: a blue line shows where it goes. Drop it in another stack to move it there, or outside every stack to take it out. With an item selected, the arrow keys move it earlier or later, and with ⇧ to the start or the end. Duplicating an item puts the copy right after it.

To move the whole stack, click it once and drag it as usual. Double-click to work inside it.

Stacks inside stacks

A stack can hold other stacks: a list whose rows are an icon beside a text, a card with a row of buttons. Select a few items of a stack and press ⇧A to put them in a stack of their own, in their place, or select whole stacks and press ⇧A to put them in a new one. In Layers, the items of a nested stack are indented under it. Click between a nested stack's items to select it whole.

Removing auto layout

⌥⇧A, or the minus button beside the direction, stops a stack laying out: its items stay where they are, the group stays, and an empty box goes. Ungrouping a stack does the same.

Good to know

  • Rotation isn't used inside a stack: a turned item is laid out as if it weren't turned.
  • A stack can't go in a group, and ⌘G doesn't group what's in a stack: press ⇧A to put them in a stack instead.
  • Hidden items take no room. Masks in a stack keep their place on its box and cut what's above them, as in any group. A barcode's number line goes with its barcode.
  • A stack can be a component's main: its instances are stacks too, and each one lays out its own words.
  • Animate items one by one, in the inspector, gives the items entrances that follow their order, for videos and presenting.
  • The AI assistant can make simple stacks, like buttons, tags and lists, and change their gap, padding and order. Stacks inside stacks are yours to make.
  • Stacks export exactly as they look, in every format: the layout is worked out in the editor and kept in the design.

Still stuck?

Write to us and we’ll get back to you by email.

Contact us