Introduction

Important:

  • This module is available only in Wix Blocks. Wix Blocks is an editor for building Wix apps.
  • This module doesn't work in preview mode.

The wix-widget API is used within the code of panels built with the Blocks Panel Builder. It enables your panel to interact with your Blocks widgets by controlling their properties, design presets, and more.
To use this API, import wixWidget from the wix-widget module:

Copy
import wixWidget from "wix-widget";
Did this help?

getDesignPreset( )


Gets the widget's current design preset.

The getDesignPreset() function returns a Promise that resolves to the widget's current preset name. To use this function on an inner (nested) widget, use getNestedWidget().

Note: The getDesignPreset() function doesn't work in preview mode.

Method Declaration
Copy
function getDesignPreset(): Promise<string>;
Request
This method does not take any parameters
Returns
Return Type:Promise<string>
Get a widget's design preset
JavaScript
import wixWidget from "wix-widget"; // ... wixWidget.getDesignPreset().then((designPreset) => { // Code to execute with the designPreset string }); // For example, designPreset can be "preset-1-wide"
Did this help?