Class ButtonSet
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
BoutonDéfinir
Contient un ensemble d'objets Button
affichés sur une ligne.
Disponible pour les modules complémentaires Google Workspace et les applications Google Chat.
const textButton = CardService.newTextButton();
// Finish building the text button...
const imageButton = CardService.newImageButton();
// Finish building the image button...
const buttonSet =
CardService.newButtonSet().addButton(textButton).addButton(imageButton);
Documentation détaillée
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/26 (UTC).
[null,null,["Dernière mise à jour le 2025/07/26 (UTC)."],[[["\u003cp\u003e\u003ccode\u003eButtonSet\u003c/code\u003e objects organize and display a row of \u003ccode\u003eButton\u003c/code\u003e objects within Google Workspace Add-ons and Google Chat apps.\u003c/p\u003e\n"],["\u003cp\u003eYou can add buttons, which can be either text-based or image-based, to a \u003ccode\u003eButtonSet\u003c/code\u003e using the \u003ccode\u003eaddButton()\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eaddButton()\u003c/code\u003e method allows for building the layout by adding \u003ccode\u003eButton\u003c/code\u003e objects and facilitating chained operations for efficient design.\u003c/p\u003e\n"]]],["The `ButtonSet` object holds and displays a row of `Button` objects. You can create a `ButtonSet` using `CardService.newButtonSet()`. To add buttons, use the `addButton(button)` method, passing in a `Button` object. This method can be chained to add multiple buttons sequentially. `addButton` returns the `ButtonSet` object itself. This functionality is available for Google Workspace add-ons and Google Chat apps.\n"],null,["# Class ButtonSet\n\nButtonSet\n\nHolds a set of [Button](/apps-script/reference/card-service/button) objects that are displayed in a row.\n\nAvailable for Google Workspace add-ons and Google Chat apps.\n\n```javascript\nconst textButton = CardService.newTextButton();\n// Finish building the text button...\n\nconst imageButton = CardService.newImageButton();\n// Finish building the image button...\n\nconst buttonSet =\n CardService.newButtonSet().addButton(textButton).addButton(imageButton);\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|-----------------------------------------|----------------|-------------------|\n| [addButton(button)](#addButton(Button)) | [ButtonSet](#) | Adds a button. |\n\nDetailed documentation\n----------------------\n\n### `add``Button(button)`\n\nAdds a button.\n\n#### Parameters\n\n| Name | Type | Description |\n|----------|------------------------------------------------------|--------------------|\n| `button` | [Button](/apps-script/reference/card-service/button) | The button to add. |\n\n#### Return\n\n\n[ButtonSet](#) --- This object, for chaining."]]