Blocks AI helps you create and modify Wix Blocks widgets through AI-powered generation and editing capabilities. This article explains how to use Blocks AI to enhance your app development workflow.
The Blocks AI offers a three-stage workflow that streamlines your widget development:
This workflow helps you rapidly build functional widgets by leveraging AI at each development stage, from initial creation to adding business logic and data capabilities.
However, it does not necessarily have to be in this order. You can also start from a widget that you designed by yourself or start from adding a collection, if that makes sense. Just keep it logical - don't try to write code that relates to a UI without creating that UI first.
Click the AI icon to open the Blocks AI panel. Then, select your option and enter a prompt.
The Generate Widget command creates a new widget and its contents, including:
To get the best results when generating widgets:
Provide detailed descriptions in your prompt, including the UI elements, their position, and their purpose.
Try different prompts if the initial generation doesn't meet your needs.
Use structured lists to organize your requirements clearly and logically. For example:
The Edit Widget command makes design changes to your widgets based on your prompt. With this command, you can:
You can also always make manual changes to your widget if needed.
To get the best results when editing widgets:
Some design changes are currently not supported by the Edit Widget command and must be done manually:
Generate Code helps you create and modify both frontend and backend implementations, as well as data structures for your app. You can use it to generate new code or edit existing code, including frontend logic, backend services, and CMS collections for data storage.
With this command, you can generate and edit:
Widget code: Frontend code that controls widget behavior and interactions.
Backend code files: Server-side code for handling business logic and data processing.
CMS collections: Database collections for storing and managing your app's data.
Dashboard code: Code for building custom admin interfaces and settings pages.
With the Generate Code command, you can perform several operations on collections:
The Blocks AI will analyze your prompt and generate the appropriate collection structure and configuration based on your requirements.
You cannot restore data that you deleted, using the Undo button. Be careful when changing collection data.
Creating a collection requires a namespace for your app. If you haven't defined a namespace yet, you will be prompted to create one.
To get the best results when generating code:
onClick
event for the button, and update a dataset called Cart
".productName
, price
, and productImage
".This is an example of a complete prompt that uses the above tips: