Deciding Auto Layout Constraints for Responsive Navigation Bars in Figma
Learn how to pick Auto Layout constraints for Figma components so they resize predictably without manual repositioning.
28 Apr 2026, 21:52 UTC

Decision: Choose the right Auto Layout constraint for a responsive navigation bar
You are building a navigation bar that must adapt to different container widths (e.g., a header that shrinks on mobile or expands on desktop). Manually repositioning each layer every time the frame changes is error‑prone and time‑consuming. The useful takeaway is that Auto Layout can handle the resizing automatically, but you must pick the right constraint type for each child to avoid overflow or unwanted stretching.
Supported constraint options
In Figma, Auto Layout offers four primary ways a child layer can respond when its parent frame changes size:
| Constraint | Behavior when parent resizes | Typical use case |
|---|---|---|
| Fixed | Child keeps its exact pixel distance from the selected parent edge (top, bottom, left, right) and does not scale. | Icons, logos, or spacing that must stay a constant offset from a border. |
| Hug contents | Child sizes to fit its own content plus any internal padding; it does not stretch to fill extra space. | Text labels, buttons where the width should grow only as long as the label. |
| Fill container | Child expands to occupy the available space along the axis, respecting any set min/max width. | Background fills, input fields that should stretch to the frame’s width. |
| Center | Child remains centered relative to the parent; its distance from each edge changes equally when the parent resizes. | Avatar or icon that should stay visually centered in a toolbar. |
Trade‑offs
- Fixed gives pixel‑perfect control but can cause overflow if the parent shrinks below the offset.
- Hug contents keeps the component compact, yet may leave unwanted gaps when the parent grows larger.
- Fill container ensures the layer uses all available space, but without a max width it can stretch unreasonably wide on large screens.
- Center maintains visual balance, yet the layer may appear too small or too large if the parent changes dramatically.
The best approach combines constraints: set the layer’s horizontal behavior to Fill container with a defined Max width, and vertical behavior to Hug contents (or Fixed) depending on whether you want the height to stay tight to the text.
Concrete implementation: a responsive navigation bar
- Create a frame (
⌥⌘G) that will become the navigation bar background. - Enable Auto Layout on the frame (
⌥⌘A). Set the direction toHorizontal, padding to16pxleft/right and12pxtop/bottom, and spacing to8pxbetween items. - Add three layers inside the frame: a logo (vector), a text label for the site name, and a hamburger icon (vector) for the mobile toggle.
- Select the logo layer; in the constraints panel set
LefttoFixed(16px) andTop/BottomtoFixed(12px). KeepRightasHug contentsso the logo does not stretch. - Select the site‑name text layer; set
LefttoHug contents,RighttoFill container, and define aMax widthof200px(prevents the label from becoming overly wide on large screens). Keep vertical constraintsFixed(12px) to maintain vertical padding. - Select the hamburger icon layer; set
RighttoFixed(16px) andTop/BottomtoFixed(12px). KeepLeftasHug contentsso the icon does not stretch. - Optional: add a
Min widthof260pxto the background frame so the navigation bar never collapses below a usable touch target. - Resize the parent frame horizontally and observe: the logo stays 16px from the left edge, the site‑name text expands to fill the remaining space up to 200px, the hamburger icon stays 16px from the right edge, and the background stretches accordingly.
Validation steps
- With the navigation bar selected, drag the parent frame’s right edge inward until the width is
200px. Verify that the logo remains fixed, the site‑name text truncates (if you enabled text truncation) or wraps, and the hamburger icon stays fixed. - Drag the parent frame outward to
800px. Confirm the site‑name text stops expanding at the200pxMax width and the background shows extra padding between the text and the hamburger icon. - Export the navigation bar as a PNG or SVG at two different scales (1x and 2x) and check that the layout proportions remain consistent.
Limitations and practical checks
Excessive nesting of Auto Layout frames can increase file size and slow canvas interaction, especially on low‑end machines. To mitigate:
- Keep the depth of nested Auto Layout groups under three levels where possible.
- Use
Resize to fiton the parent frame only when you need the container to shrink‑wrap its contents; otherwise, set explicit width/height to avoid unnecessary recalculations. - Periodically inspect the
Layerspanel for hidden overflow warnings (a small exclamation badge) after resizing.
If you notice unexpected clipping, select the offending layer and temporarily switch its constraint to Fixed to see whether the issue stems from a Fill or Hug setting.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.