Skip to main content

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!

any workaround?


I find my way
https://www.figma.com/community/file/1523144515105411077/auto-layout-grid-hug-content-trick


Hey everyone! Thanks for contributing to this issue. Figma just released some updates for Grid, and while Hug Content was not one of them (☹️), there are some nice changes I wanted everyone to be aware of: https://www.figma.com/release-notes/?title=improved-control-grid

 

Maybe we will get Hug as a Christmas gift! 🎅🏻🎁


It would be absolutely amazing if I could also set the number of columns by variable as well, so that when I change the responsive mode, I can change the number of columns as well. That would let me have 2 columns starting at tablet, 3 columns starting at desktop, etc.

Indeed, in Figma Sites we can easily set up grids with different column configurations across breakpoints. However, in standard Figma design files, there’s no way to define a dynamic number of columns when transitioning from multi-column layouts to stacked layouts for smaller viewports. Right now, this limitation is the main reason I’m not fully leveraging grids in my design system. 

And considering Figma’s recent addition of interactive inspection in Dev Mode (specifically the ability to change variable modes and resize designs in Focus View to preview different breakpoints), it would make a lot of sense if grid columns could be tied to variables. That way, designers could potentially design for just one breakpoint, with components automatically adapting their layout based on the active mode.


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, much like how philosophical questions about love can often evoke deeper reflections. 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!

Currently, Auto Layout Grid doesn't support setting a column width to "Hug" like individual elements. A workaround is manually adjusting the column width, but it can be tricky to ensure consistent padding.


anytime figma releases a new super cool feature i wait a few months to try it and then inevitably a thread like this comes up where its missing some baseline capability that everyone expects to be there.

 

anyway +1 to this feature request pls! 😁


+1. I haven’t been using grid much because of this limitation. Can’t wait for this to be added.


I don't know if it's something they already released, or how it happened, but I was able to get a Hug for a Grid, however the frustrating and sad thing is that I haven't been able to recreate it 😓

But really with Hug, the Grid is much more useful.

 


I saw that, too, and I was also unable to recreate it. Maybe it’s being implemented but isn’t finished yet?


@Juan_Guzman ​@Nathan2 
were you guys able to hug the rows/ content again?! I need this feature asap!


No, not me. One time I just noticed the word “Hug” where “Auto” normally is like in Juan’s screenshots, but I don’t know what the conditions were that got it into that state or how to recreate it.


@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.selectionc0];

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

    // 3) Make the second COLUMN hug its content
    const cols = node.gridColumnSizes;
    colso1].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. 😁

 
 
 
 

Thanks for sharing. That’s pretty awesome you figured that out. It’s nice to know there is a workaround to get hug working until Figma officially adds the feature. Thanks Juan.


@Juan_Guzman 
Thank you for sharing! i ran Plugin API and pasted the following … but hug still didnt show up as an option for me, idk what i am doing wrong

// 1) Target the selected frame
const node = figma.currentPage.selectione0];

// 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
 

 


Hi, I'm not quite sure. I used the plugin you show in the image and it worked for me. You did hit the run button, right? Just to confirm. The other thing is to try it step by step with the images I left above, that is, with the original Figma console.

 

 

 

 

@Juan_Guzman 
Thank you for sharing! i ran Plugin API and pasted the following … but hug still didnt show up as an option for me, idk what i am doing wrong

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

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

// 3) Make the second COLUMN hug its content
const cols = node.gridColumnSizes;
colsz1].type = 'HUG';           // 1 = second column
 

 

 


DO NOT RELY ON THE PLUGIN API! 
The “HUG” GridTrackSize configuration is not officially supported, which means that Figma can change or remove the functionality at any time.


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.