Skip to main content

Add Fixed Position to the Plugin API


James_Lawrie

I would like to do this programmatically through the Figma Plugin API, currently, there isn’t direct support for toggling the “Fixed Position When Scrolling” property.

This is a manual setting that users must configure in Figma. The plugin API provides limited access to interact with the Figma interface and prototype settings.

And would be a huge help in creating plugins to assist in prototyping.

4 replies

tank666
  • 4873 replies
  • January 18, 2024

This is possible using the Plugin API, and I already answered you earlier here: Fixed frame in presentation mode - #2 by tank666.
Another related topic: Expose missing fields from the API.


James_Lawrie
  • Author
  • New Participant
  • 17 replies
  • January 18, 2024

Can you provide me a code example of how to use it, as the documentation is not helpful. Neither is your reply, saying, yes it’s possible, without an example is not very helpful. Their is no help around this “numberOfFixedChildren” online.

let numberOfFixedChildren;

const newFrame = figma.createFrame();
newFrame.name = "newFrame";

 // Align newFrame to the top left of parentFrame
newFrame.x = 0;
newFrame.y = 0;

const imageNode = figma.createImage(imageData);

// Append the new grouped text to the frame
newFrame.appendChild(imageHolder);

// Append the new frame to the parentFrame, not the page
parentFrame.appendChild(newFrame);

How would the newFrame be fixed?


Gleb
  • Power Member
  • 4708 replies
  • January 18, 2024

tank666
  • 4873 replies
  • January 18, 2024
parentFrame.numberOfFixedChildren = 1;

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