> ## 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.

# Size and position

> Set how a layer sizes itself, lock its aspect ratio, take it out of the layout, pin it to its parent's edges and resize it to fill or fit.

Every layer in Wonder sizes and places itself the way an element does on a web page. This page covers the size fields, the **Position** section and the canvas shortcuts for resizing.

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

## Choose how a layer sizes itself

**Width** and **Height** sit in the **Size** row of the **Layout** section in the properties panel. Each field has a menu on its right that sets how that side is sized:

| Mode | The field shows | What the layer does |
| - | - | - |
| **Fixed** | `px` | Keeps the size you type, in pixels. |
| **Relative** | `%` | Takes a percentage of its parent's size. |
| **Hug** | **Hug** | Shrinks or grows to fit its content. |
| **Fill** | **Fill** | Takes all the space its parent gives it. |
| **Auto** | **Auto** | Sizes the way the browser would by default. |
| **Calculate** | the formula | Works out its size from a formula, such as `100% - 20px`. |

Not every mode fits every layer:

* **Relative** and **Fill** need a parent, so a top-level frame can't use them.
* **Hug** works on text, SVGs and frames with at least one child that follows the layout.
* **Auto** works on layers with a parent, and on text and SVGs.

You can also type a mode's name, such as `hug` or `fill`, into the field, or type `a` for **Auto**. Press <kbd>⌥</kbd> <kbd>↓</kbd> in the field to open the menu.

With several layers selected, the menu only lists the modes every one of them can use, and starts with **Mixed** when they use different ones.

The size badge under a selected layer on the canvas shows the same thing: the size in pixels, followed by **Hug**, **Fill**, the percentage or **Calc** when one applies.

## Set a minimum or maximum size

1. Open the menu on the right of **Width** or **Height**.
2. At the bottom, choose **Add min width** or **Add max width** (or **Add min height** or **Add max height**).
3. Type the limit in the new field.

Each limit has its own menu, with **Set to current width** (or height) and **Remove min width** (and so on). Clearing the field also removes the limit.

Limits are most useful with **Fill**, **Hug** and **Relative**: the layer still follows its mode but never gets smaller than its minimum or larger than its maximum.

## Lock the aspect ratio

Click the lock button to the right of **Width** and **Height** (**Lock aspect ratio**). While it's on:

* Typing a new width also changes the height, and the other way round.
* Dragging a handle on the canvas keeps the proportions.

Click it again (**Unlock aspect ratio**) to turn it off. Switching either side to a mode other than **Fixed** also unlocks it.

The button is off for a layer with zero width or height and for inline text.

## Follow the layout or position absolutely

A layer inside a Flex, Grid or Block frame follows that layout: the frame decides where it goes. To place it freely instead, click **Make absolute** in the header of the **Position** section. The layer keeps its place and size, moves to the front, and other layers close the gap it left. This is what Figma calls "Ignore auto layout".

To put it back into the layout, click the same button (**Follow layout**).

The button shows only when the layer's parent has a layout. See [Layout](https://wonder.design/docs/layout.md).

## Place a layer

The **Position** section holds:

* **X position** and **Y position**: where the layer sits inside its parent.
* **Rotation**: in degrees.
* **Z-index**: which absolute layers sit on top of which. It shows **Auto** until you set it, and you can type `a` to reset it. It's only available for absolutely positioned layers.
* Alignment buttons: **Align Left**, **Align Center**, **Align Right**, **Align Top**, **Align Middle** and **Align Bottom**. With several layers selected they align to each other; a single absolute layer aligns inside its parent.
* **Rotate** (by 90°), **Flip Horizontal** (<kbd>⇧</kbd> <kbd>H</kbd>) and **Flip Vertical** (<kbd>⇧</kbd> <kbd>V</kbd>).

The alignment shortcuts are <kbd>⌥</kbd> <kbd>A</kbd> (left), <kbd>⌥</kbd> <kbd>H</kbd> (center), <kbd>⌥</kbd> <kbd>D</kbd> (right), <kbd>⌥</kbd> <kbd>W</kbd> (top), <kbd>⌥</kbd> <kbd>V</kbd> (middle) and <kbd>⌥</kbd> <kbd>S</kbd> (bottom). To change the stacking order of any layer, use **Bring to front** (<kbd>⌥</kbd> <kbd>⌘</kbd> <kbd>]</kbd>) and **Send to back** (<kbd>⌥</kbd> <kbd>⌘</kbd> <kbd>\[</kbd>).

## Pin a layer to its parent

An absolutely positioned layer inside a frame is pinned to one horizontal edge and one vertical edge of its parent. When the parent resizes, the layer keeps its distance from those edges. This replaces Figma's constraints.

1. Select an absolute layer inside a frame.
2. In the **Position** section, pick **Left** or **Right**, and **Top** or **Bottom**. You can also click an edge in the pin square next to them (**Anchor to top**, **Anchor to left** and so on).

When a layer is pinned to the right or bottom, **X position** or **Y position** shows its distance from that edge.

There is no center or scale pin. To make a layer stretch with its parent, give it **Fill** or a **Relative** size instead.

## Resize to fill or fit

* **Resize to fill** (<kbd>⌘</kbd> <kbd>⇧</kbd> <kbd>⌥</kbd> <kbd>F</kbd>): makes the selected layer cover its whole parent, positioned absolutely at its top left. Its parent must be a frame without a layout (**Freeform**).
* **Resize to fit** (<kbd>⌘</kbd> <kbd>⇧</kbd> <kbd>⌥</kbd> <kbd>R</kbd>): shrinks or grows the selected frame to fit its children. The frame must have children and no layout of its own.

Run them from the **Layout** submenu when you right-click, or from the command menu (<kbd>⌘</kbd> <kbd>K</kbd>). The button in the **Position** section header runs **Resize to fit** when the selection can be fit, and **Resize to fill** otherwise.

## Resize on the canvas

Drag a selection handle to resize. While you drag:

* Hold <kbd>⇧</kbd> to keep the proportions.
* Hold <kbd>⌥</kbd> to resize from the center.
* Hold <kbd>⌘</kbd> to resize a frame without its children following their pins.

Double-click a side handle to set that side to **Hug**, on text or a frame with children. <kbd>⌥</kbd>-double-click it to set it to **Fill**.

## Scale a layer

The **Scale** tool (<kbd>K</kbd>) resizes a layer and everything in it in proportion, including text, borders and effects. While it's on, the properties panel shows only the **Scale** section: type a new width or height, or a **Scale** percentage, or pick a preset such as **2×**. Press <kbd>V</kbd>, or click **Exit scale mode**, to go back to the Move tool.

## If something goes wrong

* **Fill or Relative isn't in the menu.** The layer has no parent. Put it inside a frame first.
* **Hug isn't in the menu.** The frame has no children that follow its layout. Add a child, or make one of its absolute children follow the layout.
* **I can't change Z-index or the pins.** They only apply to absolutely positioned layers. Click **Make absolute** first.
* **Resize to fill is greyed out or missing.** It works only inside a frame without a layout. In a Flex, Grid or Block frame, set the layer's size to **Fill** instead.
* **The size fields are greyed out.** The layer is inline text, which sizes to its content.

## Related

* [Layout](https://wonder.design/docs/layout.md)
* [Fills, borders and effects](https://wonder.design/docs/fills-borders-and-effects.md)
* [Variables](https://wonder.design/docs/variables.md)


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