Skip to content
You're viewing documentation for Draftbit Classic (v1), our previous platform. See the current Draftbit docs.

App Variables

Store data to use throughout your app

App Variables are shared pieces of data that live at the app-level and can be set and used across your entire app. They are useful for storing data that is common to all users or different parts of your UI. App Variables can be set to any valid JSON and you can access App Variables from anywhere in your app.

Each time your App restarts, the App Variable will reset to the default value. That means you shouldn’t store information that needs to persist across app launches - use a Device Variable instead.

For example, you might have a variable named error_message that you can set and access across all Screens in your app to display an error message in a Text component. Or use it to store the state of a Modal.

To create variables, open the Variables modal from the left menu bar of the Builder.

ParameterDescription
NameThe name of the variable to be referenced.
Development ValueThe default value when building and publishing using the Development Environment
Production ValueThe default value when building and publishing using the Production Environment

To update the value of an App Variable, you will use the Set Variable Action from a Trigger in the Interactions tab from the right panel of the Builder.

You can also work with App Variables in Files and Functions. Learn how in the Variables with Custom Code doc.