Hier wird das Button festgelegt, das für die Schaltfläche „Weniger anzeigen“ angezeigt wird. Optional. Muss zusammen mit der Schaltfläche zum Minimieren festgelegt werden.
Hier wird das Button festgelegt, das für die Schaltfläche „Mehr anzeigen“ angezeigt wird. Optional. Muss zusammen mit der Schaltfläche zum Minimieren festgelegt werden.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-07-26 (UTC)."],[[["\u003cp\u003eCollapseControl is a customizable control that allows users to collapse and expand content within Google Chat apps and Google Workspace Add-ons (in developer preview).\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can customize the appearance and behavior of the CollapseControl using methods to set collapse and expand buttons, as well as horizontal alignment.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003esetCollapseButton\u003c/code\u003e and \u003ccode\u003esetExpandButton\u003c/code\u003e methods allow for assigning custom buttons to control the expansion and collapse actions.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003esetHorizontalAlign\u003c/code\u003e method enables developers to control the horizontal positioning of the CollapseControl within its container.\u003c/p\u003e\n"]]],[],null,["# Class CollapseControl\n\nCollapseControl\n\nA customizable collapse and expand control.\n\nAvailable for Google Chat apps. In developer preview for Google Workspace add-ons.\n\n\n| **Developer Preview:** Available as part of the [Google Workspace Developer Preview Program](https://developers.google.com/workspace/preview), which grants early access to certain features.\n\n\u003cbr /\u003e\n\n```javascript\nconst collapseButton =\n CardService.newTextButton()\n .setTextButtonStyle(CardService.TextButtonStyle.BORDERLESS)\n .setText('Collapse');\n\nconst expandButton =\n CardService.newImageButton()\n .setImageButtonStyle(CardService.ImageButtonStyle.FILLED);\n\nconst collapseControl =\n CardService.newCollapseControl()\n .setHorizontalAlign(CardService.HorizontalAlignment.END)\n .setExpandButton(expandButton)\n .setCollapseButton(collapseButton);\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|-------------------------------------------------------------------------------------|----------------------|-----------------------------------------------------------------------------------------------------------------------|\n| [setCollapseButton(button)](#setCollapseButton(Button)) | [CollapseControl](#) | Sets the [Button](/apps-script/reference/card-service/button) that is displayed for \"show less\" button. |\n| [setExpandButton(button)](#setExpandButton(Button)) | [CollapseControl](#) | Sets the [Button](/apps-script/reference/card-service/button) that is displayed for \"show more\" button. |\n| [setHorizontalAlign(horizontalAlignment)](#setHorizontalAlign(HorizontalAlignment)) | [CollapseControl](#) | Sets the [HorizontalAlignment](/apps-script/reference/card-service/horizontal-alignment) of the [CollapseControl](#). |\n\nDetailed documentation\n----------------------\n\n### `set``Collapse``Button(button)`\n\nSets the [Button](/apps-script/reference/card-service/button) that is displayed for \"show less\" button. Optional. \n\nMust be set together with collapse button.\n\n```javascript\nconst collapseButton =\n CardService.newTextButton().setText('Collapse');\n\nconst collapseControl =\n CardService.newCollapseControl()\n .setCollapseButton(collapseButton);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|----------|------------------------------------------------------|-----------------------------|\n| `button` | [Button](/apps-script/reference/card-service/button) | The collapse button to set. |\n\n#### Return\n\n\n[CollapseControl](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Expand``Button(button)`\n\nSets the [Button](/apps-script/reference/card-service/button) that is displayed for \"show more\" button. Optional. \n\nMust be set together with collapse button.\n\n```javascript\nconst expandButton =\n CardService.newTextButton().setText('Expand');\n\nconst collapseControl =\n CardService.newCollapseControl()\n .setExpandButton(expandButton);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|----------|------------------------------------------------------|---------------------------|\n| `button` | [Button](/apps-script/reference/card-service/button) | The expand button to set. |\n\n#### Return\n\n\n[CollapseControl](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Horizontal``Align(horizontalAlignment)`\n\nSets the [HorizontalAlignment](/apps-script/reference/card-service/horizontal-alignment) of the [CollapseControl](#). Optional. \\*\n\n```javascript\nconst collapseControl = CardService.newCollapseControl().setHorizontalAlign(\n CardService.HorizontalAlignment.START,\n);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|-------------------------|---------------------------------------------------------------------------------|---------------------------------------------------------|\n| `horizontal``Alignment` | [HorizontalAlignment](/apps-script/reference/card-service/horizontal-alignment) | The horizontal alignment of the CollapseControl widget. |\n\n#### Return\n\n\n[CollapseControl](#) --- This object, for chaining."]]