Sort DocumentNode Children/PageNode

I have a question about the PageNode API. Is it possible to resort/rearrange the index of a page in the DocumentNode? For example, could I create a plugin that moves a page from first to last in a document? Based off the docs, I see it is possible to insert and append, but not sure about sorting. Thanks!

Insert/append is exactly what you need to sort. Just insert the page in the position that you need it to be. For example: figma.root.insertChild(figma.root.children[5], 2) will move the page at 5th index to the index of 2.

1 Like