Reference documentation and code samples for the Google Apps Chat V1 Client class Icon.
An icon displayed in a widget on a card. For an example in Google Chat apps, see Add an icon.
Supports built-in and custom icons. Google Workspace add-ons and Chat apps:
Generated from protobuf message google.apps.card.v1.Icon
Namespace
Google \ Apps \ Card \ V1Methods
__construct
Constructor.
| Parameters | |
|---|---|
| Name | Description |
data |
array
Optional. Data for populating the Message object. |
↳ known_icon |
string
Display one of the built-in icons provided by Google Workspace. For example, to display an airplane icon, specify |
↳ icon_url |
string
Display a custom icon hosted at an HTTPS URL. For example: |
↳ material_icon |
MaterialIcon
Display one of the Google Material Icons. For example, to display a checkbox icon, use |
↳ alt_text |
string
Optional. A description of the icon used for accessibility. If unspecified, the default value |
↳ image_type |
int
The crop style applied to the image. In some cases, applying a |
getKnownIcon
Display one of the built-in icons provided by Google Workspace.
For example, to display an airplane icon, specify AIRPLANE.
For a bus, specify BUS.
For a full list of supported icons, see built-in
icons.
| Returns | |
|---|---|
| Type | Description |
string |
|
hasKnownIcon
setKnownIcon
Display one of the built-in icons provided by Google Workspace.
For example, to display an airplane icon, specify AIRPLANE.
For a bus, specify BUS.
For a full list of supported icons, see built-in
icons.
| Parameter | |
|---|---|
| Name | Description |
var |
string
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getIconUrl
Display a custom icon hosted at an HTTPS URL.
For example:
"iconUrl":
"https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png"
Supported file types include .png and .jpg.
| Returns | |
|---|---|
| Type | Description |
string |
|
hasIconUrl
setIconUrl
Display a custom icon hosted at an HTTPS URL.
For example:
"iconUrl":
"https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png"
Supported file types include .png and .jpg.
| Parameter | |
|---|---|
| Name | Description |
var |
string
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getMaterialIcon
Display one of the Google Material Icons.
For example, to display a checkbox icon, use
"material_icon": {
"name": "check_box"
}
| Returns | |
|---|---|
| Type | Description |
MaterialIcon|null |
|
hasMaterialIcon
setMaterialIcon
Display one of the Google Material Icons.
For example, to display a checkbox icon, use
"material_icon": {
"name": "check_box"
}
| Parameter | |
|---|---|
| Name | Description |
var |
MaterialIcon
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getAltText
Optional. A description of the icon used for accessibility.
If unspecified, the default value Button is provided. As a best practice,
you should set a helpful description for what the icon displays, and if
applicable, what it does. For example, A user's account portrait, or
Opens a new browser tab and navigates to the Google Chat developer
documentation at https://developers.google.com/workspace/chat.
If the icon is set in a Button, the
altText appears as helper text when the user hovers over the button.
However, if the button also sets text, the icon's altText is ignored.
| Returns | |
|---|---|
| Type | Description |
string |
|
setAltText
Optional. A description of the icon used for accessibility.
If unspecified, the default value Button is provided. As a best practice,
you should set a helpful description for what the icon displays, and if
applicable, what it does. For example, A user's account portrait, or
Opens a new browser tab and navigates to the Google Chat developer
documentation at https://developers.google.com/workspace/chat.
If the icon is set in a Button, the
altText appears as helper text when the user hovers over the button.
However, if the button also sets text, the icon's altText is ignored.
| Parameter | |
|---|---|
| Name | Description |
var |
string
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getImageType
The crop style applied to the image. In some cases, applying a
CIRCLE crop causes the image to be drawn larger than a built-in
icon.
| Returns | |
|---|---|
| Type | Description |
int |
Enum of type ImageType. |
setImageType
The crop style applied to the image. In some cases, applying a
CIRCLE crop causes the image to be drawn larger than a built-in
icon.
| Parameter | |
|---|---|
| Name | Description |
var |
int
Enum of type ImageType. |
| Returns | |
|---|---|
| Type | Description |
$this |
|
getIcons
| Returns | |
|---|---|
| Type | Description |
string |
|