Class MaterialIcon Stay organized with collections Save and categorize content based on your preferences.
Page Summary
MaterialIcon is an object that supports all Google Font Icons and is available for Google Workspace add-ons and Google Chat apps.
You can set the name of the icon using
setName(), which is a required parameter.The appearance of the icon can be customized using methods like
setFill(),setGrade(), andsetWeight().setFill()determines if the icon is solid, whilesetGrade()andsetWeight()affect the thickness of the icon.
An object that supports allGoogle Font Icons.
Available for Google Workspace add-ons and Google Chat apps.
constmaterialIcon=CardService.newMaterialIcon().setName('search').setFill(true).setWeight(400).setGrade(0);
Methods
| Method | Return type | Brief description |
|---|---|---|
set | Material | Whether the icon renders as filled. |
set | Material | Weight and grade affect a symbol’s thickness. |
set | Material | Sets the name of the icon. |
set | Material | The stroke weight of the icon. |
Detailed documentation
setFill(fill)
Whether the icon renders as filled. Default value isfalse.
To preview different icon settings, go toGoogleFont Icons and adjust the settings underCustomize.
constmaterialIcon=CardService.newMaterialIcon().setName('search').setFill(true);
Parameters
| Name | Type | Description |
|---|---|---|
fill | Boolean | Whether the icon is filled. |
Return
Material — This object, for chaining.
setGrade(grade)
Weight and grade affect a symbol’s thickness. Adjustments to grade are more granular thanadjustments 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 isused.
To preview different icon settings, go toGoogleFont Icons and adjust the settings underCustomize.
constmaterialIcon=CardService.newMaterialIcon().setName('search').setGrade(200);
Parameters
| Name | Type | Description |
|---|---|---|
grade | Integer | The icon's grade. |
Return
Material — This object, for chaining.
setName(name)
Sets the name of the icon. Required.
The icon name defined inGoogle Font Icon, Forexample,check_box.
Any invalid names are abandoned and replaced with an empty string and results in the iconfailing to render.
constmaterialIcon=CardService.newMaterialIcon().setName('search');
Parameters
| Name | Type | Description |
|---|---|---|
name | String | The name of the icon. |
Return
Material — 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 toGoogleFont Icons and adjust the settings underCustomize.
constmaterialIcon=CardService.newMaterialIcon().setName('search').setWeight(700);
Parameters
| Name | Type | Description |
|---|---|---|
weight | Integer | The stroke weight of the icon. |
Return
Material — This object, for chaining.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-03 UTC.