Index
Action
(message)Action.ActionParameter
(message)Action.LoadIndicator
(enum)BorderStyle
(message)BorderStyle.BorderType
(enum)Button
(message)ButtonList
(message)Card
(message)Card.CardAction
(message)Card.CardFixedFooter
(message)Card.CardHeader
(message)Card.DisplayStyle
(enum)Card.Section
(message)DateTimePicker
(message)DateTimePicker.DateTimePickerType
(enum)DecoratedText
(message)DecoratedText.SwitchControl
(message)DecoratedText.SwitchControl.ControlType
(enum)Divider
(message)GetAutocompletionResponse
(message)Grid
(message)Grid.GridItem
(message)Grid.GridItem.GridItemLayout
(enum)Icon
(message)Image
(message)ImageComponent
(message)ImageCropStyle
(message)ImageCropStyle.ImageCropType
(enum)Navigation
(message)Notification
(message)OnClick
(message)OpenLink
(message)OpenLink.OnClose
(enum)OpenLink.OpenAs
(enum)RenderActions
(message)RenderActions.Action
(message)SelectionInput
(message)SelectionInput.SelectionItem
(message)SelectionInput.SelectionType
(enum)SubmitFormResponse
(message)Suggestions
(message)Suggestions.SuggestionItem
(message)TextInput
(message)TextInput.Type
(enum)TextParagraph
(message)Widget
(message)Widget.HorizontalAlignment
(enum)Widget.ImageType
(enum)
Action
An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form.
Fields | |
---|---|
function |
Apps Script function to invoke when the containing element is clicked/activated. |
parameters[] |
List of action parameters. |
loadIndicator |
Specifies the loading indicator that the action displays while making the call to the action. |
persistValues |
Indicates whether form values persist after the action. The default value is If If |
ActionParameter
List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
Fields | |
---|---|
key |
The name of the parameter for the action script. |
value |
The value of the parameter. |
LoadIndicator
Specifies the loading indicator that the action displays while making the call to the action.
Enums | |
---|---|
SPINNER |
Displays a spinner to indicate that content is loading. |
NONE |
Nothing is displayed. |
BorderStyle
Represents the complete border style applied to widgets.
Fields | |
---|---|
type |
The border type. |
strokeColor |
The colors to use when the type is |
cornerRadius |
The corner radius for the border. |
BorderType
Represents the border types applied to widgets.
Enums | |
---|---|
BORDER_TYPE_UNSPECIFIED |
No value specified. |
NO_BORDER |
No border. |
STROKE |
Outline. |
Button
A button. Can be a text button or an image button.
Fields | |
---|---|
text |
The text of the button. |
icon |
The icon image. |
color |
If set, the button is filled with a solid background. |
onClick |
The action to perform when the button is clicked. |
disabled |
If |
altText |
The alternative text used for accessibility. Has no effect when an icon is set; use |
ButtonList
A list of buttons layed out horizontally.
Fields | |
---|---|
buttons[] |
An array of buttons. |
Card
A card is a UI element that can contain UI widgets such as text and images. For more information, see Cards . For example, the following JSON creates a card that has a header with the name, position, icons, and link for a contact, followed by a section with contact information like email and phone number.
{
"header": {
"title": "Heba Salam",
"subtitle": "Software Engineer",
"imageStyle": "ImageStyle.AVATAR",
"imageUrl": "https://example.com/heba_salam.png",
"imageAltText": "Avatar for Heba Salam"
},
"sections" : [
{
"header": "Contact Info",
"widgets": [
{
"decoratedText": {
"icon": {
"knownIcon": "EMAIL"
},
"content": "heba.salam@example.com"
}
},
{
"decoratedText": {
"icon": {
"knownIcon": "PERSON"
},
"content": "<font color=\"#80e27e\">Online</font>"
}
},
{
"decoratedText": {
"icon": {
"knownIcon": "PHONE"
},
"content": "+1 (555) 555-1234"
}
},
{
"buttons": [
{
"textButton": {
"text": "Share",
},
"onClick": {
"openLink": {
"url": "https://example.com/share"
}
}
},
{
"textButton": {
"text": "Edit",
},
"onClick": {
"action": {
"function": "goToView",
"parameters": [
{
"key": "viewType",
"value": "EDIT"
}
],
"loadIndicator": "LoadIndicator.SPINNER"
}
}
}
]
}
],
"collapsible": true,
"uncollapsibleWidgetsCount": 3
}
],
"cardActions": [
{
"actionLabel": "Send Feedback",
"onClick": {
"openLink": {
"url": "https://example.com/feedback"
}
}
}
],
"name": "contact-card-K3wB6arF2H9L"
}
Fields | |
---|---|
header |
The header of the card. A header usually contains a title and an image. |
sections[] |
Sections are separated by a line divider. |
cardActions[] |
The card's actions. Actions are added to the card's generated toolbar menu. For example, the following JSON constructs a card action menu with Settings and Send Feedback options:
|
name |
Name of the card. Used as a card identifier in card navigation. |
fixedFooter |
The fixed footer shown at the bottom of this card. |
displayStyle |
The display style for |
peekCardHeader |
When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. |
CardAction
A card action is the action associated with the card. For example, an invoice card might include actions such as delete invoice, email invoice, or open the invoice in a browser.
Fields | |
---|---|
actionLabel |
The label that displays as the action menu item. |
onClick |
The |
CardHeader
Represents a card header.
Fields | |
---|---|
title |
Required. The title of the card header. The header has a fixed height: if both a title and subtitle are specified, each takes up one line. If only the title is specified, it takes up both lines. |
subtitle |
The subtitle of the card header. |
imageType |
The image's type. |
imageUrl |
The URL of the image in the card header. |
imageAltText |
The alternative text of this image which is used for accessibility. |
DisplayStyle
Determines how a card is displayed.The default DisplayStyle
is REPLACE
.
Enums | |
---|---|
DISPLAY_STYLE_UNSPECIFIED |
Default value. Do not use. |
PEEK |
The header of the card appears at the bottom of the sidebar, partially covering the current top card of the stack. Clicking the header pops the card into the card stack. If the card has no header, a generated header is used instead. |
REPLACE |
The card is shown by replacing the view of the top card in the card stack. |
Section
A section contains a collection of widgets that are rendered vertically in the order that they are specified. Across all platforms, cards have a narrow fixed width, so there is currently no need for layout properties, for example, float.
Fields | |
---|---|
header |
The header of the section. Formatted text is supported. |
widgets[] |
A section must contain at least 1 widget. |
collapsible |
Indicates whether this section is collapsible. If a section is collapsible, the description must be given. |
uncollapsibleWidgetsCount |
The number of uncollapsible widgets. For example, when a section contains five widgets and the |
DateTimePicker
The widget that lets users to specify a date and time. Not supported by Google Chat apps.
Fields | |
---|---|
name |
The name of the text input that's used in |
label |
The label for the field that displays to the user. |
type |
The type of the date/time picker. |
valueMsEpoch |
The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For |
timezoneOffsetDate |
The number representing the time zone offset from UTC, in minutes. If set, the |
onChangeAction |
Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation. |
DateTimePickerType
The type of the date/time picker.
Enums | |
---|---|
DATE_AND_TIME |
The user can select a date and time. |
DATE_ONLY |
The user can only select a date. |
TIME_ONLY |
The user can only select a time. |
DecoratedText
A widget that displays text with optional decorations such as a label above or below the text, an icon in front of the text, a selection widget or a button after the text.
Fields | |
---|---|
icon |
Deprecated in favor of startIcon. |
startIcon |
The icon displayed in front of the text. |
topLabel |
The formatted text label that shows above the main text. |
text |
Required. The main widget formatted text. See Text formatting for details. |
wrapText |
The wrap text setting. If |
bottomLabel |
The formatted text label that shows below the main text. |
onClick |
Only the top and bottom label and content region are clickable. |
Union field control . A control widget or image that appears after the text. You can set a button, switch control, or image, but not more than one. control can be only one of the following: |
|
button |
A button that can be clicked to trigger an action. |
switchControl |
A switch widget can be clicked to change its state or trigger an action. |
endIcon |
An icon displayed after the text. |
SwitchControl
Either a toggle-style switch or a checkbox.
Fields | |
---|---|
name |
The name of the switch widget that's used in |
value |
The value is what is passed back in the callback. |
selected |
If the switch is selected. |
onChangeAction |
The action when the switch state is changed. |
controlType |
The control type, either switch or checkbox. |
ControlType
The switch type shown in client.
Enums | |
---|---|
SWITCH |
A toggle-style switch. |
CHECKBOX |
Deprecated in favor of CHECK_BOX . |
CHECK_BOX |
A checkbox. |
Divider
A divider that appears in between widgets.
GetAutocompletionResponse
A response to getting autocomplete container, which includes elements necessary for showing auto complete items for text field. For example:
{
"autoComplete": {
"items": [
{
"text": "C++"
},
{
"text": "Java"
},
{
"text": "JavaScript"
},
{
"text": "Python"
}
]
}
}
Fields | |
---|---|
autoComplete |
|
schema |
This is a no-op schema field that might be present in the markup for syntax checking. |
Grid
Represents a Grid widget that displays items in a configurable grid layout.
Fields | |
---|---|
title |
The text that displays in the grid header. |
items[] |
The items to display in the grid. |
borderStyle |
The border style to apply to each grid item. |
columnCount |
The number of columns to display in the grid. A default value is used if this field isn't specified, and that default value is different depending on where the grid is shown (dialog versus companion). |
onClick |
This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters. |
GridItem
Represents a single item in the grid layout.
Fields | |
---|---|
id |
A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters. |
image |
The image that displays in the grid item. |
title |
The grid item's title. |
subtitle |
The grid item's subtitle. |
textAlignment |
The horizontal alignment of the grid item's text. |
layout |
The layout to use for the grid item. |
GridItemLayout
Represents the various layout options available for a grid item.
Enums | |
---|---|
GRID_ITEM_LAYOUT_UNSPECIFIED |
No layout specified. |
TEXT_BELOW |
The title and subtitle are shown below the grid item's image. |
TEXT_ABOVE |
The title and subtitle are shown above the grid item's image. |
Icon
Fields | |
---|---|
altText |
The description of the icon, used for accessibility. The default value is provided if you don't specify one. |
imageType |
The crop style applied to the image. In some cases, applying a |
Union field icons . The icon, can be specified by KnownIcon string or a URL. icons can be only one of the following: |
|
knownIcon |
The icon specified by the string name of a list of known icons. |
iconUrl |
The icon specified by a URL. |
Image
An image that is specified by a URL and can have an onClick
action.
Fields | |
---|---|
imageUrl |
An image URL. |
onClick |
The action triggered by an |
altText |
The alternative text of this image, used for accessibility. |
ImageComponent
Represents an image.
Fields | |
---|---|
imageUri |
The image URL. |
altText |
The accessibility label for the image. |
cropStyle |
The crop style to apply to the image. |
borderStyle |
The border style to apply to the image. |
ImageCropStyle
Represents the crop style applied to an image.
Fields | |
---|---|
type |
The crop type. |
aspectRatio |
The aspect ratio to use if the crop type is |
ImageCropType
Represents the crop style applied to an image.
Enums | |
---|---|
IMAGE_CROP_TYPE_UNSPECIFIED |
No value specified. |
SQUARE |
Applies a square crop. |
CIRCLE |
Applies a circular crop. |
RECTANGLE_CUSTOM |
Applies a rectangular crop with a custom aspect ratio. |
RECTANGLE_4_3 |
Applies a rectangular crop with a 4:3 aspect ratio. |
Notification
Card action that displays a notification in the host app.
Fields | |
---|---|
text |
Plain text to display for the notification, without HTML tags. |
OnClick
Represents the response to an onClick
event.
Fields | |
---|---|
Union field
|
|
action |
If specified, an action is triggered by this |
openLink |
If specified, this |
openDynamicLinkAction |
An add-on triggers this action when the action needs to open a link. This differs from the |
card |
A new card is pushed to the card stack after clicking if specified. |
OpenLink
Represents an onClick
event that opens a hyperlink.
Fields | |
---|---|
url |
The URL to open. |
openAs |
How to open a link. Not supported by Chat apps. |
onClose |
Whether the client forgets about a link after opening it, or observes it until the window closes. Not supported by Chat apps. |
OnClose
When an OnClick opens a link, then the client either forgets about it or observes until the window closes. The implementation depends on the client platform capabilities.
OnClose might cause OpenAs to be ignored; if the client platform can't support both selected values together, OnClose takes precedence. Not supported by Chat apps.
Enums | |
---|---|
NOTHING |
Doesn’t reload the card after the child window closes. |
RELOAD |
Reloads the card after the child window closes. If used in conjunction with OpenAs.OVERLAY, the child window acts as a modal dialog and the main card is blocked until the child window closes. |
OpenAs
When an OnClick opens a link, then the client can either open it as a full size window (if that is the frame used by the client), or an overlay (such as a pop-up). The implementation depends on the client platform capabilities, and the value selected might be ignored if the client doesn't support it. FULL_SIZE
is supported by all clients. Not supported by Chat apps.
Enums | |
---|---|
FULL_SIZE |
The link opens as a full size window (if that's the frame used by the client. |
OVERLAY |
The link opens as an overlay, such as a pop-up. |
RenderActions
A set of render instructions that tells a card to perform an action and/or tells the add-on host app to perform an app-specific action.
Fields | |
---|---|
action |
|
hostAppAction |
Actions handled by individual host apps. |
schema |
This is a no-op schema field that might be present in the markup for syntax checking. |
Action
Fields | |
---|---|
navigations[] |
Push, pop, or update displayed cards. |
link |
Immediately open the target link in a new tab or a pop-up. |
notification |
Display a notification to the end-user. |
SelectionInput
A widget that creates a UI item with options for users to select. For example, a dropdown menu.
Fields | |
---|---|
name |
The name of the text input which is used in |
label |
The label displayed ahead of the switch control. |
type |
The type of the selection. |
items[] |
An array of the selected items. |
onChangeAction |
If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button. |
SelectionItem
A selectable item in the switch control.
Fields | |
---|---|
text |
The text to be displayed. |
value |
The value associated with this item. The client should use this as a form input value. |
selected |
If more than one item is selected for |
SelectionType
The type of the selection.
Enums | |
---|---|
CHECK_BOX |
A checkbox. |
RADIO_BUTTON |
A radio button. |
SWITCH |
A switch. |
DROPDOWN |
A dropdown menu. |
SubmitFormResponse
A response to a form submit other than getting an autocomplete container, which contains the actions the card should perform and/or the add-on host app should perform, and whether the card's state has changed. For example:
{
"renderActions": {
"action": {
"notification": {
"text": "Email address is added: salam.heba@example.com"
}
},
"hostAppAction": {
"gmailAction": {
"openCreatedDraftAction": {
"draftId": "msg-a:r-79766936926021702",
"threadServerPermId": "thread-f:15700999851086004"
}
}
}
}
}
Fields | |
---|---|
renderActions |
A set of render instructions that tells the card to perform an action and/or tells the add-on host app to perform an app-specific action. |
stateChanged |
Whether the state of the cards has changed and data in existing cards is stale. |
schema |
This is a no-op schema field that may be present in the markup for syntax checking. |
Suggestions
A container wrapping elements necessary for showing suggestion items used in text input autocomplete.
Fields | |
---|---|
items[] |
A list of suggestions used for autocomplete recommendations. |
SuggestionItem
A suggestion item.
Fields | |
---|---|
text |
The suggested autocomplete result. |
TextInput
A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions.
Fields | |
---|---|
name |
The name of the text input which is used in |
label |
At least one of label and hintText must be specified. |
hintText |
The hint text. |
value |
The default value when there is no input from the user. |
type |
The style of the text, for example, a single line or multiple lines. |
onChangeAction |
The onChange action, for example, invoke a function. |
initialSuggestions |
The initial suggestions made before any user input. |
autoCompleteAction |
The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items. |
Type
The style of the text, for example, a single line or multiple lines.
Enums | |
---|---|
SINGLE_LINE |
The text is put into a single line. |
MULTIPLE_LINE |
The text is put into multiple lines. |
TextParagraph
A paragraph of text that supports formatting. See Text formatting for details.
Fields | |
---|---|
text |
The text that's shown in the widget. |
Widget
A widget is a UI element that presents texts, images, etc.
Fields | |
---|---|
horizontalAlignment |
The horizontal alignment of this widget. |
Union field data . A widget can only have one of the following items. You can use multiple widget fields to display more items. data can be only one of the following: |
|
textParagraph |
Displays a text paragraph in this widget. For example, the following JSON creates a bolded text:
|
image |
Displays an image in this widget. For example, the following JSON creates an image with alternative text:
|
decoratedText |
Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address:
|
buttonList |
A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link:
|
textInput |
Displays a text input in this widget. For example, the following JSON creates a text input for mail address:
As another example, the following JSON creates a text input for programming language with static suggestions:
|
selectionInput |
Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size:
|
dateTimePicker |
Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time:
|
divider |
Displays a divider. For example, the following JSON creates a divider:
|
grid |
Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item:
|
HorizontalAlignment
The horizontal alignment determines the placement of the widget. By default, a widget is shown using alignment corresponding to the START
value, where START
corresponds to the left in left-to-right layouts, and the right in right-to-left layouts. The END
value corresponds to the right in left-to-right layouts, and the left in right-to-left layouts.
Enums | |
---|---|
HORIZONTAL_ALIGNMENT_UNSPECIFIED |
Unspecified alignment. |
START |
Alignment to the start position. |
CENTER |
Alignment to the center position. |
END |
Alignment to the end position. |
ImageType
The image type determines the cropping of the image that it is applied to. SQUARE
means that no cropping is applied, CIRCLE
applies a circular mask to the image.
Enums | |
---|---|
SQUARE |
Applies no cropping to the image. |
CIRCLE |
Applies a circular mask to the image. |