Frame Children API

Overview

Use getFrameChildren to fetch the current children list for a frame. The order matches the frame's stored child order, which is the same order shown in the layer list.

Get Frame Children

const children = editor.getFrameChildren(frameId)
const childIds = children.map(child => child.id)
  • Returns an empty array when the frame is missing or the id is not a frame.
  • Each returned object keeps its parentFrameId pointing to the frame.

Reorder Frame Children

editor.reorderFrameChildren(frameId, [childCId, childAId, childBId])
  • Unknown ids are ignored.
  • Children omitted from the list keep their relative order and are appended to the end.
  • Auto layout frames relayout after the order change.

Unframe Selection

editor.unframeSelection([frameId])
  • Removes the frame but keeps its children on the canvas.
  • If the frame was nested, children move to the nearest parent frame that remains.
  • The unframed children become the active selection.

Convert Frame to Group

const groupIds = editor.convertFrameToGroup([frameId])
  • Returns the ids of newly created groups.
  • Frames with fewer than two children are simply unframed.
  • Nested frames place the new group inside the nearest remaining parent frame.