Searches this entire subtree (this node's children, its children's children, etc). Returns the first node for which
callback returns true.
findOne(callback: (node: SceneNode) => boolean): SceneNode | null
A function that evaluates whether to return the provided
This function returns
null if no matching node is found. The traversal order is the same as in
Note that the node this method is called on is not included.
Example: find one node whose name is "Template":
const template = figma.currentPage.findOne(n => n.name === "Template")
⚠ Large documents in Figma can have tens of thousands of nodes. Be careful using this function as it could be very slow.
If you only need to search immediate children, it is much faster to call
Please refer to our recommendations for how to optimize document traversals.