Figma is a popular interface design application that allows designers to wireframe, prototype, and design user interfaces. One of its most useful features for rapid prototyping is Auto Layout.
Auto Layout allows you to create resizable elements and components that automatically adjust and reposition themselves based on the size of their container or the screen. This saves a huge amount of time compared to manually adjusting padding, margins, and position of elements.
Table of Contents
What is Auto Layout
Auto Layout is a layout method in Figma that allows elements inside a frame or component to intelligently resize and reposition themselves based on the size of their container. For example, if you have an image with text wrapped around it inside a frame, the text will automatically reposition itself as the frame size changes.
The main benefits of Auto Layout are:
- Responsiveness – Elements can seamlessly adjust to different screen sizes without manual tweaking
- Consistency – Spacing and alignment remains consistent as containers change size
- Prototyping – Quickly iterate on different layouts and sizes
How Auto Layout Works
Auto Layout works through a system of constraints and rules. When Auto Layout is enabled, Figma allows you to define constraints like:
- Fixed distances between elements
- An element staying a fixed distance from the container edge
- Elements maintaining their size ratio
- Content stretching to fill a container
As the container is resized, Figma uses these rules to automatically determine the new position and size of elements inside it.
Enabling Auto Layout
Auto Layout can be enabled on frames and components. Here is how to enable it:
- Select a frame or component layer
- In the Properties Panel (right sidebar), toggle “Auto Layout” on
Enabling Auto Layout
That’s it! Auto Layout will now be enabled for that frame or component.
Adding Auto Layout Rules
With Auto Layout enabled, you can now add auto layout rules:
Setting Padding Constraints
You can fix the padding between an element’s edge and the container:
- Select the element
- In the Properties Panel, set the Left, Right, Top or Bottom padding values under Auto Layout settings
This will keep the padding fixed as the container changes size.
Setting auto padding
Setting Space Between Elements
To keep a fixed space between elements irrespective of container size:
- Select one of elements
- In the Properties Panel, set the Right, Left, Top or Bottom spacing
Setting auto spacing
This will now keep the elements spaced apart by fixed margins.
Maintaining Size Ratios
You can also maintain an element’s size ratio relative to its container:
- Select the element
- In the Properties Panel, set “Width” and “Height” to values under 100%
For example, setting Width to 50% and Height to 100% will maintain a fixed 2:1 aspect ratio.
Setting “Width” and “Height” to 100% will force an element to stretch and fill its parent container. This is useful for backgrounds and containers.
Creating Responsive Layouts
A key benefit of Auto Layout is creating responsive, adaptive layouts.
To create a responsive layout:
- Enable Auto Layout on a frame
- Add elements like text, images inside it
- Add auto layout rules to govern spacing, padding, etc.
- Resize the frame and see the content auto-adjust
This allows you to quickly iterate on different layouts for mobile, tablet and desktop screens.
Here is an example responsive layout with auto adjusting elements:
Responsive auto layout
Auto Layout Best Practices
Here are some tips for working with Auto Layout effectively:
- Add rules incrementally – Start with core elements, basic spacing and padding first. Then increase complexity.
- Use fixed and stretchy elements – Anchor key elements that remain fixed size while allowing stretchy ones to fill space.
- Prototype early – Test resizing early to catch layout issues.
- Limit nesting depth – Nesting too many auto layout frames causes performance issues.
- Check alignment and spacing – Resize window and ensure everything still looks visually aligned.
- Use layout grids – Layout grids combined with auto layout ensure proper alignment.
Can I manually override auto layout?
Yes! Auto layout can be manually overridden by changing the position/size of elements.
Does auto layout work for components?
Yes! Enabling auto layout on components makes them truly responsive.
What’s the difference between auto layout and constraints?
They are essentially the same thing. Auto layout relies on constraints under the hood.
What if auto layout isn’t working as expected?
- Check for conflicting rules
- Remove nesting depth
- Remove manual overrides
- Add additional spacing/padding rules
Auto Layout is an incredibly powerful tool in Figma allowing for rapid design iteration. Using the spacing, sizing and alignment constraints it provides, you can create fully responsive layouts that adapt beautifully to any screen size.