Skip to main content

findOne

Searches this entire subtree (this node's children, its children's children, etc). Returns the first node for which callback returns true.

Signature

findOne(callback: (node: SceneNode) => boolean): 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 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")
caution

⚠ 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 node.children.find(callback) or node.findChild(callback). Please refer to our recommendations for how to optimize document traversals.