Skip to main content

Understanding Constraints

Learn to control elements' behavior when frames or sections resize.

Iselin Ekornes avatar
Written by Iselin Ekornes
Updated yesterday

Constraints help control how elements behave when the container (frame or section) they are in changes size. They ensure your elements stay positioned and scale properly across devices and breakpoints. This works by anchoring the element to certain sides of the container, relative to its position.

Constraints define an element’s position relative to its parent container, such as a frame or section. They’re automatically set when you place or move an element, anchoring it to the most suitable position on the X-axis (while the Y-axis defaults to “top” and can be adjusted manually). You can view and edit constraints in the Style panel or directly on the canvas. Auto constraints can be overridden to left, center, or right, and units can be changed to pixels, percentages, or viewport values. Blue guidelines appear to show which constraint points are active.

How to turn off auto constraints

  1. Go to the constraints editor in the style panel.

  2. Open the dropdown to the left.

  3. Select which side you want the element to anchor its position to.

Alternatively, you can deselect 'auto' by selecting the side you want it anchored to directly from the panel. This will update the dropdown selection to the side you choose.

Constraints Settings

Constraints are divided into horizontal and vertical settings. Here's a breakdown of how these work:

Horizontal Constraints

Value

Description

Auto (default)

The constraints automatically update based on the element's position.

Left

The element stays the same distance from the left side of the container.

Right

The element stays the same distance from the right side of the container.

Center

The element stays centered horizontally within the container.

Stretch

The element stays the same distance to the left and right, causing its width to scale as the container resizes.

Vertical Constraints

Value

Description

Top (default)

The element stays the same distance from the top of the container.

Bottom

The element stays the same distance from the bottom of the container.

Center

The element stays centered vertically within the container.

Stretch

The element stays the same distance to the top and bottom, causing its height to scale as the container resizes.

Example Scenario

Let's say you have a button at the bottom of a card, and you want it to stay at the bottom when the card's height increases.

If the button is set with a vertical constraint to the top of the card, it will stay the same distance from the top when the card gets taller. To make the button stay at the bottom instead, adjust the button's vertical constraint to the bottom of the card. Now, the button will maintain its position relative to the bottom, not the top.

Did this answer your question?