Skip to main content
Smith_Samuel_D
Active Member
May 7, 2025
Solved

Auto Layout Grid - Column hug to content

  • May 7, 2025
  • 45 replies
  • 4823 views

Hello! 🤠

I was very excited to see the addition of Auto Layout Grid today! Having flexibility for both Rows and Columns at the same time is a game changer.

That said, I immediately ran into not being able to set a column width to “Hug” within a table, which is a bummer. In the attached video, I want the “Audited By” column to Hug to the longest table cell content. I show both the current solution today, and what I am trying to do with Auto Layout Grid.

I can manually adjust the width of the column, I guess, but as you can see, it makes it hard to ensure correct padding without a lot of careful tuning of the width.

 

Anyone have any solutions? Will this be coming as a fast-follow feature? Thank you!

Best answer by Smith_Samuel_D

UPDATE FOR EVERYONE: Figma has added this and MORE! 🎉

The update a few days ago added Hug AND “fr” (fractional) units to grids! This makes grid AWESOME! Thank you Figma for adding these features in!

https://www.figma.com/release-notes/?title=hug-and-fractional-units-for-grid

45 replies

Andrew Baxter
New Member
September 11, 2025

Samsies! I actually can’t use it as is. Love the way it snaps, auto grids - all great stuff. But it’s missing the most crucial of auto-layout hugging, so I can’t control the vertical spacing without manually pulling the frame heading into fractions.

October 2, 2025

This 👇 worked to set the row height to hug the tallest cell, which is more than Figma does by itself so THANK YOU!!

Limitation: the parent grid height stayed the same (highlighted in yellow)

​@Juan_Guzman Do you know if there’s an API workaround to set the parent grid to hug the row as well? Or am I missing a step?

 

This was the snippet I used:

// 1) Target the selected frame
const node = figma.currentPage.selection[0];

// 2) Make the first ROW hug its content
const rows = node.gridRowSizes;
rows[0].type = 'HUG'; // X = row-1. To hug 1st row: X = 1-1 = 0

// 3) Make the second COLUMN hug its content
const cols = node.gridColumnSizes;
cols[2].type = 'HUG'; // X = column-1. To hug 3rd column: X = 3-1 = 2

 

 

​@Nathan2 ​@Tina Wang 

Workaround: set Hug on Auto-layout Grid rows/columns via the Plugin API
 

I ran into the same issue where the UI doesn’t expose Hug for Grid rows/columns. I was able to reproduce it reliably using the Plugin API. Sharing my notes in case it helps someone else.

Prerequisites

  • Use the Figma desktop app (the plugin console isn’t available on the web).

  • Your layer must be a Frame with Auto layout → Grid.

Steps

  1. Open the file in the desktop app.

  2. Open the developer console: Right-click on canvas → Plugins → Development → Show/Hide console (see screenshots).

  3. Select the Frame that has Auto layout → Grid.

  4. In the console, paste one of the snippets below and run it.

    // 1) Target the selected frame
    const node = figma.currentPage.selection[0];

    // 2) Make the first ROW hug its content
    const rows = node.gridRowSizes;
    rows[0].type = 'HUG'; // 0 = first row, 1 = second, etc.

    // 3) Make the second COLUMN hug its content
    const cols = node.gridColumnSizes;
    cols[1].type = 'HUG'; // 1 = second column
  5. Adjust the index (0-based) to target the row/column you want.

  6. Done! The selected row/column will switch to Hug.

Notes & tips

  • Indexing is 0-based: 0 = first, 1 = second, etc.

  • You must re-assign gridRowSizes / gridColumnSizes to apply changes.

  • If you get “undefined” errors, the index you used doesn’t exist for that grid.

  • To undo, switch back to AUTO or FIXED (with a pixel value).

  • This is a workaround using the Plugin API; behavior could change as Figma evolves.


It’s a bit hacky, but it’s working great for me and makes Grid far more useful.
Cheers! 👋


Maybe I could create a little plugin to make this easier, let me know what you think. 😁

 
 
 
 

 

Juan_Guzman
New Participant
October 7, 2025

This 👇 worked to set the row height to hug the tallest cell, which is more than Figma does by itself so THANK YOU!!

Limitation: the parent grid height stayed the same (highlighted in yellow)

​@Juan_Guzman Do you know if there’s an API workaround to set the parent grid to hug the row as well? Or am I missing a step?

 

This was the snippet I used:

// 1) Target the selected frame
const node = figma.currentPage.selection[0];

// 2) Make the first ROW hug its content
const rows = node.gridRowSizes;
rows[0].type = 'HUG'; // X = row-1. To hug 1st row: X = 1-1 = 0

// 3) Make the second COLUMN hug its content
const cols = node.gridColumnSizes;
cols[2].type = 'HUG'; // X = column-1. To hug 3rd column: X = 3-1 = 2

 

No ​@TyT , for this case I don't have an alternative at the moment :(, but I'm glad the other one worked for you, it was very useful for me too

Smith_Samuel_D
Smith_Samuel_DAuthorAnswer
Active Member
December 8, 2025

UPDATE FOR EVERYONE: Figma has added this and MORE! 🎉

The update a few days ago added Hug AND “fr” (fractional) units to grids! This makes grid AWESOME! Thank you Figma for adding these features in!

https://www.figma.com/release-notes/?title=hug-and-fractional-units-for-grid

Claudio
New Member
December 10, 2025

The update a few days ago added Hug AND “fr” (fractional) units to grids! This makes grid AWESOME! Thank you Figma for adding these features in!
 

Fractional units are definitely a welcome addition, but what’s still missing is the ability to assign both the number of columns and the colspan to variables. Here’s why: we’ve defined our website breakpoints as modes so we can build master components that automatically adapt to the viewport (for example, a 50/50 layout that stacks on mobile). Right now, the only way to achieve this is by storing fixed column-width values for each breakpoint. It works, but it defeats the whole purpose of Figma’s new grid system. If we could instead assign variables directly to the grid, the component layout would adapt automatically based on the mode (breakpoint). This would make creating mockups across different breakpoints significantly faster and more efficient. 

If anyone at Figma would like to know more about my current setup, I’d be more than happy to help :)