How to use constraints in Figma

Pin a layer to the edges of its frame in Figma. Open the Constraints control, set horizontal and vertical constraints, then resize the frame to test.

Quick answer

Select a layer inside a frame, open the Constraints control in the Position section of the right sidebar, then choose a horizontal and a vertical constraint from the dropdowns. Pick Right and Bottom to pin the layer to those edges. Then select the frame and change its Width to resize it.

Steps at a glance

  1. Select the layer inside your frame
  2. Click Constraints in the Position section
  3. Choose a horizontal constraint
  4. Choose a vertical constraint
  5. Select the frame in Layers
  6. Change the frame Width

Interactive demo

Loading demo…

Summary

Constraints tell a layer how to behave when its parent frame changes size. Setting them keeps buttons, logos and panels anchored where you want them as a design is resized.

Step-by-step guide

  1. Step 1

    Select the layer

    Click Rectangle 1 in the Layers panel. The layer must sit inside a frame such as Frame 1, because constraints are relative to the parent frame.

  2. Step 2

    Open the constraints controls

    In the right sidebar, find the Position section and click Constraints. Two dropdowns appear: Horizontal constraints and Vertical constraints.

  3. Step 3

    Choose a horizontal constraint

    Open Horizontal constraints and pick one of Left, Right, Left + Right, Center or Scale. Choose Right to keep the layer pinned to the right edge of the frame.

  4. Step 4

    Choose a vertical constraint

    Open Vertical constraints and pick one of Top, Bottom, Top + Bottom, Center or Scale. Choose Bottom to keep the layer pinned to the bottom edge.

  5. Step 5

    Select the frame

    Click Frame 1 in the Layers panel so the frame, not the layer, is selected. The sidebar now shows the frame's own layout settings.

  6. Step 6

    Set the frame width

    Enter a new value in the Width field to resize the frame. Use this to test how the layer reacts to the constraints you chose.

Why this matters

You have a card with a button that must stay in the bottom corner. Without constraints, resizing the frame leaves the button floating in the wrong place. Setting them once means the layout holds as you try other sizes.

Frequently asked questions

  • Which constraint options can I choose?

    Horizontal constraints offer Left, Right, Left + Right, Center and Scale. Vertical constraints offer Top, Bottom, Top + Bottom, Center and Scale.

  • Do constraints need a frame?

    Yes. Constraints are relative to the parent frame, so place the layer inside a frame such as Frame 1 before setting them.

Create interactive demos like this one — free, no coding required.

Start for free →