findOne
Searches this entire page (this node's children, its children's children, etc.). Returns the first node for which callback
returns true.
Supported On:
Signature
findOne(callback: (node: PageNode | SceneNode) => boolean): PageNode | SceneNode | null
Parameters
callback
A function that evaluates whether to return the provided node
.
Remarks
This function returns null
if no matching node is found. The traversal order is the same as in findAll
.
Note that the root node itself is not included.
Example: find one node whose name is "Template":
const template = figma.root.findOne(n => n.name === "Template")
caution
⚠ 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.