Figma auto layout: a visual tutorial
Auto layout makes a Figma design behave like a real interface: buttons grow with their labels and lists close up when an item is removed. Each setting is drawn below.
What is auto layout in Figma?
Auto layout is a frame setting that arranges the layers inside the frame for you, using a direction, a gap between items, padding around them and an alignment. Change the content and the layout follows.
Select one or more layers and press Shift + A, or click Add auto layout in the right sidebar. If you know CSS, it works much like flexbox.
Every auto layout setting, drawn out
1. Flow: vertical, horizontal or grid
Vertical stacks items top to bottom, like a list. Horizontal places them left to right, like a row of buttons. Grid places items in rows and columns, and an item can span several cells. Turn on wrap and items move to a new row or column when they run out of room, which suits tags and chips.
2. Gap and padding
Padding is the space between the frame's edge and its contents, set for all sides or each side separately. Gap is the space between items: a number, or Auto to spread items across the frame.
3. Alignment
The nine-dot alignment box decides where items sit inside the frame. Text rows can also align to the text baseline.
4. Resizing: hug, fill and fixed
Hug contents shrinks or grows an auto layout frame to fit what is inside it. Fill container stretches a child to take the free space in its parent. Fixed keeps the width or height you typed. Watch out: if a child is set to fill, its parent can no longer hug on that axis.
5. Min and max width or height
Add a minimum or maximum on top of hug, fill or fixed. A text column set to fill with a max width of 640 stops at a readable line length on wide screens.
6. Ignore auto layout
For an item that must break the flow, like a badge on a bell icon, turn on Ignore auto layout (formerly absolute position). It stays in the frame and the other items ignore it.
Step by step: a button that grows with its label
- 01
Type the label
Press T and type a label. Keep the text set to auto width.
- 02
Press Shift + A
Figma wraps the text in a new auto layout frame.
- 03
Set padding
Example values: 24 horizontal, 12 vertical.
- 04
Add an icon and a gap
Drop an arrow icon in, keep the flow horizontal and set the gap to 8.
- 05
Centre and style
Align centre, add a fill and corner radius, and check width and height are Hug.
- 06
Make it a component
Press Ctrl + Alt + K (Cmd + Option + K on Mac). Every instance resizes with its own label.
Same component, three labels, same padding. This is how buttons, inputs and cards are built in a design system, and why a Figma prototype built with auto layout is easier to change.
Common auto layout mistakes
- Fixed width on a button whose label changesHug width, so the button grows with the text
- Spacer rectangles to push items apartA gap value, or gap set to Auto
- One giant auto layout frame for a whole screenSmall nested frames: a row inside a card inside a list
- Fixed-size text boxes inside a fluid frameAuto width or auto height text, so nothing overlaps
Learn on small parts first, then nest them. Even a grey-box wireframe goes faster when its blocks use auto layout.
Figma auto layout questions
- What is auto layout in Figma?
- Auto layout is a frame property in Figma that arranges the layers inside a frame automatically, using a direction, a gap between items, padding and alignment. When you edit text, add a layer or remove one, the frame and its contents re-arrange themselves without manual nudging.
- What is the shortcut for auto layout in Figma?
- Select one or more layers and press Shift + A to add auto layout. Option + Shift + A on Mac, or Alt + Shift + A on Windows, removes it. You can also click Add auto layout in the right sidebar.
- What is the difference between hug, fill and fixed in Figma?
- Hug contents makes an auto layout frame shrink or grow to fit its children plus padding. Fill container makes a child stretch to take the space left in its parent. Fixed keeps a width or height exactly as you set it. You can also add a minimum or maximum width or height on top of these.
- How do I place one item freely inside an auto layout frame?
- Select the child and turn on Ignore auto layout in the right sidebar. Figma used to call this absolute position. The item stays inside the frame but is taken out of the flow, so you can place it anywhere, such as a notification badge on the corner of an icon, and set constraints on it.
- Is auto layout the same as CSS flexbox?
- It is close. Direction, gap, padding, alignment and wrap map closely to flexbox, and the newer grid flow is similar to CSS grid. That is one reason developers find auto layout files easier to build from. It is not an exact copy, so check the result in Dev Mode or with your developer.
New to Figma? Start with the Figma tutorial for beginners. Want guided practice? Auto layout, components and prototyping are taught in the UX/UI Design Masterclass and the Figma course in Tirupur.
Book Your Free Career Guidance Call
Build real components with auto layout and get 1:1 feedback from Manoj Kumar, live online or at the Tirupur campus. Fees: enquire for details on +91 93422 42792.
Aarasoft Academy, 200/661, IDA Business Center, Suite 102, P.N. Road, Tirupur, Tamil Nadu 641602