Building Responsive UI Components with Figma Auto Layout
Learn how to use Figma Auto Layout to create responsive UI components. This guide covers Hug vs. Fill settings, absolute positioning, and how to avoid over-nesting.
16 Oct 2026, 01:39 UTC

The Problem: Static Designs vs. Dynamic Content
Static frames in Figma require manual repositioning every time a text string changes or a screen size shifts. This creates a maintenance bottleneck where designers must manually resize dozens of components to accommodate different languages or device widths.
The solution is Auto Layout, a property that transforms a standard frame into a dynamic container. It functions similarly to CSS Flexbox, allowing elements to grow, shrink, and shift based on predefined rules rather than fixed X/Y coordinates.
Prerequisites
- A Figma account with Editor access to a project.
- Basic components (e.g., a text layer and a shape) already created on the canvas.
- Figma Desktop App or Browser version (current stable release).
Implementing a Scalable Component
To demonstrate a practical application, we will build a responsive Notification Toast that expands based on the message length and fills the width of its parent container.
Step 1: Create the Base Container
- Select your text layer and icon.
- Press
Shift + Ato wrap these elements in an Auto Layout frame. - In the Right Sidebar, set the Direction to Horizontal.
- Set the Gap between items to
12pxto ensure consistent spacing between the icon and the text. - Apply Horizontal padding of
16pxand Vertical padding of12px.
Step 2: Configure Resizing Behaviors
The behavior of the component depends on how the child elements interact with the parent frame. Configure the following settings in the Frame section of the sidebar:
| Element | Resizing Setting | Result |
|---|---|---|
| Parent Frame | Hug Contents | The toast shrinks or grows to fit the text inside. |
| Text Layer | Fill Container | The text wraps to a new line when the parent frame reaches a maximum width. |
| Icon | Fixed Width/Height | The icon remains a constant size regardless of text length. |
Step 3: Handling Overlays with Absolute Positioning
Sometimes a component needs an element that ignores the Auto Layout flow, such as a "Close" (X) button in the top-right corner.
- Place the Close button inside the Auto Layout frame.
- In the Right Sidebar, click the Absolute position icon (a plus sign inside a square).
- Manually move the button to the top-right corner.
- Set the Constraints to
RightandTop. This ensures the button stays anchored to the corner even as the toast expands.
Verification and Diagnostics
To confirm the component is truly responsive, perform these three checks:
- Content Stress Test: Double-click the text layer and paste a long paragraph. The parent frame should expand vertically (if set to Hug) or the text should wrap (if set to Fill).
- Parent Resize Test: Place the toast inside a larger frame. Change the toast's width setting to
Fill Containerand resize the parent frame. The toast should expand and contract in sync with the parent. - Alignment Check: Use the Auto Layout alignment grid in the sidebar to toggle between Top-Left, Center, and Bottom-Right to ensure elements anchor correctly during resizing.
Limitations and Risks
Over-Nesting: Avoid nesting Auto Layout frames more than 4-5 levels deep. Deep hierarchies make it difficult to track which "Fill" setting is controlling a specific element and can slow down performance in complex files.
Constraint Conflicts: If you set multiple elements to Fill Container but also apply a Minimum Width that exceeds the parent's size, the layout will overflow. Always check that the sum of fixed elements and minimum widths does not exceed the available screen real estate.
Rollback Procedure
If the Auto Layout settings cause elements to jump to unexpected positions:
- Select the frame.
- Press
Option + Shift + A(Mac) orAlt + Shift + A(Windows) to remove Auto Layout. - The frame will return to a standard frame, and elements will return to their last absolute coordinates.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.