Skip to main content
Question

Create a frame inside another frame

  • December 11, 2023
  • 1 reply
  • 1330 views

James_Lawrie

I am trying to create a plugin that will create a frame inside all parent frames called ‘#watermark’, this is my end goal. But first I need to create a frame inside another and can work out how. Documentation has this:

`// By default, the new node has a white background, width and height both at 100, 
// and is parented under figma.currentPage.
const frame = figma.createFrame()

// Move to (50, 50)
frame.x = 0
frame.y = 550

// Set size to 1280 x 720
frame.resize(500, 350);`

But how can I pin it to a parent frame?

My Page setup is: Page 1 > 3x Frames (Frame One, Frame Two, Frame Three).

Code:

const currentPage = figma.currentPage;
    const childFrames = currentPage.findChildren(n => n.type === "FRAME");

Console Logs:

  • PAGE: Page 1 - ID: 0:1
  • CHILD FRAMES: Frame One - ID: 1:2
  • CHILD FRAMES: Frame Two - ID: 1:3
  • CHILD FRAMES: Frame Three - ID: 1:10
This topic has been closed for replies.

1 reply

Gleb
  • Power Member
  • 4710 replies
  • December 11, 2023

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