findAll
Searches the entire document tree. Returns all nodes for which callback
returns true.
If the manifest contains "documentAccess": "dynamic-page"
, you must first call figma.loadAllPagesAsync
to access this function.
Supported on:
Signature
findAll(callback?: (node: PageNode | SceneNode) => boolean): Array<PageNode | SceneNode>
Parameters
callback
A function that evaluates whether to return the provided node
. If this argument is omitted, findAll
returns all nodes in the subtree.
Remarks
Nodes are included in back-to-front order. Parents always appear before their children, and children appear in same relative order before their children, and children appear in same relative order as in the children
array.
This traversal method is known as "pre-order traversal".
Note that the root node itself is not included.
Example: find all nodes whose name is "Color":
await figma.loadAllPagesAsync() // call this once when the plugin runs
const colors = figma.root.findAll(n => n.name === "Color")
⚠ Large documents in Figma can have tens of thousands of nodes. Be careful using this function as it could be very slow. Please refer to our recommendations for how to optimize document traversals.