ComboBox (AI Assistant)
This page provides information on using the ComboBox Widget(available in AI Assistant Apps), which allows users to search and choose a single option from a dropdown 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
These properties allow you to configure the options and data displayed to users.
Data type string
Specifies the behavior of the dropdown in the layout. You can choose between two modes:
- Select: A basic dropdown without search, ideal for situations where the number of options is small and easily visible to the user. See ComboBox widget.
- Combobox: A dropdown with search functionality, designed for scenarios where the dataset is large, allowing users to quickly filter and select the desired option.
Options array<object>
Defines the list of items available for selection in the dropdown. Each option is represented as an object containing label
and value
properties. When JS is enabled, you can dynamically generate options by binding query data or using JS expressions.
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 ComboBox 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.
Text string
Sets the label text for the widget, which is displayed alongside the dropdown or combo box. This label helps users understand the purpose of the widget. For example, you could set the label to "Choose a Color" to indicate that the user should select a color from the list.