Only supported in dialogs. Support for card messages coming soon.
The SelectionInput
widget provides a set of selectable items, like a list of check boxes, radio buttons, switches, or a dropdown menu.
The widget supports suggestions, which help users enter uniform data, and on-change actions, which are Actions
that run when a change occurs in the text input field, like a user adding or deleting text.
When you need to collect defined and standardized data from users, use this SelectionInput
widget. To collect defined data from users, use the TextInput
widget instead.
Chat apps receive and can process the value of selected items during form input events. For details about working with form inputs, see Receive form data.
Example
The following image displays a card consisting of a SelectionInput
widget.
Checkboxes

SelectionInput
widget.Radio Buttons

SelectionInput
widget.Switches

SelectionInput
widget.Dropdown

SelectionInput
widget.
Here's the card's JSON:
Checkboxes
{
"cardsV2": [
{
"cardId": "exampleCard",
"card": {
"sections": [
{
"header": "Add new contact",
"widgets": [
{
"selectionInput": {
"type": "CHECK_BOX",
"label": "Contact type",
"name": "contactType",
"items": [
{
"text": "Work",
"value": "Work",
"selected": false
},
{
"text": "Personal",
"value": "Personal",
"selected": false
}
]
}
},
]
}
]
}
}
]
}
Radio Buttons
{
"cardsV2": [
{
"cardId": "exampleCard",
"card": {
"sections": [
{
"header": "Add new contact",
"widgets": [
{
"selectionInput": {
"type": "RADIO_BUTTON",
"label": "Contact type",
"name": "contactType",
"items": [
{
"text": "Work",
"value": "Work",
"selected": false
},
{
"text": "Personal",
"value": "Personal",
"selected": false
}
]
}
},
]
}
]
}
}
]
}
Switches
{
"cardsV2": [
{
"cardId": "exampleCard",
"card": {
"sections": [
{
"header": "Add new contact",
"widgets": [
{
"selectionInput": {
"type": "SWITCH",
"label": "Contact type",
"name": "contactType",
"items": [
{
"text": "Work",
"value": "Work",
"selected": false
},
{
"text": "Personal",
"value": "Personal",
"selected": false
}
]
}
},
]
}
]
}
}
]
}
Dropdown
{
"cardsV2": [
{
"cardId": "exampleCard",
"card": {
"sections": [
{
"header": "Add new contact",
"widgets": [
{
"selectionInput": {
"type": "DROPDOWN",
"label": "Contact type",
"name": "contactType",
"items": [
{
"text": "Work",
"value": "Work",
"selected": false
},
{
"text": "Personal",
"value": "Personal",
"selected": false
}
]
}
},
]
}
]
}
}
]
}
SelectionInput
JSON representation and fields
JSON representation |
---|
{ "name": string, "label": string, "type": enum ( |
Fields | |
---|---|
name
|
The name by which the selection input is identified in a form input event. For details about working with form inputs, see Receive form data . |
label
|
The text that appears above the selection input field in the user interface. Specify text that helps the user enter the information your app needs. For example, if users are selecting the urgency of a work ticket from a drop-down menu, the label might be "Urgency" or "Select urgency". |
type
|
The way that an option appears to users. Different options support different types of interactions. For example, users can enable multiple check boxes, but can only select one value from a dropdown menu. Each selection input supports one type of selection. Mixing check boxes and switches, for example, is not supported. |
items[]
|
An array of the selected items. For example, all the selected check boxes. |
onChangeAction
|
If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button that submits the form. For details about working with form inputs, see Receive form data . |
SelectionType
enumerated values
Enums | |
---|---|
CHECK_BOX
|
A set of checkboxes. Users can select multiple check boxes per selection input. |
RADIO_BUTTON
|
A set of radio buttons. Users can select one radio button per selection input. |
SWITCH
|
A set of switches. Users can turn on multiple switches at once per selection input. |
DROPDOWN
|
A dropdown menu. Users can select one dropdown menu item per selection input. |
SelectionItem
JSON representation and fields
JSON representation |
---|
{ "text": string, "value": string, "selected": boolean } |
Fields | |
---|---|
text
|
The text displayed to users. |
value
|
The value associated with this item. The client should use this as a form input value. For details about working with form inputs, see Receive form data . |
selected
|
When
|