Tips & Tricks for Auto Layout in Figma

How to use Figma Auto Layout For Buttons

What is auto layout?

Auto layout is a property that allows you to create dynamic frames that automatically adjust items horizontally or vertically. When the property is applied the frame layer becomes an auto layout frame which has it’s own corner radius, fill, and stroke — no additional layers needed.

What to use auto layout for?

  • Buttons that adjust to the length of your text
  • Repeatable lists
  • Add to existing components

Basics— Adding Auto Layout

Keyboard Shortcut for adding Auto Layout

Once a frame is selected, you then can go to the properties panel and add auto layout (displays under the constraints property). Or you can use the keyboard shortcut, Shift A.

When auto layout is added, you will notice that the frame icon changes to the two rectangles indicating that auto layout is applied to the frame.

Adding Auto Layout to Buttons

You can add auto layout to a button (in a frame) to automatically adjust for text length while maintaining your desired value for padding (horizontal and vertical).

Button without and with the Auto Layout Property.
Button without and with the Auto Layout Property.
Button without and with the Auto Layout Property.

With frames, you will no longer need to create a background layer for your button’s fill color. If you add auto layout and have a fill color layer, the layer is removed, then the fill color is automatically contained in your frame’s properties.

When Auto Layout is added to the button Frame the fill color is then contained within the Frame properties.

Auto layout is useful for nested frames, that is when you have child frames inside of a parent frame.

In the example below, the parent frame is “Button Set” which contains the three child frames (each of the buttons). On the parent frame, you can add auto layout to space out each of the buttons which is independent from the child frames. The child frames retain their own auto layout values.

Auto Layout, spacing applied between the buttons

An auto layout frame will only allow direct drag-n-drop of items that are smaller in size than the frame size. For items larger than the frame size, you can force it to get inside by dragging the item, then holding the ⌘ key. By forcing a larger sized item into your frame, this will automatically adjust the size of the button to fit the larger item.

Drag-n-drop in frame with auto layout.
Keyboard shortcut for force insert.

Sr. Product Designer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store