Search...
options
Sets or gets the options of the checkbox group.
Description
options
is an array of objects, each representing an option available to a user.
Setting the options
property sets all the options
available to a user.
Getting the options
property returns the current
list of options available to a user.
You cannot modify the data array in-place. To add, change, or remove individual checkbox options:
- Store the value of the
options
property in a variable. - Make changes to the options array.
- Reset the
options
property with the modified array.
Type:
Array<option>Read & Write
NAME
TYPE
DESCRIPTION
label
string
The label of the checkbox option. This is what a user sees.
value
string
The value of the checkbox option. This is what you use in code.
Was this helpful?
Get the list of options and the first option's label and value from a checkbox group
Copy Code
1let checkboxGroupOptions = $w("#myCheckboxGroup").options;23let firstLabel = checkboxGroupOptions[0].label; // "First Label"4let firstValue = checkboxGroupOptions[0].value; // "first_value"
Set the list of options for a checkbox group
Copy Code
1$w("#myCheckboxGroup").options = [2 {"label": "Who's on first!", "value": "first"},3 {"label": "What's on second", "value": "second"},4 {"label": "I Don't Know is on third", "value": "third"}5];
Add an option to a checkbox group
Copy Code
1let opts = $w("#myCheckboxGroup").options;2opts.push({"label": "New Label", "value": "New Value"});3$w("#myCheckboxGroup").options = opts;