Constraints

Apply constraints to design responsive and adapt across screen sizes

Constraints allow you to control how elements behave in relation to their parent container. When you set constraints for an element, it ensures the element maintains a consistent position relative to the container, even when the screen size changes.

Automatic constraints

When you add an element to a section, container, or grid cell, and drag it around, it is automatically docked:

  • To the top of the parent element (container, stack, etc.).

  • And to the left or right edge of the parent element - whichever is the closest.

In the example below, the text element is automatically docked to the top and right sides of the container.

You can observe this when dragging the element and via the Inspector panel. The Constraints are indicated by the dashed blue lines surrounding it.

Manual constraints

You can override the auto constraints elements feature, and set the position manually from the Inspector.

Measurement units for constraints:

  • Horizontal constraints (left or right): Percentage (%).

  • Vertical constraints (top or bottom): Pixels (px).

For example, if a text element's constraints are set as 10% for the Left and 100px for the Top, the element will stay to the left-right even as the screen size changes:

  • On a container width of 1265px, the margin between the element and the container's left edge is 126.5px, and the margin-top of the element with the container is 100px.

  • On a container width is resized to 900px, the margin between the element and the container's left edge is 10% of 900 = 90px, and the margin-top of the element with the container is 100px.

Use alignment tools

To quickly align elements, you can use the option for the section's position alignment. This will override the current constraints.

Last updated

Was this helpful?