Instance change size from nested component swap

I think resizing of nested instances should just work by default. The only time swapped in component instances should assume the size of the initial one is if those component frames are set to scale.

If I set the example logo/image components’ frame to be an auto-layout with the contents framed/grouped inside, then the swap will change the size in the surrounding component instance. But that doesn’t seem like something that is really supported, known, and reliable from the Figma team.

In addition to the example, there are component type situations that I’d like Figma to be able to handle, which it currently doesn’t—without using the auto-layout trick.

These could be constructed in different ways which should all be supported:

  1. Card component instance contains an instance of a logo. In an instance of the card, swapping one logo for another of a different size.
  2. Card component instance contains an instance of a component of logos of different sizes as variants. In a card instance, changing logo variants.
  3. Card component instance contains an instance of a component of logos as variants, which in turn have variants of different sizes. Changing the particular logo’s variants.

@Hoby_Van_Hoose_RO I’m having the same issue. Can you explain the auto-layout hack pls.

Auto-layout hack how to: Basically just make the component frame an auto-layout frame.

If your component frame contains multiple objects, then:

  1. Encapsulate those objects in a second frame
  2. Leave the inner frame as a fixed size
  3. Select the outer frame and add Auto Layout
  4. Zero out the space between items and padding fields

Now when you use that component inside of other components for swapping, its size and ratio will remain constant.


Thanks for the quick response. Ah it was creating that inner Frame around the object %:slight_smile: that confused things.

Sorry - it works for swapping items in the Master instance only.
The icon stays 16x16
But when I have a child instance (copy) swapping the icon reverts to 24x24.

Are you able to check this file and advise:

Yes, I just took a look at the file and I think I figured it out. When the nested component has overrides applied inside the surrounding component, swaps for that nested component will retain those overrides.

Your example appeared to have the chevron in there already reduced, so anything swapped into there with the hack would start out at its original size and get scaled down by the same amount.

To illustrate (thanks for making it editable):

  1. I created another “small” chevron component
  2. reset overrides in the placement in the Master
  3. then selected the small chevron
  4. then I made another child instance called “swapped” where in that instance I chose the original cheveron size

In that swapped instance the full size chevron is retaining its scale.

Or if I misunderstood your post and you want the opposite of the swapped components retaining their original scale, then apply the size override to the placement in the parent component. Then the swapped in components should resize by that amount, based on their original size.

That then doesn’t seem terribly different from the non-hack behavior of the swapped in component getting squished into the dimensions of the starting nested component (in the main component).

Thanks for looking at the file and providing instructions.

Correct to your 2nd response - I want the swapped component to get scaled.
For some reason it works in the Master component, but not an instance (duplicate of the master). I created a video of the issue in the child instance:

1 Like

The frame surrounding the cheveron was honoring the resize but the draw object was set to Center. I just set it to Scale and now it’s resizing in the child instance, too.

Wow Facepalm - that was a simple solution… :slight_smile:
Thanks for helping out. Cheers.

So many new features lately including additions to auto-layout—but no movement on this issue yet.

Still a problem and auto-layout is still the only method to counter it.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.