Skip to main content
Question

Vertical layout mode and layout align stretch

  • December 7, 2022
  • 1 reply
  • 570 views

Aric_Jiang

I have a FrameNode that is set like this:

  const formFrame = figma.createFrame();
  formFrame.layoutMode = 'VERTICAL';
  formFrame.layoutAlign = 'STRETCH';
  formFrame.counterAxisSizingMode = 'FIXED';
  formFrame.primaryAxisSizingMode = 'FIXED'
  formFrame.itemSpacing = 100;
  formFrame.verticalPadding = 64;
  formFrame.resize(592, baseFrame.height);
  baseFrame.appendChild(formFrame);

This will set the frame’s horizontal resizing mode to FIXED and it’s vertical resizing mode to FILL. If layoutAlign is set to STRETCH shouldn’t the horizontal resizing mode be set to FILL? And if the layoutGrow is set to 1 (it is not set to 0 but if it were), shouldn’t the vertical resizing mode be set to FILL? Why is it the other way around when the layoutMode is set to VERTICAL?

1 reply

Gleb
  • Power Member
  • 4708 replies
  • December 7, 2022

It depends on the direction of the baseFrame auto layout. As per the docs:

layoutAlign
Applicable only on direct children of auto-layout frames, ignored otherwise. Determines if the layer should stretch along the parent’s counter axis. Defaults to “INHERIT”.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings