A site widget is a core component of the user interface (UI) of your Wix Blocks app. Widgets are the parts of your app that visitors directly interact with, usually composed of various elements like buttons, input fields, images, and more.
This article explains how to add a site widget to your app using Wix Blocks.
- You must be logged into your Wix Studio account.
- Use an existing app or create a new one.
- Open the Wix Blocks editor through Custom Apps in your Studio workspace.
- Navigate to the Widgets and Design panel. Here you can create new widgets or find existing ones.
- Click + Add Widget.
- Select Blank Widget to start creating an empty widget, or use one of the ready-made widgets.
Elements are the UI components that make up your widget. You can add text, media, shapes, and other elements to your widget.
- Click
Add Elements to open the Elements panel.
- Drag and drop the elements you want to your widget.
Design presets allow you to create multiple designs for the same widget. The functionality remains the same, only the design changes.
- Navigate to the Design Presets section of the Widgets and Design panel.
- Click + Add Design Preset.
- Click the
More Actions icon to rename, duplicate, or delete a preset.
- Make design changes to your widget.
Each element of your widget has an action bar that you can customize. For example, you can add a main action button, animations, and other elements to the action bar. The entire widget also has an action bar, for configuring settings and adding and removing elements. These action bars are used by a site builder who installs the app, to configure the widget and its elements.
- Navigate to the Configuration tab. The action bar opens.
- Select the element whose action bar you want to customize.
- Add actions to your action bar by clicking + Add and selecting which actions you want to add.
- Modify the action buttons and connect them to custom panels or dashboard pages that you created.
- Modify the behavior of your widget by selecting whether the widget can be duplicated or resized from the behavior panel.
You can change the user interface and create panels that are unique to your widget, which direct the flow and how the widget is used.
- Navigate to the Custom Panels tab.
- Click Create Panel and name your panel.
- Add elements to your panel by clicking the + Add Element button. For example, you can add elements such as thumbnails, buttons, dropdowns, and so on.
- Optionally add code to your panels to customize them.
Add code to create your widget's custom functionality and interactions, or create your widget's public API.
- Navigate to the Widgets and Design panel.
- Open the
widget code panel.
- Click
API to add properties, functions or events to your Widget API.
- Click
Properties & Events to add properties, events, and functions to your widget elements.
- Write your code in the code editor in the bottom part of your screen.
- Click Preview to test your code.
Determine how your widget is presented in the editor with the Blocks installation settings. For example, which preset is the default preset and whether the widget is presented in the editor's Add + panel.
- Hover over the widget name in the App Interface.
- Click the three dots and select Editor Experience > Edit Installation Settings.
- Edit the settings.
- To switch to another widget, select a different widget and repeat the process.