Sets or gets a list of items which will be rendered as tags.


Setting the options property sets all the options available to a site visitor.

Getting the options property returns the current list of options available to a site visitor.

Each option contains a label, which is what the site visitor sees, and a value, which is used in code and stored in your collections.

You cannot modify the options data array in-place. To add, change, or remove individual selection tag options:

  1. Store the value of the options property in a variable.
  2. Make changes to the array.
  3. Reset the options property with the modified array.

Note: Setting the options property clears the value and selectedIndices of the selection tags.


Array<Option>Read & Write, default value is An empty array

Was this helpful?

Get the options of selection tags

Code Example

Copy Code
1let selectionTagsOptions = $w("#mySelectionTags").options;
3let firstLabel = selectionTagsOptions[0].label; // "First Label"
4let firstValue = selectionTagsOptions[0].value; // "first_value"
Set the options of selection tags

Code Example

Copy Code
1$w("#mySelectionTags").options = [
2 { ‘label’: ‘Onion’, ‘value’: ‘onion’},
3 { ‘label’: ‘Tomatoes’, ‘value’: ‘tomatoes’},
4 { ‘label’: ‘Extra Cheese’, ‘value’: ‘cheese’}
Add an option to selection tags

This example retrieves the options of selection tags, adds a new option, and then overwrites the old options.

Code Example

Copy Code
1let pizzaToppingOptions = $w("#pizzaToppingTags").options;
2pizzaToppingOptions.push({"label": "Olives", "value": "olives"});
3$w("#pizzaToppingTags").options = pizzaToppingOptions;