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

An icon displayed in a widget on a card. For an example in Google Chat apps,
see [Add an
icon](https://developers.google.com/workspace/chat/add-text-image-card-dialog#add_an_icon).

Supports
[built-in](https://developers.google.com/workspace/chat/format-messages#builtinicons)
and
[custom](https://developers.google.com/workspace/chat/format-messages#customicons)
icons.
[Google Workspace add-ons and Chat
apps](https://developers.google.com/workspace/extend):

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

## Namespace

Google \\ Apps \\ Card \\ V1

## Methods

### __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 `AIRPLANE`. For a bus, specify `BUS`. For a full list of supported icons, see [built-in icons](https://developers.google.com/workspace/chat/format-messages#builtinicons). |
| `↳ icon_url` | `string` 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`. |
| `↳ material_icon` | `MaterialIcon` Display one of the [Google Material Icons](https://fonts.google.com/icons). For example, to display a [checkbox icon](https://fonts.google.com/icons?selected=Material+Symbols+Outlined:check_box:FILL@0;wght@400;GRAD@0;opsz@48), use `"material_icon": { "name": "check_box" }` [Google Chat apps](https://developers.google.com/workspace/chat): |
| `↳ alt_text` | `string` 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`](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Card.V1.Button.md.txt), 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. |
| `↳ image_type` | `int` 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. |

### 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](https://developers.google.com/workspace/chat/format-messages#builtinicons).

| **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](https://developers.google.com/workspace/chat/format-messages#builtinicons).

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

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

### getIconUrl

Display a custom icon hosted at an HTTPS URL.

For example:

```php
"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:

```php
"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](https://fonts.google.com/icons).

For example, to display a [checkbox
icon](https://fonts.google.com/icons?selected=Material+Symbols+Outlined:check_box:FILL@0;wght@400;GRAD@0;opsz@48),
use

```php
"material_icon": {
  "name": "check_box"
}
```

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

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

### hasMaterialIcon

### setMaterialIcon

Display one of the [Google Material
Icons](https://fonts.google.com/icons).

For example, to display a [checkbox
icon](https://fonts.google.com/icons?selected=Material+Symbols+Outlined:check_box:FILL@0;wght@400;GRAD@0;opsz@48),
use

```php
"material_icon": {
  "name": "check_box"
}
```

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

| **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`](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Card.V1.Button.md.txt), 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`](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Card.V1.Button.md.txt), 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](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Card.V1.Widget.ImageType.md.txt). |

### 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](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Card.V1.Widget.ImageType.md.txt). |

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

### getIcons

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