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
The Label property is a group of customizable settings that define the main text displayed on the widget. 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()
).
Example: If your API provides multilingual data like:
{
"name": "Red",
"nameHindi": "लाल",
"nameSpanish": "roja",
"code": "RED"
}
And you want to display the label based on the selected language, you can configure the Label Key as:
{{ selectedLanguage === 'Hindi' ? 'nameHindi' : selectedLanguage === 'Spanish' ? 'nameSpanish' : 'name' }}
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
The Label property is a group of customizable settings that define the main text displayed on the widget.
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.
Width (in columns) number
Sets the width of the label in the widget when the left position is selected.
Search and filters
Allow searching boolean
Enables searching for specific options within the dropdown list. When this option is enabled, a search input field is displayed in the widget. Additionally, you can control it through JavaScript by clicking on the JS next to the property.
Server side filtering boolean
Enables server-side filtering via a query request. Use this property when the Select widget's option data is being bound to a query.
onFilterUpdate
Allows you to configure one or multiple actions (Framework functions, queries, or JS functions) to be executed when you update the filter text.
Validations
Required boolean
Enabling this property for a Select widget makes it a mandatory field, meaning that the user must select a value from the dropdown. When the Select widget is placed within a Form widget and the Required property is enabled, the Form's submit button remains inactive until a value is selected in the Select widget.
General
General properties are essential configurations that provide overall control over the widget's behavior and appearance.
Visible boolean
Controls the visibility of the widget. If you turn off this property, the widget is not visible in View mode. Additionally, you can use JavaScript by clicking on JS next to the Visible property to control the widget's visibility conditionally.
For example, if you want to make the widget visible only when the user checks an item in a Checkbox widget, you can use the following JavaScript expression in the visible property of the select widget:
{{Checkbox1.isChecked}}