Blocks lets you add Velo code to your widgets and apps. Velo is a JavaScript-based development platform that accelerates the way you build Wix apps. You can add code to an individual widget, as well as code for the entire app.
If you are a developer working in Blocks, make sure to review the following resources:
$widget
wix-widget
wix-editor
wix-application
wix-dashboard
In this overview, we'll cover the various places where you can add code to a Blocks app.
Add code to your widget to provide the following:
Blocks custom panels have their own code tab to create their logic.
Design a custom panel, connect it to an action button and add code to determine what happens in the panel.
Note that Blocks custom panels have designated API references:
Add Dashboard pages to your app, to enable site builders to configure your app. Dashboard pages also have a designated code tab, as well as designated APIs.
Blocks allows you to create dataset collections and access them in your app and site. Use the `wix-data` module to work with your collections.
App namespace To use collections in Blocks, make sure your app has a namespace
App namespace To use code files, make sure your app has a namespace
Add frontend or backend code files for your entire app. These are also referred to as "code packages".
To add code to your app:
Click Code in the left menu.
Select Public & Backend and add a file.
When your app is installed on a site, you can get information about the specific app instance that is currently running. For example, you can use the app instance to retrieve the pricing plan of the current user.
To get the current app instance, use the wix-application module.