Skip to main content
Question

createPage and adding text, first page is coming blank

  • February 16, 2024
  • 2 replies
  • 186 views

Sunil_Chandra_N

I have the below JSON

{
“Pages”: [
{
“Text”:“Hi”
},
{
“Text”:“Hello”
}
]
}

I’m looping through it to create the Pages, Frame an d Text. It is working, but the Page 1 is coning blank. “Hi” is getting into Page 2 and “Hello” is getting into Page 3. How do I make it to come in Page 1 and Page 2?

I’m doing something like,

const page = Figma.createPage();
const frame = Figma.createFrame();

// some code here

Figma.currentPage = page;
Figma.currentPage.appendChild(frame);

// some code here

frame.appendChild(text);

This topic has been closed for replies.

2 replies

y_toku
Figmate
  • Community Support
  • 2545 replies
  • February 20, 2024

Hi there,

Thanks for reaching out. I’m checking this with our internal team. I will get back to you when I have anything I can share with you.

Thanks,
Toku


James_Yang
Figmate
  • Figmate
  • 82 replies
  • February 20, 2024

Every Figma file already comes with an existing page, so the moment you run figma.createPage(), it creates the second page. To fix your code, you should skip calling figma.createPage() until you actually need a second page.


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