Widgets with Options
Widgets that allow the end-user to select from a set of options require specific treatment. This includes widgets such as dropdowns, radio groups, or checkbox groups. These options could be hardcoded in the custom widget, or defined by the app author.
Author-Defined Options
If a widget requires app authors to define their own options, define a property with both id
and propType
set to a value of "customOptions"
.
Example:
const myWidgetDefintion = {
...
properties: [
{
id: "customOptions",
propType: "customOptions",
label: "Options"
},
...
],
...
Note: An id of 'customOptions'
is meaningful to Leap. All other custom property id's are arbitrary.
Hardcoded Options
If the widget's options are hardcoded, add a getOptions()
function to your widget.
Example:
const myWidgetDefintion = {
...
getOptions : function () {
return [{title: 'Yes', value: 'yes'}, {title: 'No', value: 'no'}];
},
...
};
Parent topic: Custom Widget API