Figma Auto Layout: Choosing Constraints for Responsive Components
A decision guide for Figma Auto Layout constraints: compare fixed, hug contents, and fill container modes in a compact table, understand nesting trade-offs, and validate a responsive button component with concrete steps.
19 Mar 2026, 03:39 UTC

The Decision: Which Auto Layout Constraints Match Your Component?
Auto Layout turns a static frame into a responsive container that reflows children when content or viewport size changes. The decision isn't whether to use it—most modern Figma component libraries rely on it—but which combination of sizing modes and constraints produces the behavior you need without fragile nesting or export surprises.
Constraints at a Glance
| Constraint | Frame Sizing | Child Behavior | Typical Use Case |
|---|---|---|---|
| Fixed width / height | Set pixel values | Children respect absolute dimensions | Icons, avatars, fixed-height headers |
| Hug contents | Shrinks/grows to fit children | Children dictate parent size | Buttons, chips, inline tags |
| Fill container | Expands to parent bounds | Child stretches with parent | Full-width cards, form inputs, grid columns |
| Pin constraints (left/right/top/bottom/center) | Applied per child | Child maintains relative position | Navigation bars, floating actions, aligned labels |
Trade-offs That Affect Maintenance
Nesting Depth vs. Predictability
Each Auto Layout frame adds a layout pass. A card component with an icon, title, description, and action row might nest four frames: card → content wrapper → text block → action row. Beyond three levels, resizing the top frame can produce unexpected gaps because padding and gap values compound. Flatten by using gap and padding on a single parent where possible, and reserve nested frames only for distinct alignment directions (horizontal vs. vertical).
Export Fidelity
Auto Layout spacing (gap, padding) maps cleanly to CSS Flexbox or Grid if the developer uses the same model. However, Figma's hug contents on a parent with fill container children creates a circular dependency that CSS resolves differently. When handing off, annotate frames with min-width/max-width or min-height/max-height constraints so the implementation doesn't collapse or overflow.
Performance in Large Libraries
Files with 500+ Auto Layout frames can lag during drag-resize. The symptom: selection handles appear, but child reflow stutters. Mitigate by converting rarely resized sections to static frames (disable Auto Layout) and using components with fixed sizing for leaf nodes like icons.
Concrete Validation: Button Component
Build a primary button that works at three widths: icon-only (32px), short label ("Save"), and long label ("Save and continue").
- Create a frame named
btn/primary. - Enable Auto Layout (right panel → Auto Layout). Set direction: horizontal, gap: 8px, padding: 12px 16px.
- Set frame sizing: Hug contents for both width and height.
- Add an icon component (24×24, fixed) and a text layer ("Label", fixed height, hug width).
- Select the text layer → constraints: Fill container width, Hug contents height.
- Test: drag the frame's right handle. Icon stays 24px, text expands, padding stays 16px each side.
- Duplicate → change label to "Save and continue". Frame widens, no manual adjustment.
- Duplicate → delete text layer. Frame collapses to 32px (icon + 16px padding × 2).
Verification checklist (run in Figma desktop or browser):
- Toggle Auto Layout off/on—children should snap to new positions without manual moves.
- Resize parent frame width from 80px to 400px—gap and padding remain constant, text reflows.
- Inspect the right panel:
Width: Hug contents,Height: Hug contents,Gap: 8,Padding: 12, 16. - Export prototype link, open on mobile and desktop—button retains internal spacing.
When to Avoid Auto Layout
- Absolute-positioned overlays (tooltips, dropdowns) that must escape the flow.
- Complex overlapping graphics where children need independent transforms.
- One-off marketing sections that never reuse or resize.
Limitations & Practical Check
Auto Layout does not support baseline alignment across sibling frames, nor does it expose justify-content: space-between when children have mixed fill container and hug contents sizing. Workaround: wrap the space-between group in its own horizontal Auto Layout frame with Fill container width.
To confirm a component behaves correctly across breakpoints, add the component to a frame with constraints Left & Right, then resize that frame from 320px to 1440px. Watch for text clipping, icon displacement, or padding collapse. If any occur, adjust the child's sizing mode or add min/max width annotations in the handoff notes.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.