The workflow editor lets you specify what actions should be executed when a given event occurs.

CleanShot 2023-02-14 at 14.16.16@2x.jpg

Actions

Actions are executed from top to bottom. Toddle comes with several built in actions that can be performed including:

Setting a variable Change the value of a variable using either a static value, or a formula.

Trigger a component event Trigger an event for the current component. Pages or components that include this component in their element tree can listen for the event, and execute their own workflows accordingly. You can also specify the payload you want to pass along with the event.

Call an API

If you have specified an API for the component then you will have the option of calling it with an action. This is especially useful when you have an API that should only be called when an event occurs (Such as when a form is submitted). This action can also be used to refresh and API that is using Auto fetch.

<aside> 💡 Some Actions can trigger their own events! The call API actions will e.g. trigger an event on Success or Error.

</aside>

Switch

Switch lets you execute a set of actions only if a certain condition is met (see the picture above). The branches of a switch are evaluated from left to right and only one branch of the switch will be executed.

Custom actions

It is also possible to upload custom actions, written in JavaScript to toddle. This enables you to extend the functionality of toddle to handle any scenario you might encounter.