A customizable collapse and expand control.
Only available for Google Chat apps. Not available for Google Workspace Add-ons.
const collapseButton = CardService.newTextButton() .setTextButtonStyle(CardService.TextButtonStyle.BORDERLESS) .setText('less less') .setMaterialIcon(CardService.newMaterialIcon().setName('bug_report')); const expandButton = CardService.newImageButton() .setImageButtonStyle(CardService.ImageButtonStyle.FILLED) .setMaterialIcon(CardService.newMaterialIcon().setName('bug_report')); const collapseControl = CardService.newCollapseControl() .setHorizontalAlign(CardService.HorizontalAlignment.END) .setExpandButton(expandButton) .setCollapseButton(collapseButton);
Methods
Method | Return type | Brief description |
---|---|---|
setCollapseButton(button) | CollapseControl | Sets the Button that is displayed for "show less" button. |
setExpandButton(button) | CollapseControl | Sets the Button that is displayed for "show more" button. |
setHorizontalAlign(horizontalAlignment) | CollapseControl | Sets the HorizontalAlignment of the CollapseControl . |
Detailed documentation
setCollapseButton(button)
Sets the Button
that is displayed for "show less" button. Optional.
Must be set together with collapse button.
const collapseControl = CardService.newCollapseControl().setCollapseButton(collapseButton);
Parameters
Name | Type | Description |
---|---|---|
button | Button | The collapse button to set. |
Return
CollapseControl
— This object, for chaining.
setExpandButton(button)
Sets the Button
that is displayed for "show more" button. Optional.
Must be set together with collapse button.
const collapseControl = CardService.newCollapseControl().setExpandButton(expandButton);
Parameters
Name | Type | Description |
---|---|---|
button | Button | The expand button to set. |
Return
CollapseControl
— This object, for chaining.
setHorizontalAlign(horizontalAlignment)
Sets the HorizontalAlignment
of the CollapseControl
. Optional. *
const collapseControl = CardService.newCollapseControl().setHorizontalAlign( CardService.HorizontalAlignment.START, );
Parameters
Name | Type | Description |
---|---|---|
horizontalAlignment | HorizontalAlignment | The horizontal alignment of the CollapseControl widget. |
Return
CollapseControl
— This object, for chaining.