MaterialIcon

An object that supports all [Google Font Icons](https://fonts.google.com/icons).

Available for Google Workspace add-ons and Google Chat apps.

```javascript
const materialIcon = CardService.newMaterialIcon()
                         .setName('search')
                         .setFill(true)
                         .setWeight(400)
                         .setGrade(0);
```

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/card-service/material-icon#setFill(Boolean)` | `https://developers.google.com/apps-script/reference/card-service/material-icon#` | Whether the icon renders as filled. |
| `https://developers.google.com/apps-script/reference/card-service/material-icon#setGrade(Integer)` | `https://developers.google.com/apps-script/reference/card-service/material-icon#` | Weight and grade affect a symbol's thickness. |
| `https://developers.google.com/apps-script/reference/card-service/material-icon#setName(String)` | `https://developers.google.com/apps-script/reference/card-service/material-icon#` | Sets the name of the icon. |
| `https://developers.google.com/apps-script/reference/card-service/material-icon#setWeight(Integer)` | `https://developers.google.com/apps-script/reference/card-service/material-icon#` | The stroke weight of the icon. |

## Detailed documentation

### `setFill(fill)`

Whether the icon renders as filled. Default value is `false`.

To preview different icon settings, go to [Google
Font Icons](https://fonts.google.com/icons) and adjust the settings under **Customize**.

```javascript
const materialIcon =
    CardService.newMaterialIcon().setName('search').setFill(true);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `fill` | `Boolean` | Whether the icon is filled. |

#### Return


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

*** ** * ** ***

### `setGrade(grade)`

Weight and grade affect a symbol's thickness. Adjustments to grade are more granular than
adjustments to weight and have a small impact on the size of the symbol. Choose from {-25, 0,
200}. If absent, default value is 0. If any other value is specified, the default value is
used.

To preview different icon settings, go to [Google
Font Icons](https://fonts.google.com/icons) and adjust the settings under **Customize**.

```javascript
const materialIcon =
    CardService.newMaterialIcon().setName('search').setGrade(200);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `grade` | `Integer` | The icon's grade. |

#### Return


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

*** ** * ** ***

### `setName(name)`

Sets the name of the icon. Required.

The icon name defined in [Google Font Icon](https://fonts.google.com/icons), For
example, `check_box`.

Any invalid names are abandoned and replaced with an empty string and results in the icon
failing to render.

```javascript
const materialIcon = CardService.newMaterialIcon().setName('search');
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `name` | `String` | The name of the icon. |

#### Return


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

*** ** * ** ***

### `setWeight(weight)`

The stroke weight of the icon. Choose from {100, 200, 300, 400, 500, 600, 700}. If absent,
default value is 400. If any other value is specified, the default value is used.

To preview different icon settings, go to [Google
Font Icons](https://fonts.google.com/icons) and adjust the settings under **Customize**.

```javascript
const materialIcon =
    CardService.newMaterialIcon().setName('search').setWeight(700);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `weight` | `Integer` | The stroke weight of the icon. |

#### Return


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