A card section holds groups of widgets and provides visual separation between them.
Available for Google Workspace Add-ons and Google Chat apps.
var image = CardService . newImage (); // Build image ... var textParagraph = CardService . newTextParagraph (); // Build text paragraph ... var cardSection = CardService . newCardSection () . setHeader ( "Section header" ) . addWidget ( image ) . addWidget ( textParagraph );
Methods
Method | Return type | Brief description |
---|---|---|
CardSection
|
Adds the given widget to this section. | |
CardSection
|
Sets whether the section can be collapsed. | |
CardSection
|
Sets the header of the section. | |
CardSection
|
Sets the number of widgets that are still shown when this section is collapsed. |
Detailed documentation
addWidget(widget)
Adds the given widget to this section. Widgets are shown in the order they were added. You can't add more than 100 widgets to a card section.
Parameters
Name | Type | Description |
---|---|---|
widget
|
Widget
|
A widget to add to the section. |
Return
CardSection
— This object, for chaining.
setCollapsible(collapsible)
Sets whether the section can be collapsed.
Parameters
Name | Type | Description |
---|---|---|
collapsible
|
Boolean
|
The collapsible setting. |
Return
CardSection
— This object, for chaining.
setHeader(header)
Sets the header of the section. Optional.
Parameters
Name | Type | Description |
---|---|---|
header
|
String
|
The header text. |
Return
CardSection
— This object, for chaining.
setNumUncollapsibleWidgets(numUncollapsibleWidgets)
Sets the number of widgets that are still shown when this section is collapsed. The widgets shown are always the first ones that were added.
Parameters
Name | Type | Description |
---|---|---|
numUncollapsibleWidgets
|
Integer
|
The number of widgets to show. |
Return
CardSection
— This object, for chaining.