Wix Blocks: Creating and Managing Custom Type Properties in the Widget API

Wix Blocks is open to all Wix Studio users. To get access to Blocks, join Wix Studio.

In your Widget API, you can create custom property types that fit the requirements of your app.

For example, if you have a shopping widget, you may want to create a type that represents a customer, or a product, such as a shoe. 

The Customer type could include the following properties: name (text), address (text), age (number) and customerI__d (number).

The Shoe type could include the following properties: model (text or number, depending on your catalog), size (number), color (text) and productId(number).

Tip Notice that a custom type property (such as Customer or Shoe) also has properties, which are the fields of this new datatype that you created. However, these inner properties can only have simple types: text, number, boolean, image and URL. They cannot break down into more custom type properties.

Create a Property with a Custom Type

  1. Click the Widget API  icon.
  2. Click Add New Property or hover over Properties and click the  icon.
  3. Give your property a significant name and a display name.
  4. Expand the Property Type menu. 
  5. Click Create New Custom Type.

  1. Name the custom type.
  2. Click Add Property to add properties (fields) to the type.
  3. Repeat the process until you've added all the properties of the type. 
  4. Click Save

8.  Add a description to your new property. 

9.  Add default values to the type's fields if you want (such as a default age for the customer). 

10. Click Create

Tip In the above example, the Customer type can be used for various properties in the Widget API, such as ExsitingCustomer, FirstTimeCustomer, PotentialCustomer.

Edit a Custom Property Type

Edit a custom type by hovering over the type and clicking the Edit  icon. You can then edit or remove any of the properties in that type.

Important

  • If you remove a property from your custom type, it is removed from the Widget API properties of the custom type. If you add a property to your custom type, it is automatically added to the existing Widget API properties of that custom type. 
  • If you change the name of the custom type it is automatically changed in each Widget API property that is of that type.

Delete a Custom Property Type

Delete a custom type by hovering over the type and clicking the Delete  icon. You can only delete a custom type if no Widget API properties are of that type.

Was this helpful?
Yes
No