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.
Google Workspace add-ons and Chat apps:
Generated from protobuf message google.apps.card.v1.DecoratedText
Namespace
Google \ Apps \ Card \ V1Methods
__construct
Constructor.
| Parameters | |
|---|---|
| Name | Description |
data |
array
Optional. Data for populating the Message object. |
↳ icon |
Icon
Deprecated in favor of |
↳ 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: |
↳ top_label |
string
The text that appears above |
↳ top_label_text |
TextParagraph
|
↳ text |
string
Required. The primary text. Supports simple formatting. For more information about formatting text, see Formatting text in Google Chat apps and Formatting text in Google Workspace add-ons. |
↳ content_text |
TextParagraph
|
↳ wrap_text |
bool
The wrap text setting. If |
↳ bottom_label |
string
The text that appears below |
↳ bottom_label_text |
TextParagraph
|
↳ on_click |
OnClick
This action is triggered when users click |
↳ 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 and custom 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.
| Returns | |
|---|---|
| Type | Description |
int |
Enum of type VerticalAlignment. |
setStartIconVerticalAlignment
Optional. Vertical alignment of the start icon. If not set, the icon will be vertically centered.
| Parameter | |
|---|---|
| Name | Description |
var |
int
Enum of type VerticalAlignment. |
| 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.
| Returns | |
|---|---|
| Type | Description |
TextParagraph|null |
|
hasTopLabelText
clearTopLabelText
setTopLabelText
TextParagraph equivalent of top_label. Always truncates. Allows for
more complex formatting than top_label.
| 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 and Formatting text in Google Workspace add-ons.
| 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 and Formatting text in Google Workspace add-ons.
| Parameter | |
|---|---|
| Name | Description |
var |
string
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getContentText
TextParagraph equivalent of text. Allows for more complex formatting
than text.
| Returns | |
|---|---|
| Type | Description |
TextParagraph|null |
|
hasContentText
clearContentText
setContentText
TextParagraph equivalent of text. Allows for more complex formatting
than text.
| 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.
| Returns | |
|---|---|
| Type | Description |
TextParagraph|null |
|
hasBottomLabelText
clearBottomLabelText
setBottomLabelText
TextParagraph equivalent of bottom_label. Always wraps. Allows for
more complex formatting than bottom_label.
| 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
| Returns | |
|---|---|
| Type | Description |
Icon|null |
|
hasEndIcon
setEndIcon
| Parameter | |
|---|---|
| Name | Description |
var |
Icon
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getControl
| Returns | |
|---|---|
| Type | Description |
string |
|