Use Auto Layout, constraints, and alignment
Auto Layout arranges the children of a frame or group as a row, column, wrapped stack, or grid. Use it for buttons, lists, navigation bars, cards, and other designs that should adapt when content changes.
The representative video demonstrates this exact workflow: Select a frame and switch its layout flow from freeform to horizontal.
Verified result: The frame uses a horizontal Auto Layout, hugs its contents at 296 by 120 pixels, and places both children with 16-pixel padding and a 40-pixel gap.
Transcript
- Select the frameSelect the frame in the Layers panel.
- Enable Auto LayoutChoose Horizontal stack to enable Auto Layout and arrange the children.
Before you start
Section titled “Before you start”- To convert an existing container, select one frame or group that contains the items you want to arrange.
- To wrap separate objects in a new Auto Layout frame, select two or more unlocked objects with the same parent: the same page level, frame, or group.
- Open the Design tab in the right panel and find Layout.
Auto Layout changes object positions immediately. If the current freeform arrangement is important, duplicate the container or note its size before continuing.
Turn on Auto Layout
Section titled “Turn on Auto Layout”- Select the frame or group.
- In Layout, choose Horizontal stack for a row or Vertical stack for a column.
- Set Gap for the space between items.
- Set Padding for the space between the items and the container edge.
- Choose an alignment point to position the items along both axes.
Both axes start as Hug, so the container may shrink or grow to fit its contents. If you need the original bounds, use Undo to restore the original width and height. Turn on Auto Layout again, change both axes to Fixed, and restore those dimensions.
Start from separate objects
Section titled “Start from separate objects”Select two or more objects with the same parent, then press Shift + A, choose Add auto layout in the right panel, or choose Add Auto Layout from the selection menu. Editor v2 creates a frame around the selection and suggests a direction, gap, and padding from the current arrangement.
If the action is unavailable, open Layers and confirm that every selected object is unlocked and belongs directly to the same parent.
Choose a flow and spacing
Section titled “Choose a flow and spacing”- Horizontal stack creates a row.
- Vertical stack creates a column.
- Grid places children into rows and columns with separate row and column gaps.
- Wrap starts another row or column when the main axis runs out of room.
- Reverse changes the order in which items flow.
- A negative gap intentionally overlaps items. Use Canvas stacking to choose which overlapping item appears on top.
For wrapped layouts, keep Link track gap on to reuse the main gap, or turn it off to set a separate track gap. Grid also lets you set track counts, track sizes, cell placement, spans, and cell alignment.
Control resizing
Section titled “Control resizing”Container and item sizing use three modes:
- Fixed keeps the current width or height.
- Hug grows or shrinks a container around its content.
- Fill lets a child use available space in its Auto Layout parent.
Select a direct child to set its main-axis and cross-axis resizing, Align self, growth, and minimum or maximum size. A Hug or Fill axis does not accept an exact drag size until you switch that axis to Fixed.
Turn on Strokes in layout when stroke width should contribute to spacing and the container’s calculated size.
Align items and use constraints
Section titled “Align items and use constraints”Use the nine-point alignment control on the Auto Layout container to place the group of children at the start, center, or end of each axis. For compatible text items, baseline alignment keeps text baselines level.
For one child:
- Select the child in Layers or on the canvas.
- Use Align self when it should differ from the container’s cross-axis alignment.
- Turn on Absolute position when it should stay inside the container without occupying a row, column, or grid cell.
- In Constraints, choose how that absolute item follows the container horizontally and vertically.
Horizontal choices are Left, Right, Center, Left & Right, and Scale. Vertical choices are Top, Bottom, Center, Top & Bottom, and Scale. Center or stretch-style constraints on a normal Auto Layout child move it to absolute positioning because the stack otherwise owns its position.
By default, absolute children do not affect a Hug container. Turn on Include absolute children in Hug only when their bounds should contribute to the container size.
Reorder or remove Auto Layout
Section titled “Reorder or remove Auto Layout”- Drag a direct child to the insertion marker to reorder it on the canvas.
- Select a direct child and use Ctrl/⌘ + an arrow key along the flow to move it by one position.
- To remove the layout rule, select the container and choose Freeform (no layout), choose Remove Auto Layout, or press Ctrl/⌘ + Shift + A.
Removing Auto Layout keeps the children’s current positions and returns the container to freeform placement.
Recover from an unexpected result
Section titled “Recover from an unexpected result”- If the container suddenly changes size, use Undo to restore the original size, then enable Auto Layout with both axes set to Fixed.
- If items appear in the wrong order, compare their order in Layers, then drag them to the intended insertion marker.
- If a child does not participate in spacing, make sure it is visible and that Absolute position is off.
- If a child refuses to resize, check whether its axis is Hug or Fill and change it to Fixed when an exact size is required.
- If the controls are disabled, unlock the selection and, for a component instance, edit the main component instead.
Current limitations
Section titled “Current limitations”- Structural controls such as flow direction are read-only on component instances. Supported spacing overrides may still be available; edit the main component for structural changes.
- Separate objects can be converted together only when they share one parent.
- Constraints in this panel apply to children of an Auto Layout container; they are not a page-wide positioning system.
- Creating directly into an empty Grid cell is not currently available. Create the object first, then place it in the grid.