Configure Widget Behavior

When you create a site widget with the Wix CLI, you can control how site builders interact with it in the editor. These settings are defined in your widget's element.extension.ts file and determine things like default dimensions, whether the widget is added automatically on install, and whether it's essential to your app.

Available behavior settings

You can configure the following settings in your widget's element.extension.ts file. Available settings include the widget's dimensions, installation behavior, and dashboard page association.

Dimensions

Control the widget's initial size and whether site builders can stretch it to full width:

Copy
SettingDescription
width.defaultWidthThe widget's width in pixels when first installed on a site.
width.allowStretchWhether to allow site builders to toggle the widget between full-width and default width.
width.stretchByDefaultWhether to stretch the widget to full width on installation.
height.defaultHeightThe widget's height in pixels when first installed on a site.

Installation behavior

Control how the widget is added to a site when your app is installed:

Copy
SettingDescription
installation.autoAddIf true, the widget is automatically added to the site's home page when the app is installed. If false, the site builder adds it manually from the Add Elements panel.
installation.essentialIf true, the widget is a core part of your app. Deleting the widget (or the section or page containing it) also deletes the app. Can only be set to true if the widget is part of a site page extension.

For more details and best practices, see About Site Widget Installation with the Wix CLI.

Dashboard page association

Associate a widget with one of your app's dashboard pages. When configured, a Manage button appears in the widget's action bar in the editor, allowing site builders to navigate directly to the linked dashboard page.

Copy

Set dashboardPageComponentId to the id of the dashboard page extension you want to associate with the widget.

See also

Did this help?