Class ImageComponent

  • The ImageComponent is an image component that can be added to grid items.

  • This component is available for Google Workspace add-ons and Google Chat apps.

  • Key methods for the ImageComponent include setting alt text, border style, crop style, and image URL.

ImageComponent

An image component that can be added to grid items.

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

 const 
  
 ImageComponent 
  
 = 
  
 CardService 
 . 
 newImageComponent 
 () 
  
 . 
 setImageUrl 
 ( 
 'http://imageurl.ca' 
 ) 
  
 . 
 setAltText 
 ( 
 'YOUR ALT TEXT' 
 ) 
  
 . 
 setCropStyle 
 ( 
 CardService 
 . 
 newImageCropStyle 
 ()) 
  
 . 
 setBorderStyle 
 ( 
 CardService 
 . 
 newBorderStyle 
 ()); 

Methods

Method Return type Brief description
Image Component Sets the alternative text of the image.
Image Component Sets the border style applied to the image.
Image Component Sets the crop style for the image.
Image Component Sets the URL of the image.

Detailed documentation

setAltText(altText)

Sets the alternative text of the image.

Parameters

Name Type Description
alt Text
String The alt_text to set for the image.

Return

ImageComponent — This object, for chaining.


setBorderStyle(borderStyle)

Sets the border style applied to the image.

Parameters

Name Type Description
border Style
Border Style The BorderStyle object to apply.

Return

ImageComponent — This object, for chaining.


setCropStyle(imageCropStyle)

Sets the crop style for the image.

Parameters

Name Type Description
image Crop Style
Image Crop Style The ImageCropStyle object to apply.

Return

ImageComponent — This object, for chaining.


setImageUrl(url)

Sets the URL of the image.

Parameters

Name Type Description
url
String The URL.

Return

ImageComponent — This object, for chaining.

Create a Mobile Website
View Site in Mobile | Classic
Share by: