2. Properties

Let’s open the overlay again to create a property. All property types have the following attributes:

Name

The name of the property is identified as @MyPropertyName in WEMscript.

Input Type

The input type determines how we set the value of the property. There are three methods to do this. Note that there is only one way to write to a property, which is via the Data Model.

Description
Writable

Literal

A value that is set statically.

No

Data Model

A value that is set by binding to a data model item, which can be either a list or a field, depending on the property type that has been set. The field must also be writable.

Depends

Expression

A value that is set by a WEM expression.

No

Appearance

This property indicates which group the property should be rendered in within the template editor. It does not affect the functionality of the property.

File Type

The file property has an additional attribute for validation. You can leave it blank to accept any file type.

The dropdown has an extra property called Dropdown Options. The options consist of a tuple of a label and a value. The labels are used to display the options in the template editor, while the values are used in WEMscript and are of the text type. In technical terms, a dropdown is a static set of text enums.

Let’s assume a dropdown property called @StyleContext with the following set of options for UI context styles:

Label
Value

Success

success

Info

info

Warning

warning

Danger

danger

The value of the dropdown is simply a text value. Here’s an example of how to use it:

if @StyleContext = "success"
    /* Render success style */
elseif @StyleContext = "info"
    /* Render info style */
elseif @StyleContext = "warning"
    /* Render warning style */
else
    /* Render danger style */
end

The navigation types include Button Exit, Flowchart, Hyperlink, and Navigation Item. These are always set statically.

Default Value

This is the initial value of the property. If it is not set, the initial value will be unknown.

Writable

This property is only available when the input type is Data Model. If you want to write values back to the data model, this should be set to true. The property becomes stricter when it is writable; you cannot use calculated fields.

Visible When

This property determines when the property should be visible in the template editor. It works in conjunction with literal boolean and dropdown properties. You will notice that if you have any of those as properties for a widget, the "Visible When" dropdown is populated with those properties. The "Visible When" feature is useful for hiding properties that are not required in certain contexts.

Was this helpful?