Skip to main content

Hi, Iā€™m trying to createPage below the currentPage. Is there a way to do so instead of always creating page at the bottom of the list? Thanks!

Use the insertChild() method on root.


For example, like this:


let page = figma.createPage(),
index = figma.root.children.findIndex(el => el.id === figma.currentPage.id) + 1;
figma.root.insertChild(index, page);

I did it like this

figma.root.insertChild(figma.root.children.indexOf(figma.currentPage) + 1, page);


Reply