1.0.1 • Published 8 months ago
figma-node-selector v1.0.1
figma-selector
This library can be used to select Figma nodes in the plugin API using a CSS selector-like syntax.
Usage
import { select } from 'figma-node-selector';
const results = select('Frame[name="frame-name"]', figma.currentPage);
More examples
// selects the direct children of figma.currentPage, whose type is ELLIPSE and whose name contains "foo"
const results = select('> Ellipse[name*="foo"]', figma.currentPage);
// selects any direct frame, which is in itself a direct child frame of the currentpage whose ID is "100:100"
const results = select('> Frame > Frame[id="100:100"]', figma.currentPage);
// selects all direct children of the currentpage
const results = select('> *', figma.currentPage);
// selects all the nodes (basically findAll)
const results = select('*', figma.currentPage);