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

A widget that displays text with optional decorations such as a label above
or below the text, an icon in front of the text, a selection widget, or a
button after the text. For an example in
Google Chat apps, see [Display text with decorative
text](https://developers.google.com/workspace/chat/add-text-image-card-dialog#display_text_with_decorative_elements).

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

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

## Namespace

Google \\ Apps \\ Card \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ icon` | `Icon` Deprecated in favor of `startIcon`. |
| `↳ start_icon` | `Icon` The icon displayed in front of the text. |
| `↳ start_icon_vertical_alignment` | `int` Optional. Vertical alignment of the start icon. If not set, the icon will be vertically centered. [Google Chat apps](https://developers.google.com/workspace/chat): |
| `↳ top_label` | `string` The text that appears above `text`. Always truncates. |
| `↳ top_label_text` | `TextParagraph` `TextParagraph` equivalent of `top_label`. Always truncates. Allows for more complex formatting than `top_label`. [Google Chat apps](https://developers.google.com/workspace/chat): |
| `↳ text` | `string` Required. The primary text. Supports simple formatting. For more information about formatting text, see [Formatting text in Google Chat apps](https://developers.google.com/workspace/chat/format-messages#card-formatting) and [Formatting text in Google Workspace add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). |
| `↳ content_text` | `TextParagraph` `TextParagraph` equivalent of `text`. Allows for more complex formatting than `text`. [Google Chat apps](https://developers.google.com/workspace/chat): |
| `↳ wrap_text` | `bool` The wrap text setting. If `true`, the text wraps and displays on multiple lines. Otherwise, the text is truncated. Only applies to `text`, not `topLabel` and `bottomLabel`. |
| `↳ bottom_label` | `string` The text that appears below `text`. Always wraps. |
| `↳ bottom_label_text` | `TextParagraph` `TextParagraph` equivalent of `bottom_label`. Always wraps. Allows for more complex formatting than `bottom_label`. [Google Chat apps](https://developers.google.com/workspace/chat): |
| `↳ on_click` | `OnClick` This action is triggered when users click `topLabel` or `bottomLabel`. |
| `↳ button` | `Button` A button that a user can click to trigger an action. |
| `↳ switch_control` | `DecoratedText\SwitchControl` A switch widget that a user can click to change its state and trigger an action. |
| `↳ end_icon` | `Icon` An icon displayed after the text. Supports [built-in](https://developers.google.com/workspace/chat/format-messages#builtinicons) and [custom](https://developers.google.com/workspace/chat/format-messages#customicons) icons. |

### getIcon

Deprecated in favor of `startIcon`.

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

### hasIcon

### clearIcon

### setIcon

Deprecated in favor of `startIcon`.

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

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

### getStartIcon

The icon displayed in front of the text.

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

### hasStartIcon

### clearStartIcon

### setStartIcon

The icon displayed in front of the text.

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

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

### getStartIconVerticalAlignment

Optional. Vertical alignment of the start icon. If not set, the icon
will be vertically centered.

[Google Chat apps](https://developers.google.com/workspace/chat):

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

### setStartIconVerticalAlignment

Optional. Vertical alignment of the start icon. If not set, the icon
will be vertically centered.

[Google Chat apps](https://developers.google.com/workspace/chat):

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

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

### getTopLabel

The text that appears above `text`. Always truncates.

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

### setTopLabel

The text that appears above `text`. Always truncates.

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

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

### getTopLabelText

`TextParagraph` equivalent of `top_label`. Always truncates. Allows for
more complex formatting than `top_label`.

[Google Chat apps](https://developers.google.com/workspace/chat):

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

### hasTopLabelText

### clearTopLabelText

### setTopLabelText

`TextParagraph` equivalent of `top_label`. Always truncates. Allows for
more complex formatting than `top_label`.

[Google Chat apps](https://developers.google.com/workspace/chat):

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

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

### getText

Required. The primary text.

Supports simple formatting. For more information
about formatting text, see
[Formatting text in Google Chat
apps](https://developers.google.com/workspace/chat/format-messages#card-formatting)
and
[Formatting
text in Google Workspace
add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting).

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

### setText

Required. The primary text.

Supports simple formatting. For more information
about formatting text, see
[Formatting text in Google Chat
apps](https://developers.google.com/workspace/chat/format-messages#card-formatting)
and
[Formatting
text in Google Workspace
add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting).

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

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

### getContentText

`TextParagraph` equivalent of `text`. Allows for more complex formatting
than `text`.

[Google Chat apps](https://developers.google.com/workspace/chat):

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

### hasContentText

### clearContentText

### setContentText

`TextParagraph` equivalent of `text`. Allows for more complex formatting
than `text`.

[Google Chat apps](https://developers.google.com/workspace/chat):

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

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

### getWrapText

The wrap text setting. If `true`, the text wraps and displays on
multiple lines. Otherwise, the text is truncated.

Only applies to `text`, not `topLabel` and `bottomLabel`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setWrapText

The wrap text setting. If `true`, the text wraps and displays on
multiple lines. Otherwise, the text is truncated.

Only applies to `text`, not `topLabel` and `bottomLabel`.

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

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

### getBottomLabel

The text that appears below `text`. Always wraps.

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

### setBottomLabel

The text that appears below `text`. Always wraps.

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

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

### getBottomLabelText

`TextParagraph` equivalent of `bottom_label`. Always wraps. Allows for
more complex formatting than `bottom_label`.

[Google Chat apps](https://developers.google.com/workspace/chat):

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

### hasBottomLabelText

### clearBottomLabelText

### setBottomLabelText

`TextParagraph` equivalent of `bottom_label`. Always wraps. Allows for
more complex formatting than `bottom_label`.

[Google Chat apps](https://developers.google.com/workspace/chat):

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

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

### getOnClick

This action is triggered when users click `topLabel` or `bottomLabel`.

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

### hasOnClick

### clearOnClick

### setOnClick

This action is triggered when users click `topLabel` or `bottomLabel`.

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

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

### getButton

A button that a user can click to trigger an action.

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

### hasButton

### setButton

A button that a user can click to trigger an action.

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

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

### getSwitchControl

A switch widget that a user can click to change its state and trigger an
action.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `DecoratedText\SwitchControl|null` |   |

### hasSwitchControl

### setSwitchControl

A switch widget that a user can click to change its state and trigger an
action.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `DecoratedText\SwitchControl` |

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

### getEndIcon

An icon displayed after the text.

Supports
[built-in](https://developers.google.com/workspace/chat/format-messages#builtinicons)
and
[custom](https://developers.google.com/workspace/chat/format-messages#customicons)
icons.

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

### hasEndIcon

### setEndIcon

An icon displayed after the text.

Supports
[built-in](https://developers.google.com/workspace/chat/format-messages#builtinicons)
and
[custom](https://developers.google.com/workspace/chat/format-messages#customicons)
icons.

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

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

### getControl

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