> ## Documentation Index
> Fetch the complete documentation index at: https://wonder.design/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Layout

> Lay out a frame's children with Flex, Grid or Block, make a layer inline, and edit gaps, padding and grid tracks on the canvas.

A frame's layout decides where its children go. Wonder's layouts are the ones CSS uses, so what you build on the canvas behaves the same way in code.

**Before you start** · Web and desktop · Free plan

## Choose a layout

Select a frame. In the **Layout** section of the properties panel, the **Flow** row has four options:

| Layout | What the children do |
| - | - |
| **Freeform** | Stay where you put them. Nothing moves them. |
| **Flex** | Line up in a row or a column, with a gap between them. |
| **Grid** | Sit in the cells of a grid of columns and rows. |
| **Block** | Stack from top to bottom, each on its own line, like paragraphs on a web page. |

Choosing a layout changes the frame in place. Only frames have a layout; text and SVGs sit inside one.

## Make a layer inline

Inline layers flow next to each other like words in a sentence, wrapping onto the next line when they run out of room. A layer can be inline when its parent uses **Block**.

1. Select a frame or text layer inside a Block frame.
2. Click the inline button in the **Layout** section header (**Make inline**).

Click it again to make the layer block-level. Inline text sizes to its content, so its width and height fields are greyed out.

## Add auto layout

Auto layout is Wonder's name for **Flex**.

* Press <kbd>⇧</kbd> <kbd>A</kbd> (**Add auto layout**) to add it.
* Press <kbd>⌥</kbd> <kbd>⇧</kbd> <kbd>A</kbd> (**Remove auto layout**) to set the frame back to **Freeform**.

Both are also in the **Layout** submenu when you right-click, and in the command menu (<kbd>⌘</kbd> <kbd>K</kbd>).

What <kbd>⇧</kbd> <kbd>A</kbd> does depends on what you select:

* **One frame without a layout, or with Block**: the frame becomes Flex. Wonder picks a row or a column from where the children sit, and the frame hugs its content.
* **Several layers, or a layer that isn't a frame**: Wonder wraps them in a new Flex frame and selects it. A single text layer gets a centered row with a 10 px gap, like a button.
* **A frame that already has Flex or Grid, or an image with nothing inside it**: Wonder wraps it in a new Flex frame.

If the layers already sit in a grid, Wonder makes a **Grid** instead of a Flex.

## Set up a Flex layout

With **Flex** chosen, the **Layout** section shows:

* **Flex Row** or **Flex Column**: the direction the children line up in.
* **Alignment**: a 3 × 3 grid. Click a cell, such as **Align top left**, to place the children inside the frame.
* **Space Evenly**, **Space Between** and **Space Around**: spread the children out instead of using a fixed gap. Click the active one again to turn it off.
* **Horizontal gap** and **Vertical gap**: the space between children, from 0 to 999 px.
* The wrap button (**Wrap items onto multiple lines**): lets children move to a new line when they run out of room.

The **Flex settings** menu has **Reverse direction**, **Reverse wrap** and, for rows, **Align text baseline**.

## Set up a Grid layout

With **Grid** chosen:

1. Click the **Grid** button (it shows the size, such as **3 × 2**) and pick how many columns and rows you want from the matrix. You can also type **Number of columns** and **Number of rows**. Set rows to **Auto** to add rows as the content needs them.
2. Set **Horizontal gap** and **Vertical gap**. Hovering a gap field highlights those gaps on the canvas.
3. Use **Align items** to place each child inside its cell, and **Align grid** to place the whole grid inside the frame when there's room left over.

**Automatic positioning** places children in the next free cell. Turn it off to put each child in a cell of your choice.

### Size grid tracks

Open **Grid settings** to size each column and row. Under **Columns** and **Rows**, each track has a size and one of four modes:

| Mode | In CSS | What the track does |
| - | - | - |
| **Fill** | `fr` | Shares the space left over with the other Fill tracks. |
| **Fixed** | `px` | Keeps the size you type. |
| **Hug** | `auto` | Fits the content in it. |
| **Percent** | `%` | Takes a percentage of the frame. |

Click **+** (**Add column** or **Add row**) to add a track, **−** to remove one, and drag a track to reorder it. A grid always has at least one column.

On the canvas, hover a column or row of a selected grid to show its badge. Click the size to type a new one, open the arrow for the modes, or drag the grip to move the track.

### Place children in a grid

* Drag a child into a cell on the canvas. It only pushes aside the children it lands on.
* With **Automatic positioning** off, select a child and use the arrow keys to move it one cell at a time.
* Under **Grid child**, set **Column span** and **Row span** to make a child cover several cells.

## Set up a Block layout

With **Block** chosen:

* **Spacing** sets the vertical space between children.
* **Alignment** places children on the left, center or right using their margins. It doesn't align inline text.

## Set padding and margin

**Padding** is the space inside a Flex, Grid or Block frame, around its children. **Margin** is the space around a layer, outside it.

By default you set **Horizontal padding** and **Vertical padding**. Click the **All sides** button to set **Left padding**, **Top padding**, **Right padding** and **Bottom padding** one by one, or <kbd>⌘</kbd>-click a padding field to set **All padding** at once. Margin has the same pair and **All sides** views, and each margin side can also be **Auto**.

## Edit gaps and padding on the canvas

Hover a selected Flex or Block frame to show small handles in its padding and between its children.

* **Drag a padding handle** to change that side. Hold <kbd>⌥</kbd> to change the opposite side too, or <kbd>⌥</kbd> <kbd>⇧</kbd> to change all four. Hold <kbd>⇧</kbd> alone to move in bigger steps.
* **Drag a gap handle** to change the gap. In Flex, every gap changes together; in Block, only that one does.
* **Click a handle** to type an exact value.

The handles show only when the frame is at least 48 px wide and tall on screen; zoom in on smaller frames. Grid frames show padding handles only; set their gaps in the panel.

## Coming from Figma

| In Figma | In Wonder |
| - | - |
| Auto layout, horizontal or vertical | **Flex**, **Flex Row** or **Flex Column** |
| Auto layout, grid | **Grid** |
| No auto layout | **Freeform** |
| Spacing between items | **Horizontal gap** or **Vertical gap** |
| Space between | **Space Between** |
| Hug contents, Fill container | **Hug** and **Fill** sizes. See [Size and position](https://wonder.design/docs/size-and-position.md). |
| Ignore auto layout | **Make absolute**. See [Size and position](https://wonder.design/docs/size-and-position.md#follow-the-layout-or-position-absolutely). |
| Constraints | Pins to the parent's edges. See [Size and position](https://wonder.design/docs/size-and-position.md#pin-a-layer-to-its-parent). |

Designs you [import from Figma](https://wonder.design/docs/import-from-figma.md) come in with these layouts already applied.

## If something goes wrong

* **I can't see the Flow options.** Only frames have a layout. Select the frame, not a layer inside it.
* **The inline button is greyed out.** Hover it to see why: the parent must use **Block**, the layer must follow the layout, and a selection can't mix inline and non-inline layers.
* **⇧A made a Grid, not a Flex.** The layers were already arranged in a grid. Choose **Flex** in the **Flow** row to change it.
* **I can't see the gap and padding handles.** Select a single Flex or Block frame, hover it, and zoom in until it's at least 48 px on screen.

## Related

* [Size and position](https://wonder.design/docs/size-and-position.md)
* [Fills, borders and effects](https://wonder.design/docs/fills-borders-and-effects.md)
* [Import from Figma](https://wonder.design/docs/import-from-figma.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.