Skip to main content
Question

Flexible nested component (width & height)

  • January 12, 2026
  • 0 replies
  • 5 views

Snizhana

Maybe there’s a workaround I’m not aware of — any help would be appreciated.

I’m trying to create a card component with text and an image. The tricky part is the image: it should be flexible and support different aspect ratios across component instances.

In the main component, I use an image placeholder for the visual. However, when I swap that placeholder with a real image in an instance, the image always conforms to the placeholder’s dimensions instead of preserving its original size/aspect ratio. I tried different auto-layout options but nothing worked.

I’m looking for a way to build this so that the image resizes based on the card dimensions and it’s own aspect ratio, rather than forcing all images into the same fixed size.

 

Another possible solution (and probably a better one) would be for the image to always fill the card width, while the height adjusts automatically based on the image’s original aspect ratio. Is something like that achievable with components and Auto Layout?

 

Here’s a Figma if you’d like to check it out: 

 

Thank you in advance!