Skip to main content
Sunil_Chandra_N
February 16, 2024
Question

createPage and adding text, first page is coming blank

  • February 16, 2024
  • 2 replies
  • 242 views

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
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
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.