Select
This page provides information on the Select widget (formerly known as dropdown), that enable users to select a single option from a given list.
Content properties
These properties are customizable options present in the property pane of the widget, allowing users to modify the widget according to their preferences.
Data
Source Data array<object>
Specify data as an array of objects to display options in the widget. For example:
[
{
name: "Blue",
code: "BLUE",
},
{
name: "Green",
code: "GREEN",
},
{
name: "Red",
code: "RED",
},
];
You can dynamically generate options by fetching data from queries or JS functions and binding the response to the Source Data property. For example, if you have a query named fetchData
, you can bind its response using:
{{fetchData.data}}
If the retrieved data is not in the desired format, you can use JavaScript to transform the data by adding it to the Source Data property, like:
{{fetchData.data.map( p => ({label: p.country, value: p.country}))}}
If you are generating options for Select widget using JS code as shown above, make sure to define both the Label and Value properties.
Label key string
Defines the key in the Source Data that specifies the labels for each option in the Select widget. When using the JS mode for dynamic configurations, the value must evaluate to a valid property name present in each object of the data array. Data cannot be manipulated directly (for example, applying .toLowerCase()
or .toUpperCase()
).
Value key string
The Value Key property specifies which key in the Source Data is used as the unique identifier for each dropdown option. When using the JS mode for dynamic configurations, the value must evaluate to a valid property name in the data object. This ensures that each dropdown option has a unique, identifiable value.
Default selected value string
Sets the initial option that is automatically chosen when the widget is loaded. It serves as the default selection unless the user manually selects a different option from the list. For example, if you want the default option to be Blue
, set the Default Selected Value property to BLUE
.
Label
Text string
Sets the label of the widget.
Position string
Sets the placement of the Label in the widget.
Options:
- Left: The label is placed on the left of the widget.
- Top: The label gets placed at the top of the widget.
- Auto: The label position is determined based on the height of the widget itself.
Alignment string
Sets the label alignment of the widget when the position selected is left.