Similar to the layers panel in Figma, actions can be nested inside of one another.
Simply drag an action inside another to nest.
Try nesting a rectangle inside of a frame by adding the “Create rectangle” action and dragging it inside of the “Create frame” action.
Nested actions will appear inset underneath their parent actions.
An example nested action
The “Repeat” action is a great example of an action that relies on nesting.
Whatever is nested inside of it will repeat a specified number of times.
Try recreating the example above that repeats creating a frame with a rectangle inside of it 5 times.
When to nest
Let’s say we want to create a frame and add a fill color.
Left (incorrect): “Create frame” and “Add fill” are running entirely independent of one another. “Add fill” needs to be nested to know what layer to set a fill on.
Right (correct): “Add fill” is being executed on the result of the “Create frame” action.
Here’s an example where we’re fetching a URL from an API and creating a frame with the result as text inside of it.
Left (incorrect): “Fetch URL,” “Create frame,” and “Create text” are running entirely independent of one another. This will create a frame and an undefined text layer separate from one another.
Right (correct): “Fetch URL” runs the actions inside of it once the request is completed. Only then does it create a frame with the result as text inside of it.