brsh

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 ​

  1. Select a frame.
  2. In the panel, find Auto layout.
  3. Click Add auto layout (the + button). The frame becomes a column.
  4. To change this, pick Row, Column or Grid under Direction.

To remove it, click Remove auto layout.

How to set gap, padding and alignment ​

  1. Use the alignment pad to place the children.
  2. Set Gap to the space between children. Or click Space between or Space around.
  3. Set padding. One field is for top and bottom. One field is for left and right.
  4. 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 ​

  1. Select a layer in an auto layout.
  2. In Position & appearance, click the Width or Height field.
  3. 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.
  4. For limits, use Size limits: min and max width and height.
  5. 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 ​

  1. Select the child.
  2. Turn on Absolute position.
  3. 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.

  1. Select the child.
  2. Open Pins.
  3. For Horizontal, pick Left, Right, Left and right, Center or Scale.
  4. 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 ​

  1. Select a layer that is in a frame without auto layout.
  2. 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 ​

  1. Drag a child inside its row, column or grid.
  2. The other children slide aside.
  3. 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.