Class IconImage

  • IconImage allows you to use a predefined icon, a material design icon, or an icon from a URL with customizable crop style.

  • You can set alternative text for accessibility, choose from predefined icons, specify an icon URL, set the image crop type, and set a material design icon.

  • Methods likesetAltText,setIcon,setIconUrl,setImageCropType, andsetMaterialIcon are available to configure the IconImage.

IconImage

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

Methods

MethodReturn typeBrief description
setAltText(altText)IconImageSets the alternative text of the URL which is used for accessibility.
setIcon(icon)IconImageSets the predefined icon if the URL is not set.
setIconUrl(url)IconImageSets the URL of the icon if the icon is not set.
setImageCropType(imageCropType)IconImageSets the crop style for the image.
setMaterialIcon(icon)IconImageSets the material design icon.

Detailed documentation

setAltText(altText)

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

Parameters

NameTypeDescription
altTextStringThe alternative text.

Return

IconImage — This object, for chaining.


setIcon(icon)

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

Parameters

NameTypeDescription
iconIconOne of the predefinedIcon values.

Return

IconImage — This object, for chaining.


setIconUrl(url)

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

Parameters

NameTypeDescription
urlStringThe URL address of a hosted image to use as an icon.

Return

IconImage — This object, for chaining.


setImageCropType(imageCropType)

Sets the crop style for the image. The crop type options you can use for icons areSQUARE andCIRCLE. Default isSQUARE.

Parameters

NameTypeDescription
imageCropTypeImageCropTypeThe ImageCropType option to apply.

Return

IconImage — This object, for chaining.


setMaterialIcon(icon)

Sets the material design icon.

consticonImage=CardService.newIconImage().setMaterialIcon(CardService.newMaterialIcon().setName('search'),);

Parameters

NameTypeDescription
iconMaterialIconThe material icon.

Return

IconImage — 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.