Class ButtonSet

  • ButtonSet holds a set of Button objects displayed in a row.

  • ButtonSet is available for Google Workspace add-ons and Google Chat apps.

  • You can add a button to a ButtonSet using the addButton() method.

ButtonSet

Holds a set of Button objects that are displayed in a row.

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

consttextButton=CardService.newTextButton();
// Finish building the text button...
constimageButton=CardService.newImageButton();
// Finish building the image button...
constbuttonSet=
CardService.newButtonSet().addButton(textButton).addButton(imageButton);

Methods

MethodReturn typeBrief description
addButton(button) ButtonSet Adds a button.
addEventAction(eventAction) Widget Adds the event action that can be performed on the widget.
setId(id) Widget Sets the unique ID assigned that's used to identify the widget to be mutated.
setVisibility(visibility) Widget Sets the visibility of the widget.

Detailed documentation

addButton(button)

Adds a button.

Parameters

NameTypeDescription
buttonButton The button to add.

Return

ButtonSet — This object, for chaining.


addEventAction(eventAction)

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

Parameters

NameTypeDescription
eventActionEventAction The EventAction to be added.

Return

Widget — The Object, for chaining.


setId(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

NameTypeDescription
idStringThe id of the widget, with a limit of 64 characters and in format of `[a-zA-Z0-9-]+`.

Return

Widget — This object, for chaining.


setVisibility(visibility)

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

Parameters

NameTypeDescription
visibilityVisibility The Visibility of the widget.

Return

Widget — The Object, for chaining.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026年04月13日 UTC.