0.31.0 (latest) 0.30.0 0.29.0 0.28.0 0.27.0 0.23.0 0.20.0 0.19.0 0.18.0 0.17.1 0.16.1 0.15.0 0.14.0 0.13.1 0.12.1 0.11.2 0.10.0 0.9.0 0.8.1 0.7.2 0.6.1 0.5.0 0.4.0 0.3.0 0.2.0 0.1.4 Reference documentation and code samples for the Google Apps Chat V1 Client class SelectionInput.

A widget that creates one or more UI items that users can select.

Supports form submission validation for `dropdown` and `multiselect` menus
only. When `Action.all_widgets_are_required` is set to `true` or this widget
is specified in `Action.required_widgets`, the submission action is blocked
unless a value is selected. For example, a dropdown menu or checkboxes. You
can use this widget to collect data that can be predicted or enumerated. For
an example in Google Chat apps, see [Add selectable UI
elements](https://docs.cloud.google.com/workspace/chat/design-interactive-card-dialog#add_selectable_ui_elements).
Chat apps can process the value of items that users select or input. For
details about working with form inputs, see [Receive form
data](https://developers.google.com/workspace/chat/read-form-data).
To collect undefined or abstract data from users, use
the [TextInput](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Card.V1.TextInput.md.txt) widget.
[Google Workspace add-ons
and Chat apps](https://developers.google.com/workspace/extend):

Generated from protobuf message `google.apps.card.v1.SelectionInput`

## Namespace

Google \\ Apps \\ Card \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Required. The name that identifies the selection input in a form input event. For details about working with form inputs, see [Receive form data](https://developers.google.com/workspace/chat/read-form-data). |
| `↳ label` | `string` 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` | `int` The type of items that are displayed to users in a `SelectionInput` widget. Selection types support different types of interactions. For example, users can select one or more checkboxes, but they can only select one value from a dropdown menu. |
| `↳ items` | `array<SelectionInput\SelectionItem>` An array of selectable items. For example, an array of radio buttons or checkboxes. Supports up to 100 items. |
| `↳ on_change_action` | `Action` 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](https://developers.google.com/workspace/chat/read-form-data). |
| `↳ multi_select_max_selected_items` | `int` For multiselect menus, the maximum number of items that a user can select. Minimum value is 1 item. If unspecified, defaults to 3 items. |
| `↳ multi_select_min_query_length` | `int` For multiselect menus, the number of text characters that a user inputs before the menu returns suggested selection items. If unset, the multiselect menu uses the following default values: \* \* If the menu uses a static array of `SelectionInput` items, defaults to 0 characters and immediately populates items from the array. \* \* If the menu uses a dynamic data source (`multi_select_data_source`), defaults to 3 characters before querying the data source to return suggested items. |
| `↳ external_data_source` | `Action` An external data source, such as a relational database. |
| `↳ platform_data_source` | `SelectionInput\PlatformDataSource` A data source from Google Workspace. |

### getName

Required. The name that identifies the selection input in a form input
event.

For details about working with form inputs, see [Receive form
data](https://developers.google.com/workspace/chat/read-form-data).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Required. The name that identifies the selection input in a form input
event.

For details about working with form inputs, see [Receive form
data](https://developers.google.com/workspace/chat/read-form-data).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getLabel

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".

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setLabel

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".

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getType

The type of items that are displayed to users in a `SelectionInput` widget.

Selection types support different types of interactions. For example, users
can select one or more checkboxes, but they can only select one value from
a dropdown menu.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [SelectionType](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Card.V1.SelectionInput.SelectionType.md.txt). |

### setType

The type of items that are displayed to users in a `SelectionInput` widget.

Selection types support different types of interactions. For example, users
can select one or more checkboxes, but they can only select one value from
a dropdown menu.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [SelectionType](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Card.V1.SelectionInput.SelectionType.md.txt). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getItems

An array of selectable items. For example, an array of radio buttons or
checkboxes. Supports up to 100 items.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<SelectionInput\SelectionItem>` |   |

### setItems

An array of selectable items. For example, an array of radio buttons or
checkboxes. Supports up to 100 items.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<SelectionInput\SelectionItem>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getOnChangeAction

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](https://developers.google.com/workspace/chat/read-form-data).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Action|null` |   |

### hasOnChangeAction

### clearOnChangeAction

### setOnChangeAction

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](https://developers.google.com/workspace/chat/read-form-data).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Action` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getMultiSelectMaxSelectedItems

For multiselect menus, the maximum number of items that a user can select.

Minimum value is 1 item. If unspecified, defaults to 3 items.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasMultiSelectMaxSelectedItems

### clearMultiSelectMaxSelectedItems

### setMultiSelectMaxSelectedItems

For multiselect menus, the maximum number of items that a user can select.

Minimum value is 1 item. If unspecified, defaults to 3 items.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getMultiSelectMinQueryLength

For multiselect menus, the number of text characters that a user inputs
before the menu returns suggested selection items.

If unset, the multiselect menu uses the following default values:

- If the menu uses a static array of `SelectionInput` items, defaults to 0 characters and immediately populates items from the array.
- If the menu uses a dynamic data source (`multi_select_data_source`), defaults to 3 characters before querying the data source to return suggested items.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setMultiSelectMinQueryLength

For multiselect menus, the number of text characters that a user inputs
before the menu returns suggested selection items.

If unset, the multiselect menu uses the following default values:

- If the menu uses a static array of `SelectionInput` items, defaults to 0 characters and immediately populates items from the array.
- If the menu uses a dynamic data source (`multi_select_data_source`), defaults to 3 characters before querying the data source to return suggested items.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getExternalDataSource

An external data source, such as a relational database.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Action|null` |   |

### hasExternalDataSource

### setExternalDataSource

An external data source, such as a relational database.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Action` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPlatformDataSource

A data source from Google Workspace.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `SelectionInput\PlatformDataSource|null` |   |

### hasPlatformDataSource

### setPlatformDataSource

A data source from Google Workspace.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `SelectionInput\PlatformDataSource` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getMultiSelectDataSource

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |