Google Apps Chat V1 Client - Class DecoratedText (0.7.1)

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

↳ top_label string

The text that appears above text. Always truncates.

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

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

↳ 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 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

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

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

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

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 and custom icons.

Returns
Type Description
Icon|null

hasEndIcon

setEndIcon

An icon displayed after the text.

Supports built-in and custom icons.

Parameter
Name Description
var Icon
Returns
Type Description
$this

getControl

Returns
Type Description
string