Component contents resets size when I change variant

I’ve created a component that contains a set of icons, where each icon is a variant.

I can create instances and resize the instances and that works well. But if I change the size of the instance and then change the variant, the icon itself reverts to it’s original size.

  1. Create an instance

    image

  2. Resize the instance

  3. Change to a different variant

Is there anything I can do to have the icon stay the same size even after I change variants?

Component scaling problem.penpot (541.6 KB)

For context, each variant consists of a board, which contains a group, which in turn contains an svg-path and a hidden background.

When changing variant, the board keeps it size while the svg-path and the background revert to their default sizes.

Hi,
If you place the icon in an autolayout container and set the icon to fill the container, you should be able to resize the container (and consequently resize the icon inside it) without any resets after switching between icon variations.
Component scaling problem_containerSolution.penpot (525.0 KB)

4 Likes

Thank you! That worked :grinning_face:

This also seems to be related to bug #12172, which was fixed in 2.11 :+1:

1 Like

It doesn’t work for me with the file ‘Component scaling problem_containerSolution.penpot’.
We can resize ‘iconContainer’ (even if the ratio is not preserved), but if we switch the ‘icon’ variant, the size is not preserved either…

You’re right. When I created the file, everything worked perfectly. Perhaps an update changed something. I noticed some strange behavior, which isn’t exactly a workaround, but it makes the process work!
The attached images contain a simple and short guide.

1 Like

OK, merci for the workaround :slightly_smiling_face:

The issue is still here. Is there a github issue I can track?

It seems this specific issue was resolved and I am no longer able to recreate it using the steps in my original post.

I have seen a similar issue occur in some more complex design (with nested components). But I have not been able to consistently reproduce it.

1 Like

Demo: Download rec-2026-09-02_12:01:00.mp4 | LimeWire
Also, guys. The app you are creating is awesome. But can I share the penpot file here as you denying it for new users? Very strange.

Hello @nobody, I double-checked our settings, and we don’t have a restriction on uploading a penpot file here. What happened when you tried to upload?

I get the “Sorry, new users can not upload attachments.” error.

issue demo.penpot (58.4 KB) – the file to demonstrate the issue

the issue screen recording (uploading just to check whether it is allowed now)

2 Likes

I don’t know if this could be helpful, but it seems that this issue happen with complex shape. I tried to create variants with basic shapes, like circles or rectangles, and everything seems to work fine. But yeah…it is an annoying thing.

2 Likes

I was about to post the same question. I am facing similar issue.

1 Like