IconImage

A predefined icon, a material design icon, or an icon from a URL with a customizable crop style.

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/card-service/icon-image#setAltText(String)` | `https://developers.google.com/apps-script/reference/card-service/icon-image#` | Sets the alternative text of the URL which is used for accessibility. |
| `https://developers.google.com/apps-script/reference/card-service/icon-image#setIcon(Icon)` | `https://developers.google.com/apps-script/reference/card-service/icon-image#` | Sets the predefined icon if the URL is not set. |
| `https://developers.google.com/apps-script/reference/card-service/icon-image#setIconUrl(String)` | `https://developers.google.com/apps-script/reference/card-service/icon-image#` | Sets the URL of the icon if the icon is not set. |
| `https://developers.google.com/apps-script/reference/card-service/icon-image#setImageCropType(ImageCropType)` | `https://developers.google.com/apps-script/reference/card-service/icon-image#` | Sets the crop style for the image. |
| `https://developers.google.com/apps-script/reference/card-service/icon-image#setMaterialIcon(MaterialIcon)` | `https://developers.google.com/apps-script/reference/card-service/icon-image#` | Sets the material design icon. |

## Detailed documentation

### `setAltText(altText)`

Sets the alternative text of the URL which is used for accessibility.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `altText` | `String` | The alternative text. |

#### Return


`https://developers.google.com/apps-script/reference/card-service/icon-image#` --- This object, for chaining.

*** ** * ** ***

### `setIcon(icon)`

Sets the predefined icon if the URL is not set. Default is NONE.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `icon` | `https://developers.google.com/apps-script/reference/card-service/icon` | One of the predefined `https://developers.google.com/apps-script/reference/card-service/icon` values. |

#### Return


`https://developers.google.com/apps-script/reference/card-service/icon-image#` --- This object, for chaining.

*** ** * ** ***

### `setIconUrl(url)`

Sets the URL of the icon if the icon is not set.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `url` | `String` | The URL address of a hosted image to use as an icon. |

#### Return


`https://developers.google.com/apps-script/reference/card-service/icon-image#` --- This object, for chaining.

*** ** * ** ***

### `setImageCropType(imageCropType)`

Sets the crop style for the image. The crop type options you can use for icons are `SQUARE
` and `CIRCLE`. Default is `SQUARE`.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `imageCropType` | `https://developers.google.com/apps-script/reference/card-service/image-crop-type` | The ImageCropType option to apply. |

#### Return


`https://developers.google.com/apps-script/reference/card-service/icon-image#` --- This object, for chaining.

*** ** * ** ***

### `setMaterialIcon(icon)`

Sets the material design icon.

```javascript
const iconImage = CardService.newIconImage().setMaterialIcon(
    CardService.newMaterialIcon().setName('search'),
);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `icon` | `https://developers.google.com/apps-script/reference/card-service/material-icon` | The material icon. |

#### Return


`https://developers.google.com/apps-script/reference/card-service/icon-image#` --- This object, for chaining.