Popular Searches
Popular Course Categories
Popular Courses

Hug Contents

Hug Contents

Auto Layout

Hug Contents in Figma

Hug Contents is one of the most important resizing behaviors in Figma Auto Layout. It allows an Auto Layout frame to automatically resize itself according to the size of its child content while maintaining the defined padding and spacing.

In simple words, Hug Contents means the container becomes only as large as necessary to contain its content. If the content becomes wider, taller, or changes in size, the Auto Layout frame can automatically grow or shrink to fit it.

Hug Contents is especially useful for buttons, badges, chips, tags, labels, navigation items, cards, notifications, dialogs, and reusable components whose dimensions should respond to their content.

In Figma, Hug Contents can be applied to Auto Layout frames. Width and height can use different resizing behaviors, so a component can have Fixed Width + Hug Height, Hug Width + Fixed Height, or Hug Width + Hug Height depending on the design requirement.

For professional Figma and UI/UX training, explore JustAcademy Figma Training and Register for Figma Course Demo.


1. What is Hug Contents in Figma?

Hug Contents is an Auto Layout resizing property that makes a frame resize around its child layers. The frame uses the smallest practical dimensions required to contain its content while respecting padding and spacing.

Content Changes

      ↓

Auto Layout Frame

      ↓

Hug Contents

      ↓

Frame Resizes Around Content

For example, if a button contains the text "Save", its width can be small enough to fit that text and its horizontal padding. If the text changes to "Save and Continue", the button can automatically become wider.

Short Text

+----------------+

|      Save      |

+----------------+

 

Long Text

+----------------------------+

|      Save and Continue     |

+----------------------------+


2. Simple Definition

Hug Contents: A Figma Auto Layout resizing behavior that makes a frame automatically adjust its dimensions according to the size of its child content while respecting padding and spacing.

Hug Contents

=

Size the frame around its content

 

Content grows

      ↓

Frame grows

 

Content shrinks

      ↓

Frame shrinks


3. Why is Hug Contents Important?

Modern interfaces contain many components whose dimensions depend on their content. Manually resizing these components every time the text or content changes is inefficient.

  • Automatically adapts to content.
  • Reduces manual resizing.
  • Creates responsive components.
  • Useful for dynamic text.
  • Useful for buttons.
  • Useful for badges.
  • Useful for chips and tags.
  • Useful for navigation items.
  • Useful for notifications.
  • Useful for reusable components.
  • Works naturally with Auto Layout.
  • Helps create scalable design systems.
  • Maintains defined padding around content.
  • Helps prevent unnecessary empty space.


4. Hug Contents and Auto Layout

Hug Contents is part of Figma's Auto Layout resizing system. Auto Layout automatically arranges child layers according to flow, spacing, padding, alignment, and resizing settings.

Auto Layout

|

+-- Flow

|   +-- Horizontal

|   +-- Vertical

|   +-- Grid

|

+-- Padding

|

+-- Gap

|

+-- Alignment

|

+-- Resizing

    |

    +-- Hug Contents

    +-- Fill Container

    +-- Fixed

    +-- Minimum

    +-- Maximum

Auto Layout can be added by selecting layers and pressing Shift + A. Once Auto Layout is applied, width and height resizing can be configured independently.


5. How Hug Contents Works

Hug Contents calculates the required size of the Auto Layout frame based on its child layers and the spacing around them.

Child Content

      +

Padding

      +

Gap / Spacing

      ↓

Required Frame Size

      ↓

Hug Contents

For example, if a text layer is 60px wide and the frame has 16px left padding and 16px right padding, the frame needs approximately 92px of width before considering other children or layout requirements.

Text Width = 60px

Left Padding = 16px

Right Padding = 16px

 

Frame Width

= 16 + 60 + 16

= 92px


6. Hug Width

Hug Width means the Auto Layout frame automatically adjusts its width according to its child content.

Width = Hug Contents

Height = Fixed

 

Content becomes wider

        ↓

Frame becomes wider

 

Content becomes narrower

        ↓

Frame becomes narrower

This is commonly used for buttons, badges, chips, tags, and compact navigation elements.


7. Hug Height

Hug Height means the Auto Layout frame automatically adjusts its height according to its child content.

Width = Fixed

Height = Hug Contents

 

Content becomes taller

        ↓

Frame becomes taller

This is particularly useful for cards, notifications, descriptions, messages, and content panels.


8. Hug Width + Hug Height

An Auto Layout frame can use Hug Contents on both axes.

Width = Hug Contents

Height = Hug Contents

In this configuration, the frame can adapt both horizontally and vertically according to its content.

Content Changes

      ↓

Width Changes

      +

Height Changes

      ↓

Container Adapts

This is useful for compact content-driven components such as badges, tags, labels, small cards, and notification bubbles.


9. Hug Width + Fixed Height

This combination allows the width to respond to content while the height remains controlled.

Button

Width  = Hug Contents

Height = Fixed 48px

This is one of the most common button patterns in professional UI design.

Short Label

+----------------+

|      Save      |

+----------------+

 

Long Label

+------------------------------+

|       Save and Continue      |

+------------------------------+

 

Height remains 48px.


10. Fixed Width + Hug Height

This pattern is useful when a component needs a controlled width but its vertical size should respond to content.

Notification

Width  = Fixed 360px

Height = Hug Contents

If the message becomes longer and wraps onto additional lines, the notification can grow vertically while maintaining its defined width.


11. Hug Contents vs Fixed

Hug Contents and Fixed have opposite purposes. Hug allows the container to adapt to its content, while Fixed maintains a defined dimension.

Hug ContentsFixed
Adapts to child contentMaintains a defined dimension
Content influences sizeDesigner controls size
Useful for dynamic componentsUseful for stable dimensions
Common for buttons and badgesCommon for icons and avatars
Can grow or shrinkDoes not automatically change its defined dimension


12. Hug Contents vs Fill Container

Hug Contents makes an Auto Layout frame fit its content, while Fill Container makes a child layer occupy available space inside its Auto Layout parent.

Hug Contents

Content

  ↓

Container sizes around content

 

Fill Container

Parent Space

  ↓

Child fills available space

PropertyBehaviorCommon Example
Hug ContentsSizes around contentButton
Fill ContainerUses available parent spaceInput
FixedMaintains defined dimensionIcon


13. Hug Contents vs Minimum Dimensions

Hug Contents determines the size based on child content, while minimum dimensions establish a lower boundary for resizing.

Hug:

Content determines size

 

Minimum:

Content can resize

but cannot become smaller

than the minimum value

Minimum dimensions can be combined with other resizing properties to prevent an element from becoming too small.


14. Hug Contents vs Maximum Dimensions

Maximum dimensions establish an upper boundary. Hug Contents can allow content-driven growth, while a maximum dimension can limit how far the component grows.

Content grows

      ↓

Hug Contents

      ↓

Maximum Width

      ↓

Growth stops at maximum

This pattern is useful for text-heavy cards, dialogs, content containers, and responsive sections.


15. Hug Contents and Padding

Padding is an important part of Hug Contents. The frame does not simply match the child dimensions; it also respects the padding defined around the child content.

+--------------------------+

|  Padding                 |

|   +------------------+   |

|   |     Content      |   |

|   +------------------+   |

|                 Padding  |

+--------------------------+

If content becomes larger, the frame grows while maintaining the defined padding.


16. Hug Contents and Horizontal Padding

Horizontal padding adds space to the left and right sides of the content.

Text Width = 100px

Left Padding = 20px

Right Padding = 20px

 

Hug Width

= 20 + 100 + 20

= 140px

This is particularly useful for buttons and badges where consistent horizontal spacing is required.


17. Hug Contents and Vertical Padding

Vertical padding adds space above and below the content.

Text Height = 20px

Top Padding = 12px

Bottom Padding = 12px

 

Hug Height

= 12 + 20 + 12

= 44px

This allows components to maintain comfortable internal spacing while adapting to their content.


18. Hug Contents and Gap

Gap controls the space between multiple child layers inside an Auto Layout frame. Hug Contents includes the required space occupied by those children and their gaps.

Child A

   ↓

Gap = 12px

   ↓

Child B

   ↓

Gap = 12px

   ↓

Child C

If a child changes size, the Hug Contents frame can update its overall dimensions while preserving the defined gaps.


19. Hug Contents with Multiple Children

A frame containing multiple children can use Hug Contents to calculate its required size around all of those children.

Card

|

+-- Icon

|

+-- Title

|

+-- Description

|

+-- Button

 

Height = Hug Contents

If the description becomes taller, the overall card can grow to accommodate it.


20. Hug Contents for Buttons

Buttons are one of the most important use cases for Hug Contents. A button label can change without requiring manual width adjustment.

Button

Width  = Hug Contents

Height = Fixed 48px

 

Label:

"Save"

After changing the label:

Button

Width  = Hug Contents

Height = Fixed 48px

 

Label:

"Save and Continue"

The button width can expand to accommodate the longer label while retaining the defined height.


21. Button with Icon + Text

Buttons containing both an icon and text can use Hug Contents to accommodate both elements.

Button

|

+-- Icon → Fixed 20px

|

+-- Gap → 8px

|

+-- Label → Hug

|

Frame Width → Hug Contents

Frame Height → Fixed

This creates a flexible button that maintains consistent internal spacing.


22. Hug Contents for Badges

Badges often need to grow according to their label.

Badge

Width  = Hug Contents

Height = Fixed 24px

 

"New"

 

      ↓

 

"New Feature"

The width changes according to the label while the height remains controlled.


23. Hug Contents for Tags

Tags and category labels are ideal candidates for Hug Contents.

Tag

|

+-- Label

|

+-- Padding

|

Width = Hug Contents

Height = Hug / Fixed

Longer category names can automatically produce wider tags.


24. Hug Contents for Chips

Chips can combine an icon, text, and close button while allowing the overall component to adapt to its content.

Chip

+--------------------------------+

| Icon | Text Label | Close      |

+--------------------------------+

 

Width = Hug Contents

This is useful for filters, selected categories, search tokens, and interactive controls.


25. Hug Contents for Navigation Items

Navigation items can use Hug Contents when their width should be determined by the label and icon.

Navigation Item

|

+-- Icon

+-- Gap

+-- Label

 

Width = Hug Contents

This allows different labels to occupy different widths without manually resizing each item.


26. Hug Contents for Cards

Cards can use Hug Height when the content length varies.

Card

Width  = Fixed 320px

Height = Hug Contents

 

|

+-- Title

+-- Description

+-- Actions

When the description becomes longer, the card can grow vertically while preserving its width.


27. Hug Contents for Notifications

Notifications are another excellent use case because message lengths can vary.

Notification

Width  = Fixed 360px

Height = Hug Contents

 

Message:

"Your profile has been updated."

If the message becomes longer, the notification can increase in height to accommodate the additional lines.


28. Hug Contents for Dialogs

Dialog content can use Hug Height so the dialog grows according to the amount of content.

Dialog

Width  = Fixed 480px

Height = Hug Contents

 

|

+-- Title

+-- Description

+-- Form

+-- Actions

This avoids unnecessary empty vertical space when the content is short.


29. Hug Contents for Tooltips

Tooltips are often content-driven components. Their width can hug the text while padding maintains readable spacing.

Tooltip

Width  = Hug Contents

Height = Hug Contents

 

Text:

"Click to edit"

Longer tooltip messages can create a wider or taller tooltip depending on the text resizing configuration.


30. Hug Contents for Dropdown Items

Dropdown items can use Hug Contents when their dimensions depend on the label and optional icons.

Dropdown Item

|

+-- Icon

+-- Label

+-- Optional Shortcut

 

Width = Hug Contents


31. Hug Contents for Form Sections

Form sections can use Hug Height when their number of fields or content changes.

Form Section

Width  = Fill / Fixed

Height = Hug Contents

 

|

+-- Heading

+-- Email

+-- Password

+-- Checkbox

+-- Button

If another field is added, the section can grow automatically.


32. Hug Contents for Vertical Auto Layout

Vertical Auto Layout is commonly used for content stacks such as forms, cards, lists, and sections. Hug Height allows the frame to grow as children are added or resized.

Vertical Auto Layout

|

+-- Heading

|

+-- Description

|

+-- Input

|

+-- Button

 

Height = Hug Contents


33. Hug Contents for Horizontal Auto Layout

Horizontal Auto Layout is useful for rows of buttons, navigation items, toolbars, and compact components.

Horizontal Auto Layout

|

+-- Icon

+-- Label

+-- Action

 

Width = Hug Contents

The frame can adapt to the combined width of its children and the defined spacing.


34. Hug Contents and Grid Auto Layout

Hug Contents can also be used with grid Auto Layout. A grid frame or track can use content-driven sizing where appropriate.

Grid

+----------+----------+

| Content  | Content  |

+----------+----------+

| Content  | Content  |

+----------+----------+

 

Hug sizing

      ↓

Content influences size

For grid layouts, always consider whether a content-driven dimension or a controlled track size is more appropriate.


35. How to Apply Hug Contents

  1. Select an Auto Layout frame.
  2. Open the Design panel on the right.
  3. Locate the Width or Height resizing control.
  4. Select Hug contents for the required axis.
  5. Adjust padding if necessary.
  6. Adjust gap between children if necessary.
  7. Change the child content.
  8. Observe the frame automatically resize.

Select Auto Layout Frame

        ↓

Open Design Panel

        ↓

Find Width / Height

        ↓

Select Hug Contents

        ↓

Change Content

        ↓

Frame Resizes Automatically


36. Quick Method to Set Hug Contents

Figma also provides a convenient canvas interaction for setting Hug Contents. Double-clicking the horizontal or vertical edge of an Auto Layout object's bounding box can set that axis to Hug Contents.

Auto Layout Frame

      ↓

Double-click Edge

      ↓

Hug Contents


37. Hug Contents on Width Only

Sometimes only width should respond to content.

Width  = Hug Contents

Height = Fixed 40px

This is useful for labels, badges, chips, and buttons.


38. Hug Contents on Height Only

Sometimes only height should respond to content.

Width  = Fixed 320px

Height = Hug Contents

This is useful for notifications, cards, descriptions, and content sections.


39. Hug Contents on Both Axes

When both dimensions should respond to content, use Hug Contents on both axes.

Width  = Hug Contents

Height = Hug Contents

This works well for small content-driven components such as tooltips, tags, badges, and compact labels.


40. Hug Contents and Child Text

Text is one of the most common reasons an Auto Layout frame needs Hug Contents.

Frame

|

+-- Text

 

Text changes

      ↓

Text dimensions change

      ↓

Hug frame responds

For example, changing "Login" to "Continue with Google" can increase the width of a Hug button.


41. Hug Contents and Text Wrapping

Hug Contents should be used carefully with text that can wrap. A text layer's resizing behavior affects how its parent responds.

Short Text

      ↓

One Line

      ↓

Small Height

 

Long Text

      ↓

Multiple Lines

      ↓

Greater Height

      ↓

Hug Parent

This makes Hug Height particularly useful for text-heavy cards and messages.


42. Hug Contents and Long Text

Long text should be tested to make sure the component grows in the intended direction.

Short Description

      ↓

Small Card

 

Long Description

      ↓

More Lines

      ↓

Hug Height

      ↓

Taller Card

Always check the text resizing mode and the parent's width before deciding how Hug Contents should behave.


43. Hug Contents and Padding Changes

Changing padding changes the size of a Hug Contents frame because the frame must include both content and padding.

Content = 100px

Padding = 16px each side

 

Before:

100 + 16 + 16 = 132px

 

Increase Padding:

100 + 24 + 24 = 148px

The content did not change, but the Hug frame became larger because its padding changed.


44. Hug Contents and Gap Changes

When a frame contains multiple children, changing the gap can change the overall size of the Hug Contents frame.

Child A = 80px

Gap = 16px

Child B = 100px

 

Total Width

= 80 + 16 + 100

= 196px

Increasing the gap to 24px increases the required width accordingly.


45. Hug Contents and Alignment

Alignment controls how child layers are positioned inside the Auto Layout frame. Hug Contents can reduce the amount of extra space available, but alignment still matters when other dimensions or children create available space.

Alignment

|

+-- Start

+-- Center

+-- End

+-- Stretch

Choose alignment based on the intended visual behavior of the component.


46. Hug Contents and Nested Auto Layout

Nested Auto Layout is one of the most powerful ways to use Hug Contents.

Page

|

+-- Card

    |

    +-- Header

    |   |

    |   +-- Icon

    |   +-- Title

    |

    +-- Content

    |   |

    |   +-- Description

    |

    +-- Actions

        |

        +-- Button

Each nested frame can have its own resizing behavior, allowing complex components to respond correctly to content changes.


47. Hug Parent + Hug Child

A parent and child can both use Hug Contents when the entire component should adapt naturally to its content.

Parent

Width = Hug

Height = Hug

 

    ↓

 

Child

Width = Hug

Height = Hug

This is useful for compact components where no specific fixed dimension is required.


48. Hug Parent + Fill Child

A parent using Hug Contents generally needs to be considered carefully when a child uses Fill Container. Fill requires available parent space, while Hug attempts to size the parent around its contents.

Parent = Hug

      ↓

Child = Fill

      ↓

Potential sizing conflict

In particular, Figma notes that if a child inside an Auto Layout frame is set to Fill Container on an axis, the parent can no longer Hug on that axis and becomes Fixed for that axis.


49. Hug Parent + Fixed Child

A parent can Hug around a child with a fixed dimension.

Parent

Width = Hug

 

Child

Width = Fixed 200px

 

Result:

Parent sizes around the 200px child

plus padding.


50. Multiple Hug Children

A parent can contain several content-driven children.

Toolbar

|

+-- Icon → Fixed

+-- Search → Hug

+-- Button → Hug

+-- Profile → Fixed

 

Parent Width = Hug

The overall width can respond to the combined requirements of its children and spacing.


51. Hug Contents for Toolbars

Toolbars often contain icons, labels, and actions. Hug Contents can make compact toolbars adapt to the content they contain.

Toolbar

|

+-- Icon

+-- Label

+-- Action

 

Width = Hug Contents

Height = Fixed


52. Hug Contents for Search Controls

A compact search control can use Hug Contents when its width is intended to be content-driven.

Search Control

|

+-- Search Icon

+-- Search Text

+-- Clear Icon

 

Width = Hug Contents

For full-width search bars, Fill Container is generally more appropriate.


53. Hug Contents for Profile Controls

Profile controls containing an avatar and username can use Hug Contents when the control should grow with the username.

Profile

|

+-- Avatar → Fixed 40px

+-- Name → Hug

+-- Chevron → Fixed 16px

 

Container Width = Hug


54. Hug Contents for Breadcrumbs

Breadcrumbs are naturally content-driven because different pages can have different label lengths.

Home

  /

Products

  /

Electronics

  /

Laptops

 

Breadcrumb Width = Hug Contents

This allows the breadcrumb component to adapt to its labels.


55. Hug Contents for Tabs

Individual tabs can use Hug Contents when each tab should size itself around its label.

Tabs

|

+-- Overview → Hug

+-- Reviews → Hug

+-- Specifications → Hug

+-- Pricing → Hug

Padding can be used to create consistent visual spacing around each label.


56. Hug Contents for Pagination Controls

Pagination buttons can use Hug Contents when the controls contain different labels or icons.

Pagination

|

+-- Previous → Hug

+-- 1 → Fixed / Hug

+-- 2 → Fixed / Hug

+-- Next → Hug


57. Hug Contents for Status Labels

Status labels such as Active, Pending, Completed, and Failed can use Hug Contents.

Status Badge

Width = Hug Contents

Height = Fixed 28px

 

"Active"

"Pending"

"Completed"

Each label can have a different width while maintaining the same height.


58. Hug Contents for Price Labels

Price components can use Hug Contents when the displayed price varies in length.

Price

|

+-- Currency

+-- Amount

+-- Optional Period

 

Width = Hug Contents


59. Hug Contents for Product Information

Product information sections can use Hug Height when descriptions, specifications, or labels change.

Product Info

Width  = Fill / Fixed

Height = Hug Contents

 

|

+-- Product Name

+-- Rating

+-- Description

+-- Price

+-- Availability


60. Hug Contents for Social Media Posts

Social media cards are frequently content-driven. A post can grow vertically as the text, comments, or metadata changes.

Social Post

Width  = Fill Container

Height = Hug Contents

 

|

+-- Profile

+-- Text

+-- Image

+-- Actions

+-- Comments

This creates a flexible structure for dynamic content.


61. Hug Contents for Comments

Comment components can use Hug Height to accommodate different message lengths.

Comment

Width  = Fill Container

Height = Hug Contents

 

|

+-- Avatar

+-- Username

+-- Message

+-- Actions


62. Hug Contents for Chat Messages

Chat bubbles are a classic example of content-driven sizing.

Chat Bubble

Width  = Hug Contents

Height = Hug Contents

 

"Hello!"

 

      ↓

 

"Hello! How are you doing today?"

The bubble can adapt to the message while maintaining its internal padding.


63. Hug Contents for Error Messages

Error messages often vary in length and therefore benefit from Hug Height.

Error Container

Width  = Fill / Fixed

Height = Hug Contents

 

Message:

"Please enter a valid email address."


64. Hug Contents for Success Messages

Success notifications can similarly use content-driven height.

Success Message

Width  = Fixed / Fill

Height = Hug Contents

 

Icon + Message


65. Hug Contents for Dropdown Menus

A dropdown menu can use Hug Height when the number of menu items changes.

Dropdown

Width  = Fixed / Hug

Height = Hug Contents

 

|

+-- Item

+-- Item

+-- Item

+-- Item

Adding another item can increase the menu height automatically.


66. Hug Contents for Lists

Lists are often created using vertical Auto Layout with Hug Height.

List

Width  = Fill Container

Height = Hug Contents

 

|

+-- Item 1

+-- Item 2

+-- Item 3

+-- Item 4

Adding or removing list items changes the overall height of the list.


67. Hug Contents for Forms

A form container can use Hug Height to grow as fields are added.

Form

Width  = Fill / Fixed

Height = Hug Contents

 

|

+-- Name

+-- Email

+-- Password

+-- Confirm Password

+-- Submit


68. Hug Contents for Accordions

Accordion content can use Hug Height because opening a section adds content vertically.

Accordion

|

+-- Question

+-- Answer

 

Closed:

Height = Small

 

Opened:

Height = Hug Contents

This is useful for FAQs, settings, documentation, and help sections.


69. Hug Contents for FAQ Sections

FAQ items can use vertical Auto Layout and Hug Height so that answers of different lengths are accommodated automatically.

FAQ Item

Width  = Fill Container

Height = Hug Contents

 

|

+-- Question

+-- Answer


70. Hug Contents for Design System Components

Hug Contents is highly valuable in design systems because components often need to support different labels while maintaining consistent padding, typography, and spacing.

Design System

|

+-- Button → Hug Width

+-- Badge → Hug Width

+-- Chip → Hug Width

+-- Tooltip → Hug Width + Height

+-- Card → Hug Height

+-- Notification → Hug Height


71. Hug Contents and Component Variants

Component variants can share the same Hug behavior while changing text, icon, size, or state.

VariantWidthHeight
Small ButtonHugFixed 36px
Medium ButtonHugFixed 44px
Large ButtonHugFixed 52px
BadgeHugFixed
TooltipHugHug


72. Hug Contents and Responsive Design

Hug Contents does not mean that the entire interface becomes fixed or non-responsive. It is one part of a responsive sizing strategy.

Responsive Component

|

+-- Icon → Fixed

+-- Label → Hug

+-- Search → Fill

+-- Button → Hug

+-- Container → Fill / Hug

Professional interfaces usually combine different resizing behaviors rather than using one property everywhere.


73. Hug Contents and Fixed Dimensions Together

Fixed and Hug can be combined on different axes.

Notification

Width  = Fixed 360px

Height = Hug Contents

This creates a stable width while allowing the component to grow vertically according to its message.


74. Hug Contents and Fill Container Together

Hug and Fill can be used together in nested layouts.

Header

|

+-- Logo → Fixed

+-- Navigation → Fill

+-- Profile → Hug

The flexible navigation area uses available space while the profile control sizes itself around its content.


75. Hug Contents and Minimum Width

A component may need to hug its content while also maintaining a minimum usable width.

Button

Width = Hug Contents

Minimum Width = 100px

This prevents very short labels from creating an excessively small button.


76. Hug Contents and Maximum Width

Maximum dimensions can limit how far a content-driven component grows.

Card

Width = Hug Contents

Maximum Width = 400px

This can be useful when content should adapt naturally but should not create an excessively wide component.


77. Hug Contents and Spacing System

Hug Contents works particularly well with a consistent spacing system.

Spacing Tokens

4px

8px

12px

16px

24px

32px

 

Component

Padding = 16px

Gap = 8px

Width = Hug Contents

Using consistent spacing creates predictable and reusable components.


78. Common Mistake: Using Fixed Instead of Hug

A common mistake is manually setting a button width when the button should actually adapt to its label.

Incorrect:

Button Width = Fixed 100px

 

Label:

"Save and Continue"

 

Problem:

Text may require more space.

A better solution may be:

Button

Width  = Hug Contents

Height = Fixed


79. Common Mistake: Hugging the Wrong Axis

Sometimes only one axis needs to respond to content.

Requirement:

Width should remain controlled

Height should grow

 

Correct:

Width  = Fixed

Height = Hug

Do not automatically apply Hug to both dimensions without considering the intended layout.


80. Common Mistake: Ignoring Padding

When a Hug component looks larger than expected, check its padding before changing the width manually.

Unexpected Width

      ↓

Check Content

      ↓

Check Left Padding

      ↓

Check Right Padding

      ↓

Check Gap

      ↓

Check Result


81. Common Mistake: Excessive Padding

Very large padding can make a Hug component unnecessarily large.

Content = 100px

Padding = 40px + 40px

 

Total = 180px

If the component looks too large, adjust the spacing rather than converting the frame to Fixed without understanding the cause.


82. Common Mistake: Using Hug for Full-Width Elements

Hug is usually not the best choice when an element is expected to occupy all available parent space.

Requirement:

Input should fill screen width

 

Better:

Width = Fill Container

Height = Fixed

Using Hug in this situation may make the input only as wide as its content.


83. Common Mistake: Ignoring Text Resizing

If a Hug parent does not grow as expected, inspect the text layer's resizing behavior.

Parent = Hug

      ↓

Text Layer

      ↓

Check Text Resizing

      ↓

Check Width

      ↓

Check Height

      ↓

Test Long Content


84. Common Mistake: Mixing Hug and Fill Incorrectly

Hug and Fill serve different purposes. Hug wants the container to fit its content, while Fill requires available parent space.

Hug

Content → Container

 

Fill

Parent Space → Child

When the two are combined incorrectly, the layout can behave differently than expected. Check the parent-child relationship and the axis being used.


85. Best Practices for Hug Contents

  • Use Hug for content-driven components.
  • Use Hug Width for dynamic labels and buttons.
  • Use Hug Height for cards and content sections.
  • Use Fixed Height with Hug Width for buttons.
  • Use Fixed Width with Hug Height for notifications.
  • Use consistent padding with Hug components.
  • Use consistent gaps between child layers.
  • Test short and long content.
  • Test multiple languages when designing international products.
  • Check text resizing behavior.
  • Use Fill Container when the element should occupy available space.
  • Use Fixed when a dimension must remain stable.
  • Use minimum and maximum dimensions when boundaries are required.
  • Avoid manually resizing a component that should be content-driven.
  • Build reusable components using consistent Hug behavior.


86. When Should You Use Hug Contents?

ComponentRecommended Hug Usage
ButtonHug Width + Fixed Height
BadgeHug Width + Fixed Height
ChipHug Width
TooltipHug Width / Hug Height
NotificationFixed Width + Hug Height
CardFixed/Fill Width + Hug Height
ListFill Width + Hug Height
FormFill Width + Hug Height
Navigation ItemHug Width
Chat BubbleHug Width + Hug Height


87. Hug Contents Decision Guide

Should the element fit its content?

        |

       Yes

        ↓

Use Hug Contents

 

Should the element maintain a defined size?

        |

       Yes

        ↓

Use Fixed

 

Should the child use all available parent space?

        |

       Yes

        ↓

Use Fill Container

 

Should the element adapt but stay within limits?

        |

       Yes

        ↓

Use Hug + Min/Max


88. Practical Project: Responsive Button

Create a reusable button that automatically adapts to different labels.

Button

|

+-- Text

|

Width  = Hug Contents

Height = Fixed 48px

Padding Left  = 20px

Padding Right = 20px

Test these labels:

Save

Save Changes

Save and Continue

Continue to Checkout

The button should grow horizontally while maintaining its intended height and padding.


89. Practical Project: Status Badge

Status Badge

|

+-- Status Dot

+-- Label

 

Width  = Hug Contents

Height = Fixed 28px

Gap    = 8px

Test labels such as Active, Pending, Completed, and In Progress.


90. Practical Project: Notification Card

Notification

Width  = Fixed 360px

Height = Hug Contents

 

|

+-- Icon → Fixed

+-- Content → Fill

|   +-- Title

|   +-- Message

|

+-- Close → Fixed

Change the message length and verify that the notification grows vertically.


91. Practical Project: Product Card

Product Card

Width  = Fixed 280px

Height = Hug Contents

 

|

+-- Image → Fixed / Ratio

+-- Product Name → Fill

+-- Description → Hug

+-- Price → Hug

+-- Button → Fill / Hug

Add a longer description and verify that the card height adjusts automatically.


92. Practical Project: Profile Component

Profile

|

+-- Avatar → Fixed 40px

+-- Name → Hug

+-- Role → Hug

 

Container

Width = Hug Contents

Height = Hug Contents

Test the component with short and long names.


93. Practical Project: Chat Bubble

Chat Bubble

Width  = Hug Contents

Height = Hug Contents

Padding = 12px

 

Short:

"Hi!"

 

Long:

"Hi! How are you doing today?"

Test multiple messages and verify that the bubble adapts without unnecessary empty space.


94. Practical Project: FAQ Component

FAQ

Width  = Fill Container

Height = Hug Contents

 

|

+-- Question

+-- Answer

Expand and collapse the answer content and observe how the parent frame changes height.


95. Debugging Hug Contents

If Hug Contents is not behaving as expected, inspect the following properties.

  1. Select the Auto Layout frame.
  2. Check whether Auto Layout is enabled.
  3. Check the Width resizing property.
  4. Check the Height resizing property.
  5. Check child layer dimensions.
  6. Check text resizing behavior.
  7. Check horizontal and vertical padding.
  8. Check gap between children.
  9. Check alignment.
  10. Check whether any child uses Fill Container.
  11. Check minimum dimensions.
  12. Check maximum dimensions.
  13. Test with different content.


96. Hug Contents Debugging Flow

Frame Not Resizing

       ↓

Is Auto Layout Enabled?

       |

      Yes

       ↓

Check Width Resizing

       ↓

Check Height Resizing

       ↓

Is Axis Set to Hug?

       |

      Yes

       ↓

Check Child Size

       ↓

Check Text Resizing

       ↓

Check Padding

       ↓

Check Gap

       ↓

Check Fill Children

       ↓

Check Min / Max

       ↓

Test Again


97. Hug Contents and Developer Handoff

Hug Contents communicates an important design intention to developers: the component should generally size itself around its content rather than relying on an arbitrary fixed dimension.

Figma

Width = Hug Contents

      ↓

Content-driven component

      ↓

Developer implementation

      ↓

Flexible component sizing

For example, a button that hugs its content can often be implemented using CSS with intrinsic sizing rather than a hard-coded width.

.button {

  display: inline-flex;

  width: fit-content;

}

The exact implementation depends on the application's layout system and responsive requirements.


98. Hug Contents and CSS

On the web, Hug Contents is conceptually similar to intrinsic sizing, where an element takes the space required by its content.

.button {

  width: fit-content;

  padding: 12px 20px;

}

This is conceptually similar to a Figma button using Hug Width with padding.


99. Hug Contents and Responsive CSS

Responsive interfaces frequently combine content-driven sizing with flexible sizing.

.button {

  width: fit-content;

}

 

.input {

  width: 100%;

  height: 48px;

}

 

.card {

  width: 100%;

  max-width: 400px;

}

The Figma equivalents can involve Hug, Fill Container, Fixed, and Maximum dimensions depending on the design.


100. Hug Contents in Design Systems

Design systems benefit greatly from Hug Contents because reusable components must support different labels and content lengths without requiring manual resizing.

Design System

|

+-- Buttons → Hug Width

+-- Badges → Hug Width

+-- Chips → Hug Width

+-- Tooltips → Hug

+-- Cards → Hug Height

+-- Notifications → Hug Height

+-- Navigation Items → Hug Width


101. Hug Contents and Internationalization

Internationalization is an important reason to use content-driven sizing. The same label can be significantly longer in another language.

English:

"Save"

 

Longer Language:

"Save Changes"

 

Another Language:

Longer Text

 

      ↓

Hug Width

      ↓

Component adapts

Testing longer labels helps prevent text clipping and layout problems.


102. Hug Contents and Accessibility

Content-driven sizing can support accessibility by allowing components to accommodate longer labels and text. Designers should still test larger text settings, long content, and different interaction states.

Accessible Content

      ↓

Longer Text

      ↓

Hug / Responsive Layout

      ↓

Better Space Adaptation


103. Hug Contents and Localization Testing

When designing multilingual applications, test labels that are substantially longer than the original content.

Normal Label

      ↓

Long Label

      ↓

Translated Label

      ↓

Check Hug Behavior

      ↓

Check Parent Layout

      ↓

Check Overflow


104. Hug Contents and Component States

Different component states can have different content lengths.

Button States

 

Default:

"Submit"

 

Loading:

"Submitting..."

 

Success:

"Submitted Successfully"

 

Width = Hug Contents

Hug Width allows each state to accommodate its label when the design requires content-driven width.


105. Hug Contents and Icons

Icons can remain fixed while the surrounding component hugs the combined content.

Button

|

+-- Icon → Fixed 20px

+-- Gap → 8px

+-- Text → Hug

 

Button Width = Hug Contents

This is a common professional component pattern.


106. Hug Contents and Close Buttons

Chips, alerts, notifications, and tags can include a fixed close icon while the outer frame hugs the total content.

Chip

|

+-- Label → Hug

+-- Gap → 8px

+-- Close Icon → Fixed 16px

 

Outer Frame = Hug Contents


107. Hug Contents and Auto Gap

Auto spacing can distribute available space in some Auto Layout configurations. When Hug Contents removes excess space on an axis, the visible effect of alignment and auto gap can differ from a fixed-size container.

Auto Layout

|

+-- Child

+-- Auto Gap

+-- Child

 

Hug

↓

Container fits content

↓

Less extra space available

Use a specific gap when predictable spacing between children is required.


108. Hug Contents and Absolute Positioning

Objects using absolute positioning inside an Auto Layout frame do not participate in the normal Auto Layout flow in the same way as regular children. This can affect how sizing relationships behave.

Auto Layout Parent

|

+-- Normal Child → Participates

|

+-- Absolute Child → Ignores Flow

If a Hug component behaves unexpectedly, check whether any child is positioned absolutely.


109. Hug Contents and Nested Components

Reusable components can contain multiple levels of Auto Layout, with each level using the resizing behavior appropriate to its role.

Button Component

|

+-- Outer Frame → Hug

    |

    +-- Icon → Fixed

    |

    +-- Content → Hug

        |

        +-- Label → Hug

This creates a component that can respond naturally to changes in its label and optional content.


110. Hug Contents Quick Comparison

FeatureHug ContentsFixedFill Container
Content-driven sizeYesNoNo
Defined dimensionNot necessarilyYesNo
Uses available parent spaceNoNoYes
Good for buttonsYesSometimesSometimes
Good for badgesYesSometimesNo
Good for iconsNoYesNo
Good for full-width inputsNoSometimesYes
Good for dynamic cardsYesSometimesYes


111. Fixed vs Hug vs Fill Decision Table

RequirementBest Choice
Keep exact icon sizeFixed
Button grows with labelHug
Input fills parent widthFill Container
Notification grows verticallyHug Height
Sidebar remains 280pxFixed Width
Full-width buttonFill Width + Fixed Height
Dynamic badgeHug Width
Content card with variable textHug Height


112. Interview Questions

Q1. What is Hug Contents in Figma?

Hug Contents is an Auto Layout resizing behavior that allows a frame to resize around its child content while respecting padding and spacing.

Q2. Can Hug Contents be applied to any layer?

Hug Contents is a resizing property for Auto Layout frames. It is not the same as simply assigning a fixed size to a regular layer.

Q3. What is Hug Width?

Hug Width allows an Auto Layout frame to adjust its width according to its child content.

Q4. What is Hug Height?

Hug Height allows an Auto Layout frame to adjust its height according to its child content.

Q5. Can width and height use different resizing properties?

Yes. Width and height are independent. For example, Width can be Hug while Height is Fixed.

Q6. What is the difference between Hug and Fixed?

Hug adapts to content, while Fixed maintains a defined dimension.

Q7. What is the difference between Hug and Fill Container?

Hug sizes a frame around its content, while Fill Container allows a child layer to occupy available space inside its Auto Layout parent.

Q8. Why is Hug Contents useful for buttons?

It allows button width to adapt automatically when the label changes.

Q9. Can Hug Contents be combined with Fixed?

Yes. For example, a button can use Hug Width and Fixed Height.

Q10. Can Hug Contents be combined with Fill Container?

Yes, different nested elements can use different resizing behaviors. The exact behavior depends on their parent-child Auto Layout relationship.

Q11. How does padding affect Hug Contents?

Padding contributes to the frame's required size, so increasing padding increases the Hug frame dimensions.

Q12. How does gap affect Hug Contents?

Gap contributes to the total space required between child layers and therefore can affect the overall size of a Hug frame.

Q13. Why might a Hug frame not resize as expected?

Possible causes include incorrect child resizing, text settings, padding, gap, Fill Container children, minimum or maximum dimensions, or absolute positioning.

Q14. Is Hug Contents useful in responsive design?

Yes. It is commonly combined with Fixed and Fill Container to create responsive and content-aware components.


113. Practice Checklist

  • Create an Auto Layout frame.
  • Apply Hug Width.
  • Apply Hug Height.
  • Apply Hug Width and Hug Height.
  • Create a button using Hug Width.
  • Create a button with Hug Width and Fixed Height.
  • Create a dynamic badge.
  • Create a dynamic chip.
  • Create a tooltip using Hug Contents.
  • Create a notification with Fixed Width and Hug Height.
  • Create a card with Hug Height.
  • Change text and observe resizing.
  • Change padding and observe resizing.
  • Change gap and observe resizing.
  • Test long text.
  • Test short text.
  • Test multiple languages.
  • Combine Hug with Fixed.
  • Combine Hug with Fill.
  • Test minimum dimensions.
  • Test maximum dimensions.
  • Create nested Auto Layout components.
  • Create a reusable button component.
  • Create a responsive notification.
  • Create a responsive form.


114. Quick Revision Notes

ConceptQuick Meaning
Hug ContentsFrame adapts to child content
Hug WidthWidth adapts to content
Hug HeightHeight adapts to content
FixedMaintains defined dimension
Fill ContainerUses available parent space
PaddingSpace between content and parent edges
GapSpace between Auto Layout children
Auto LayoutAutomatically arranges and resizes layout elements
MinimumLower size boundary
MaximumUpper size boundary


115. Key Takeaways

  • Hug Contents is an Auto Layout resizing property.
  • It allows a frame to resize according to its child content.
  • Hug Width controls content-driven width.
  • Hug Height controls content-driven height.
  • Width and height can use different resizing behaviors.
  • Hug Contents respects padding and spacing.
  • Hug is especially useful for buttons, badges, chips, and labels.
  • Hug Height is useful for cards, notifications, lists, and forms.
  • Hug can be combined with Fixed sizing.
  • Hug can be combined with Fill Container in appropriate nested layouts.
  • Fixed is best when a dimension must remain stable.
  • Fill Container is best when a child should use available parent space.
  • Long text should always be tested with Hug components.
  • Padding and gap can affect the final Hug dimensions.
  • Minimum and maximum dimensions can provide additional size boundaries.
  • Hug Contents is an important part of responsive Figma design.
  • Design systems benefit from reusable components with predictable Hug behavior.


116. Conclusion

Hug Contents is a fundamental Figma Auto Layout concept that allows frames and components to adapt naturally to their content. Instead of manually changing dimensions every time a label, message, description, or child element changes, Hug Contents allows the container to resize around its content while maintaining its defined padding and spacing.

Hug Contents is especially useful for buttons, badges, chips, tags, tooltips, navigation items, notifications, cards, forms, chat bubbles, dialogs, and reusable design-system components. It becomes even more powerful when combined with Fixed and Fill Container resizing behaviors.

The most important concept to remember is: Hug Contents makes an Auto Layout frame adapt to its content, Fixed keeps a dimension controlled, and Fill Container allows a child to use the available space provided by its parent.

For professional Figma and UI/UX training, visit JustAcademy Figma Training and Register for Figma Course Demo.

whatsapp