Class Carousel

  • Carousel displays a list of widgets in a slideshow format with navigation buttons.

  • Carousels are available for Google Workspace add-ons and Google Chat apps.

  • The addCarouselCard(card) method is used to add a card to the carousel.

Carousel

Carousel, also known as slider, rotates and displays a list of widgets in a slideshow format, with buttons navigating to the previous or next widget.

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

 const 
  
 carousel 
  
 = 
  
 CardService 
 . 
 newCarousel 
 () 
  
 . 
 addCarouselCard 
 ( 
 CardService 
 . 
 newCarouselCard 
 (). 
 addWidget 
 ( 
  
 CardService 
 . 
 newTextParagraph 
 (). 
 setText 
 ( 
 'The first text paragraph in carousel' 
 ))) 
  
 . 
 addCarouselCard 
 ( 
 CardService 
 . 
 newCarouselCard 
 (). 
 addWidget 
 ( 
  
 CardService 
 . 
 newTextParagraph 
 (). 
 setText 
 ( 
 'The second text paragraph in carousel' 
 ))) 
  
 . 
 addCarouselCard 
 ( 
 CardService 
 . 
 newCarouselCard 
 (). 
 addWidget 
 ( 
  
 CardService 
 . 
 newTextParagraph 
 (). 
 setText 
 ( 
 'The third text paragraph in carousel' 
 ))) 

Methods

Method Return type Brief description
Carousel Adds a carousel card.
Widget Adds the event action that can be performed on the widget.
Widget Sets the unique ID assigned that's used to identify the widget to be mutated.
Widget Sets the visibility of the widget.

Detailed documentation

add Carousel Card(card)

Adds a carousel card.

 const 
  
 carousel 
  
 = 
  
 CardService 
 . 
 newCarousel 
 () 
  
 . 
 addCarouselCard 
 ( 
 CardService 
 . 
 newCarouselCard 
 (). 
 addWidget 
 ( 
  
 CardService 
 . 
 newTextParagraph 
 (). 
 setText 
 ( 
 'The first text paragraph in carousel' 
 ))); 

Parameters

Name Type Description
card
Carousel Card The carousel card to add.

Return

Carousel — This object, for chaining.


add Event Action(eventAction)

Adds the event action that can be performed on the widget.

Parameters

Name Type Description
event Action
Event Action The Event Action to be added.

Return

Widget — The Object, for chaining.


set Id(id)

Sets the unique ID assigned that's used to identify the widget to be mutated. Widget mutation is only supported in Add-Ons.

Parameters

Name Type Description
id
String The id of the widget, with a limit of 64 characters and in format of `[a-zA-Z0-9-]+`.

Return

Widget — This object, for chaining.


set Visibility(visibility)

Sets the visibility of the widget. The default value is `VISIBLE`.

Parameters

Name Type Description
visibility
Visibility The Visibility of the widget.

Return

Widget — The Object, for chaining.

Design a Mobile Site
View Site in Mobile | Classic
Share by: