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

A field in which users can enter text. Supports suggestions and on-change
actions.

Supports form submission validation. 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 entered. For an example in
Google Chat apps, see [Add a field in which a user can enter
text](https://developers.google.com/workspace/chat/design-interactive-card-dialog#add_a_field_in_which_a_user_can_enter_text).
Chat apps receive and can process the value of entered text during form input
events. For details about working with form inputs, see [Receive form
data](https://developers.google.com/workspace/chat/read-form-data).
When you need to collect undefined or abstract data from users,
use a text input. To collect defined or enumerated data from users, use the
[SelectionInput](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Card.V1.SelectionInput.md.txt) widget.
[Google Workspace add-ons and Chat
apps](https://developers.google.com/workspace/extend):

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

## Namespace

Google \\ Apps \\ Card \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` The name by which the text input is identified 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 text input field in the user interface. Specify text that helps the user enter the information your app needs. For example, if you are asking someone's name, but specifically need their surname, write `surname` instead of `name`. Required if `hintText` is unspecified. Otherwise, optional. |
| `↳ hint_text` | `string` Text that appears below the text input field meant to assist users by prompting them to enter a certain value. This text is always visible. Required if `label` is unspecified. Otherwise, optional. |
| `↳ value` | `string` The value entered by a user, returned as part of a form input event. For details about working with form inputs, see [Receive form data](https://developers.google.com/workspace/chat/read-form-data). |
| `↳ type` | `int` How a text input field appears in the user interface. For example, whether the field is single or multi-line. |
| `↳ on_change_action` | `Action` What to do when a change occurs in the text input field. For example, a user adding to the field or deleting text. Examples of actions to take include running a custom function or opening a [dialog](https://developers.google.com/workspace/chat/dialogs) in Google Chat. |
| `↳ initial_suggestions` | `Suggestions` Suggested values that users can enter. These values appear when users click inside the text input field. As users type, the suggested values dynamically filter to match what the users have typed. For example, a text input field for programming language might suggest Java, JavaScript, Python, and C++. When users start typing `Jav`, the list of suggestions filters to show just `Java` and `JavaScript`. Suggested values help guide users to enter values that your app can make sense of. When referring to JavaScript, some users might enter `javascript` and others `java script`. Suggesting `JavaScript` can standardize how users interact with your app. When specified, `TextInput.type` is always `SINGLE_LINE`, even if it's set to `MULTIPLE_LINE`. [Google Workspace add-ons and Chat apps](https://developers.google.com/workspace/extend): |
| `↳ auto_complete_action` | `Action` Optional. Specify what action to take when the text input field provides suggestions to users who interact with it. If unspecified, the suggestions are set by `initialSuggestions` and are processed by the client. If specified, the app takes the action specified here, such as running a custom function. [Google Workspace add-ons](https://developers.google.com/workspace/add-ons): |
| `↳ validation` | `Validation` Specify the input format validation necessary for this text field. [Google Workspace add-ons and Chat apps](https://developers.google.com/workspace/extend): |
| `↳ placeholder_text` | `string` Text that appears in the text input field when the field is empty. Use this text to prompt users to enter a value. For example, `Enter a number from 0 to 100`. [Google Chat apps](https://developers.google.com/workspace/chat): |

### getName

The name by which the text input is identified 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

The name by which the text input is identified 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 text input field in the user interface.

Specify text that helps the user enter the information your app needs.
For example, if you are asking someone's name, but specifically need their
surname, write `surname` instead of `name`.
Required if `hintText` is unspecified. Otherwise, optional.

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

### setLabel

The text that appears above the text input field in the user interface.

Specify text that helps the user enter the information your app needs.
For example, if you are asking someone's name, but specifically need their
surname, write `surname` instead of `name`.
Required if `hintText` is unspecified. Otherwise, optional.

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

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

### getHintText

Text that appears below the text input field meant to assist users by
prompting them to enter a certain value. This text is always visible.

Required if `label` is unspecified. Otherwise, optional.

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

### setHintText

Text that appears below the text input field meant to assist users by
prompting them to enter a certain value. This text is always visible.

Required if `label` is unspecified. Otherwise, optional.

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

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

### getValue

The value entered by a user, returned as part of 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` |   |

### setValue

The value entered by a user, returned as part of 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` |   |

### getType

How a text input field appears in the user interface.

For example, whether the field is single or multi-line.

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

### setType

How a text input field appears in the user interface.

For example, whether the field is single or multi-line.

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

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

### getOnChangeAction

What to do when a change occurs in the text input field. For example, a
user adding to the field or deleting text.

Examples of actions to take include running a custom function or opening
a [dialog](https://developers.google.com/workspace/chat/dialogs)
in Google Chat.

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

### hasOnChangeAction

### clearOnChangeAction

### setOnChangeAction

What to do when a change occurs in the text input field. For example, a
user adding to the field or deleting text.

Examples of actions to take include running a custom function or opening
a [dialog](https://developers.google.com/workspace/chat/dialogs)
in Google Chat.

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

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

### getInitialSuggestions

Suggested values that users can enter. These values appear when users click
inside the text input field. As users type, the suggested values
dynamically filter to match what the users have typed.

For example, a text input field for programming language might suggest
Java, JavaScript, Python, and C++. When users start typing `Jav`, the list
of suggestions filters to show just `Java` and `JavaScript`.
Suggested values help guide users to enter values that your app can make
sense of. When referring to JavaScript, some users might enter `javascript`
and others `java script`. Suggesting `JavaScript` can standardize how users
interact with your app.
When specified, `TextInput.type` is always `SINGLE_LINE`, even if it's set
to `MULTIPLE_LINE`.
[Google Workspace
add-ons and Chat apps](https://developers.google.com/workspace/extend):

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

### hasInitialSuggestions

### clearInitialSuggestions

### setInitialSuggestions

Suggested values that users can enter. These values appear when users click
inside the text input field. As users type, the suggested values
dynamically filter to match what the users have typed.

For example, a text input field for programming language might suggest
Java, JavaScript, Python, and C++. When users start typing `Jav`, the list
of suggestions filters to show just `Java` and `JavaScript`.
Suggested values help guide users to enter values that your app can make
sense of. When referring to JavaScript, some users might enter `javascript`
and others `java script`. Suggesting `JavaScript` can standardize how users
interact with your app.
When specified, `TextInput.type` is always `SINGLE_LINE`, even if it's set
to `MULTIPLE_LINE`.
[Google Workspace
add-ons and Chat apps](https://developers.google.com/workspace/extend):

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

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

### getAutoCompleteAction

Optional. Specify what action to take when the text input field provides
suggestions to users who interact with it.

If unspecified, the suggestions are set by `initialSuggestions` and
are processed by the client.
If specified, the app takes the action specified here, such as running
a custom function.
[Google Workspace
add-ons](https://developers.google.com/workspace/add-ons):

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

### hasAutoCompleteAction

### clearAutoCompleteAction

### setAutoCompleteAction

Optional. Specify what action to take when the text input field provides
suggestions to users who interact with it.

If unspecified, the suggestions are set by `initialSuggestions` and
are processed by the client.
If specified, the app takes the action specified here, such as running
a custom function.
[Google Workspace
add-ons](https://developers.google.com/workspace/add-ons):

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

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

### getValidation

Specify the input format validation necessary for this text field.

[Google Workspace add-ons and Chat
apps](https://developers.google.com/workspace/extend):

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

### hasValidation

### clearValidation

### setValidation

Specify the input format validation necessary for this text field.

[Google Workspace add-ons and Chat
apps](https://developers.google.com/workspace/extend):

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

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

### getPlaceholderText

Text that appears in the text input field when the field is empty.

Use this text to prompt users to enter a value. For example, `Enter a
number from 0 to 100`.
[Google Chat apps](https://developers.google.com/workspace/chat):

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

### setPlaceholderText

Text that appears in the text input field when the field is empty.

Use this text to prompt users to enter a value. For example, `Enter a
number from 0 to 100`.
[Google Chat apps](https://developers.google.com/workspace/chat):

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

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