Card
Cards support a defined layout, interactive UI elements like buttons, and rich media like images. Use cards to present detailed information, gather information from users, and guide users to take a next step.
In Google Chat, cards appear in several places:
- As stand-alone messages.
- Accompanying a text message, just beneath the text message.
- As a dialog .
The following example JSON creates a "contact card" that features:
- A header with the contact's name, job title, avatar picture.
- A section with the contact information, including formatted text.
- Buttons that users can click to share the contact or see more or less info.
{
"cardsV2": [
{
"cardId": "unique-card-id",
"card": {
"header": {
"title": "Sasha",
"subtitle": "Software Engineer",
"imageUrl":
"https://developers.google.com/chat/images/quickstart-app-avatar.png",
"imageType": "CIRCLE",
"imageAltText": "Avatar for Sasha",
},
"sections": [
{
"header": "Contact Info",
"collapsible": true,
"uncollapsibleWidgetsCount": 1,
"widgets": [
{
"decoratedText": {
"startIcon": {
"knownIcon": "EMAIL",
},
"text": "sasha@example.com",
}
},
{
"decoratedText": {
"startIcon": {
"knownIcon": "PERSON",
},
"text": "<font color=\"#80e27e\">Online</font>",
},
},
{
"decoratedText": {
"startIcon": {
"knownIcon": "PHONE",
},
"text": "+1 (555) 555-1234",
}
},
{
"buttonList": {
"buttons": [
{
"text": "Share",
"onClick": {
"openLink": {
"url": "https://example.com/share",
}
}
},
{
"text": "Edit",
"onClick": {
"action": {
"function": "goToView",
"parameters": [
{
"key": "viewType",
"value": "EDIT",
}
],
}
}
},
],
}
},
],
},
],
},
}
],
}
JSON representation |
---|
{ "header": { object ( |
Fields | |
---|---|
header
|
The header of the card. A header usually contains a leading image and a title. Headers always appear at the top of a card. |
sections[]
|
Contains a collection of widgets. Each section has its own, optional header. Sections are visually separated by a line divider. |
cardActions[]
|
The card's actions. Actions are added to the card's toolbar menu.
Because Chat app cards have no toolbar,
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. Because Chat apps don't support card navigation, they ignore this field. |
fixedFooter
|
The fixed footer shown at the bottom of this card.
Setting
Chat apps support
|
displayStyle
|
In Google Workspace add-ons, sets the display properties of the
Not supported by Chat apps. |
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. Not supported by Chat apps. |
CardHeader
Represents a card header.
JSON representation |
---|
{
"title": string,
"subtitle": string,
"imageType": enum (
|
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. If specified, appears on its own line below the
|
imageType
|
The shape used to crop the image. |
imageUrl
|
The HTTPS URL of the image in the card header. |
imageAltText
|
The alternative text of this image which is used for accessibility. |
ImageType
The shape used to crop the image.
Enums | |
---|---|
SQUARE
|
Default value. Applies a square mask to the image. For example, a 4x3 image becomes 3x3. |
CIRCLE
|
Applies a circular mask to the image. For example, a 4x3 image becomes a circle with a diameter of 3. |
Section
A section contains a collection of widgets that are rendered vertically in the order that they are specified.
JSON representation |
---|
{
"header": string,
"widgets": [
{
object (
|
Fields | |
---|---|
header
|
Text that appears at the top of a section. Supports simple HTML formatted text . |
widgets[]
|
All the widgets in the section. Must contain at least 1 widget. |
collapsible
|
Indicates whether this section is collapsible. Collapsible sections hide some or all widgets, but users can expand the section to reveal the hidden widgets by clicking Show more . Users can hide the widgets again by clicking Show less .
To determine which widgets are hidden, specify
|
uncollapsibleWidgetsCount
|
The number of uncollapsible widgets which remain visible even when a section is collapsed.
For example, when a section contains five widgets and the
|
Widget
Each card is made up of widgets.
A widget is a composite object that can represent one of text, images, buttons, and other object types.
JSON representation |
---|
{ // Union field |
Fields | |
---|---|
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. Supports simple HTML formatted text . For example, the following JSON creates a bolded text:
|
image
|
Displays an image. For example, the following JSON creates an image with alternative text:
|
decoratedText
|
Displays a decorated text item. 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 blue text button and the second is an image button that opens a link:
|
textInput
|
Displays a text box that users can type into. For example, the following JSON creates a text input for an email address:
As another example, the following JSON creates a text input for a programming language with static suggestions:
|
selectionInput
|
Displays a selection control that lets users select items. Selection controls can be check boxes, radio buttons, switches, or dropdown menus. For example, the following JSON creates a dropdown menu that lets users choose a size:
|
dateTimePicker
|
Displays a selection/input widget for date, time, or date and time. Not supported by Chat apps. Support by Chat apps is coming soon. For example, the following JSON creates a datetime picker to schedule an appointment:
|
divider
|
Displays a horizontal line divider between widgets. For example, the following JSON creates a divider:
|
grid
|
Displays a grid with a collection of items. A grid supports any number of columns and items. The number of rows is determined by the upper bounds of the number items divided by the number of columns. A grid with 10 items and 2 columns has 5 rows. A grid with 11 items and 2 columns has 6 rows. For example, the following JSON creates a 2 column grid with a single item:
|
TextParagraph
A paragraph of text that supports formatting. See Text formatting for details.
JSON representation |
---|
{ "text": string } |
Fields | |
---|---|
text
|
The text that's shown in the widget. |
Image
An image that is specified by a URL and can have an
onClick
action.
JSON representation |
---|
{
"imageUrl": string,
"onClick": {
object (
|
Fields | |
---|---|
imageUrl
|
The
For example:
|
onClick
|
When a user clicks on the image, the click triggers this action. |
altText
|
The alternative text of this image, used for accessibility. |
OnClick
Represents how to respond when users click an interactive element on a card, such as a button.
JSON representation |
---|
{ // Union field |
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. Supported by Google Workspace Add-ons, but not Chat apps. |
Action
An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. If the action is triggered, the form values are sent to the server.
JSON representation |
---|
{ "function": string, "parameters": [ { object ( |
Fields | |
---|---|
function
|
A custom function to invoke when the containing element is clicked or othrwise activated. For example usage, see Create interactive cards . |
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
|
interaction
|
Optional. Required when opening a dialog . What to do in response to an interaction with a user, such as a user clicking button on a card message.
If unspecified, the app responds by executing an
By specifying an
When specified, a loading indicator is not shown. Supported by Chat apps, but not Google Workspace Add-ons. If specified for an add-on, the entire card is stripped and nothing is shown in the client. |
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.
To learn more, see CommonEventObject .
JSON representation |
---|
{ "key": string, "value": string } |
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. |
Interaction
Optional. Required when opening a dialog .
What to do in response to an interaction with a user, such as a user clicking button on a card message.
If unspecified, the app responds by executing an
action
- like opening a link or running a function - as normal.
By specifying an
interaction
, the app can respond in special interactive ways. For example, by setting
interaction
to
OPEN_DIALOG
, the app can open a
dialog
.
When specified, a loading indicator is not shown.
Supported by Chat apps, but not Google Workspace Add-ons. If specified for an add-on, the entire card is stripped and nothing is shown in the client.
Enums | |
---|---|
INTERACTION_UNSPECIFIED
|
Default value. The
action
executes as normal.
|
OPEN_DIALOG
|
Opens a dialog , a windowed, card-based interface that Chat apps use to interact with users. Only supported by Chat apps in response to button-clicks on card messages. Not supported by Google Workspace Add-ons. If specified for an add-on, the entire card is stripped and nothing is shown in the client. |
OpenLink
Represents an
onClick
event that opens a hyperlink.
JSON representation |
---|
{ "url": string, "openAs": enum ( |
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. |
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.
Supported by Google Workspace Add-ons, but not 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. |
OnClose
What the client does when a link opened by an
OnClick
action gets closed.
Implementation depends on client platform capabilities. For example, a web browser might open a link in a pop-up window with an
OnClose
handler.
If both
OnOpen
and
OnClose
handlers are set, and the client platform can't support both values,
OnClose
takes precedence.
Supported by Google Workspace Add-ons, but not Chat apps.
Enums | |
---|---|
NOTHING
|
Default value. The card does not reload; nothing happens. |
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 parent card is blocked until the child window closes. |
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.
JSON representation |
---|
{ "icon": { object ( |
Fields | |
---|---|
icon
|
Deprecated in favor of
|
startIcon
|
The icon displayed in front of the text. |
topLabel
|
The text that appears above
|
text
|
Required. The primary text. Supports simple formatting. See Text formatting for formatting details. |
wrapText
|
The wrap text setting. If
Only applies to
|
bottomLabel
|
The text that appears below
|
onClick
|
When users click on
|
Union field
control
. A button, switch, checkbox, or image that appears to the right-hand side of text in the
decoratedText
widget.
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 and trigger an action. |
endIcon
|
An icon displayed after the text. |
Icon
An icon displayed in a widget on a card.
JSON representation |
---|
{ "altText": string, "imageType": enum ( |
Fields | |
---|---|
altText
|
Optional. A description of the icon used for accessibility. If unspecified, the default value "Button" is provided. As a best practice, you should set a helpful description for what the icon displays, and if applicable, what it does. For example,
If the icon is set in a
|
imageType
|
The crop style applied to the image. In some cases, applying a
|
Union field
icons
. The icon displayed in the widget on the card.
icons
can be only one of the following:
|
|
knownIcon
|
Display one of the built-in icons provided by Google Workspace.
For example, to display an airplane icon, specify
For a full list of supported icons, see built-in icons . |
iconUrl
|
Display a custom icon hosted at an HTTPS URL. For example:
Supported file types include
|
Button
A text, icon, or text + icon button that users can click.
To make an image a clickable button, specify an
Image
(not an
ImageComponent
) and set an
onClick
action.
Currently supported in Chat apps (including dialogs and card messages ) and Google Workspace Add-ons.
JSON representation |
---|
{ "text": string, "icon": { object ( |
Fields | |
---|---|
text
|
The text displayed inside the button. |
icon
|
The icon image. If both
|
color
|
If set, the button is filled with a solid background color and the font color changes to maintain contrast with the background color. For example, setting a blue background will likely result in white text. If unset, the image background is white and the font color is blue.
For red, green and blue, the value of each field is a
Optionally set alpha, which sets a level of transparency using this equation:
For alpha, a value of 1 corresponds with a solid color, and a value of 0 corresponds with a completely transparent color. For example, the following color represents a half transparent red:
|
onClick
|
Required. The action to perform when the button is clicked, such as opening a hyperlink or running a custom function. |
disabled
|
If
|
altText
|
The alternative text used for accessibility. Set descriptive text that lets users know what the button does. For example, if a button opens a hyperlink, you might write: "Opens a new browser tab and navigates to the Google Chat developer documentation at https://developers.google.com/chat" . |
Color
Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of
java.awt.Color
in Java; it can also be trivially provided to UIColor's
+colorWithRed:green:blue:alpha
method in iOS; and, with just a little work, it can be easily formatted into a CSS
rgba()
string in JavaScript.
This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space.
When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5.
Example (Java):
import com.google.type.Color;
// ...
public static java.awt.Color fromProto(Color protocolor) {
float alpha = protocolor.hasAlpha()
? protocolor.getAlpha().getValue()
: 1.0;
return new java.awt.Color(
protocolor.getRed(),
protocolor.getGreen(),
protocolor.getBlue(),
alpha);
}
public static Color toProto(java.awt.Color color) {
float red = (float) color.getRed();
float green = (float) color.getGreen();
float blue = (float) color.getBlue();
float denominator = 255.0;
Color.Builder resultBuilder =
Color
.newBuilder()
.setRed(red / denominator)
.setGreen(green / denominator)
.setBlue(blue / denominator);
int alpha = color.getAlpha();
if (alpha != 255) {
result.setAlpha(
FloatValue
.newBuilder()
.setValue(((float) alpha) / denominator)
.build());
}
return resultBuilder.build();
}
// ...
Example (iOS / Obj-C):
// ...
static UIColor* fromProto(Color* protocolor) {
float red = [protocolor red];
float green = [protocolor green];
float blue = [protocolor blue];
FloatValue* alpha_wrapper = [protocolor alpha];
float alpha = 1.0;
if (alpha_wrapper != nil) {
alpha = [alpha_wrapper value];
}
return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
}
static Color* toProto(UIColor* color) {
CGFloat red, green, blue, alpha;
if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {
return nil;
}
Color* result = [[Color alloc] init];
[result setRed:red];
[result setGreen:green];
[result setBlue:blue];
if (alpha <= 0.9999) {
[result setAlpha:floatWrapperWithValue(alpha)];
}
[result autorelease];
return result;
}
// ...
Example (JavaScript):
// ...
var protoToCssColor = function(rgb_color) {
var redFrac = rgb_color.red || 0.0;
var greenFrac = rgb_color.green || 0.0;
var blueFrac = rgb_color.blue || 0.0;
var red = Math.floor(redFrac * 255);
var green = Math.floor(greenFrac * 255);
var blue = Math.floor(blueFrac * 255);
if (!('alpha' in rgb_color)) {
return rgbToCssColor(red, green, blue);
}
var alphaFrac = rgb_color.alpha.value || 0.0;
var rgbParams = [red, green, blue].join(',');
return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');
};
var rgbToCssColor = function(red, green, blue) {
var rgbNumber = new Number((red << 16) | (green << 8) | blue);
var hexString = rgbNumber.toString(16);
var missingZeros = 6 - hexString.length;
var resultBuilder = ['#'];
for (var i = 0; i < missingZeros; i++) {
resultBuilder.push('0');
}
resultBuilder.push(hexString);
return resultBuilder.join('');
};
// ...
JSON representation |
---|
{ "red": number, "green": number, "blue": number, "alpha": number } |
Fields | |
---|---|
red
|
The amount of red in the color as a value in the interval [0, 1]. |
green
|
The amount of green in the color as a value in the interval [0, 1]. |
blue
|
The amount of blue in the color as a value in the interval [0, 1]. |
alpha
|
The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation:
This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). |
SwitchControl
Either a toggle-style switch or a checkbox inside a
decoratedText
widget.
Only supported on the
decoratedText
widget.
JSON representation |
---|
{ "name": string, "value": string, "selected": boolean, "onChangeAction": { object ( |
Fields | |
---|---|
name
|
The name by which the switch widget is identified in a form input event. For details about working with form inputs, see Receive form data . |
value
|
The value entered by a user, returned as part of a form input event. For details about working with form inputs, see Receive form data . |
selected
|
When
|
onChangeAction
|
The action to perform when the switch state is changed, such as what function to run. |
controlType
|
How the switch appears in the user interface. |
ControlType
How the switch appears in the user interface.
Enums | |
---|---|
SWITCH
|
A toggle-style switch. |
CHECKBOX
|
Deprecated in favor of
CHECK_BOX
.
|
CHECK_BOX
|
A checkbox. |
ButtonList
A list of buttons layed out horizontally.
JSON representation |
---|
{
"buttons": [
{
object (
|
Fields | |
---|---|
buttons[]
|
An array of buttons. |
TextInput
A field in which users can enter text. Supports suggestions and on-change actions.
Chat apps receive and can process the value of entered text during form input events. For details about working with form inputs, see Receive form data .
When you need to collect abstract data from users, use a text input. To collect defined data from users, use the selection input widget instead.
JSON representation |
---|
{ "name": string, "label": string, "hintText": string, "value": string, "type": enum ( |
Fields | |
---|---|
name
|
The name by which the text input is identified in a form input event. For details about working with form inputs, see Receive form data . |
label
|
The text that appears above the text input field in the user interface. Specify text that helps the user enter the information your app needs. For example, if you are asking someone's name, but specifically need their surname, write "surname" instead of "name".
Required if
|
hintText
|
Text that appears below the text input field meant to assist users by prompting them to enter a certain value. This text is always visible.
Required if
|
value
|
The value entered by a user, returned as part of a form input event. For details about working with form inputs, see Receive form data . |
type
|
How a text input field appears in the user interface. For example, whether the field is single or multi-line. |
onChangeAction
|
What to do when a change occurs in the text input field. Examples of changes include a user adding to the field, or deleting text. Examples of actions to take include running a custom function or opening a dialog in Google Chat. |
initialSuggestions
|
Suggested values that users can enter. These values appear when users click inside the text input field. As users type, the suggested values dynamically filter to match what the users have typed. For example, a text input field for programming language might suggest Java, JavaScript, Python, and C++. When users start typing "Jav", the list of suggestions filters to show just Java and JavaScript. Suggested values help guide users to enter values that your app can make sense of. When referring to JavaScript, some users might enter "javascript" and others "java script". Suggesting "JavaScript" can standardize how users interact with your app.
When specified,
|
autoCompleteAction
|
Optional. Specify what action to take when the text input field provides suggestions to users who interact with it.
If unspecified, the suggestions are set by
If specified, the app takes the action specified here, such as running a custom function. Supported by Google Workspace Add-ons, but not Chat apps. Support by Chat apps coming soon. |
Type
How a text input field appears in the user interface. For example, whether it is a single line input field, or a multi-line input.
If
initialSuggestions
is specified,
type
is always
SINGLE_LINE
, even if it is set to
MULTIPLE_LINE
.
Enums | |
---|---|
SINGLE_LINE
|
The text input field has a fixed height of one line. |
MULTIPLE_LINE
|
The text input field has a fixed height of multiple lines. |
Suggestions
Suggested values that users can enter. These values appear when users click inside the text input field. As users type, the suggested values dynamically filter to match what the users have typed.
For example, a text input field for programming language might suggest Java, JavaScript, Python, and C++. When users start typing "Jav", the list of suggestions filters to show just Java and JavaScript.
Suggested values help guide users to enter values that your app can make sense of. When referring to JavaScript, some users might enter "javascript" and others "java script". Suggesting "JavaScript" can standardize how users interact with your app.
When specified,
TextInput.type
is always
SINGLE_LINE
, even if it is set to
MULTIPLE_LINE
.
JSON representation |
---|
{
"items": [
{
object (
|
Fields | |
---|---|
items[]
|
A list of suggestions used for autocomplete recommendations in text input fields. |
SuggestionItem
One suggested value that users can enter in a text input field.
JSON representation |
---|
{ // Union field |
Fields | |
---|---|
Union field
|
|
text
|
The value of a suggested input to a text input field. This is equivalent to what users would enter themselves. |
SelectionInput
A widget that creates a UI item with options for users to select. For example, a dropdown menu or check list.
Chat apps receive and can process the value of entered text during form input events. For details about working with form inputs, see Receive form data .
When you need to collect data from users that matches options you set, use a selection input. To collect abstract data from users, use the text input widget instead.
JSON representation |
---|
{ "name": string, "label": string, "type": enum ( |
Fields | |
---|---|
name
|
The name by which the selection input is identified in a form input event. For details about working with form inputs, see Receive form data . |
label
|
The text that appears above the selection input field in the user interface. Specify text that helps the user enter the information your app needs. For example, if users are selecting the urgency of a work ticket from a drop-down menu, the label might be "Urgency" or "Select urgency". |
type
|
The way that an option appears to users. Different options support different types of interactions. For example, users can enable multiple check boxes, but can only select one value from a dropdown menu. Each selection input supports one type of selection. Mixing check boxes and switches, for example, is not supported. |
items[]
|
An array of the selected items. For example, all the selected check boxes. |
onChangeAction
|
If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button that submits the form. For details about working with form inputs, see Receive form data . |
SelectionType
The way that an option appears to users. Different options support different types of interactions. For example, users can enable multiple check boxes, but can only select one value from a dropdown menu.
Each selection input supports one type of selection. Mixing check boxes and switches, for example, is not supported.
Enums | |
---|---|
CHECK_BOX
|
A set of checkboxes. Users can select multiple check boxes per selection input. |
RADIO_BUTTON
|
A set of radio buttons. Users can select one radio button per selection input. |
SWITCH
|
A set of switches. Users can turn on multiple switches at once per selection input. |
DROPDOWN
|
A dropdown menu. Users can select one dropdown menu item per selection input. |
SelectionItem
A selectable item in a selection input, such as a check box or a switch.
JSON representation |
---|
{ "text": string, "value": string, "selected": boolean } |
Fields | |
---|---|
text
|
The text displayed to users. |
value
|
The value associated with this item. The client should use this as a form input value. For details about working with form inputs, see Receive form data . |
selected
|
When
|
DateTimePicker
Lets users specify a date, a time, or both a date and a time.
Accepts text input from users, but features an interactive date and time selector that helps users enter correctly-formatted dates and times. If users enter a date or time incorrectly, the widget shows an error that prompts users to enter the correct format.
Not supported by Chat apps. Support by Chat apps coming soon.
JSON representation |
---|
{ "name": string, "label": string, "type": enum ( |
Fields | |
---|---|
name
|
The name by which the datetime picker is identified in a form input event. For details about working with form inputs, see Receive form data . |
label
|
The text that prompts users to enter a date, time, or datetime. Specify text that helps the user enter the information your app needs. For example, if users are setting an appointment, then a label like "Appointment date" or "Appointment date and time" might work well. |
type
|
What kind of date and time input the datetime picker supports. |
valueMsEpoch
|
The value displayed as the default value before user input or previous user input, represented in milliseconds ( Epoch time ).
For
For
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 datetime picker interface. |
DateTimePickerType
What kind of date and time input the datetime picker supports.
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. |
Divider
Displays a divider between widgets, a horizontal line.
For example, the following JSON creates a divider:
"divider": {}
Grid
Displays a grid with a collection of items.
A grid supports any number of columns and items. The number of rows is determined by items divided by columns. A grid with 10 items and 2 columns has 5 rows. A grid with 11 items and 2 columns has 6 rows.
For example, the following JSON creates a 2 column grid with a single item:
"grid": {
"title": "A fine collection of items",
"columnCount": 2,
"borderStyle": {
"type": "STROKE",
"cornerRadius": 4
},
"items": [
{
"image": {
"imageUri": "https://www.example.com/image.png",
"cropStyle": {
"type": "SQUARE"
},
"borderStyle": {
"type": "STROKE"
}
},
"title": "An item",
"textAlignment": "CENTER"
}
],
"onClick": {
"openLink": {
"url": "https://www.example.com"
}
}
}
JSON representation |
---|
{ "title": string, "items": [ { object ( |
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.
JSON representation |
---|
{ "id": string, "image": { object ( |
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. |
layout
|
The layout to use for the grid item. |
ImageComponent
Represents an image.
JSON representation |
---|
{ "imageUri": string, "altText": string, "cropStyle": { object ( |
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.
For example, here's how to apply a 16 by 9 aspect ratio:
cropStyle {
"type": "RECTANGLE_CUSTOM",
"aspectRatio": 16/9
}
JSON representation |
---|
{
"type": enum (
|
Fields | |
---|---|
type
|
The crop type. |
aspectRatio
|
The aspect ratio to use if the crop type is
For example, here's how to apply a 16 by 9 aspect ratio:
|
ImageCropType
Represents the crop style applied to an image.
Enums | |
---|---|
IMAGE_CROP_TYPE_UNSPECIFIED
|
No value specified. Do not use. |
SQUARE
|
Default value. Applies a square crop. |
CIRCLE
|
Applies a circular crop. |
RECTANGLE_CUSTOM
|
Applies a rectangular crop with a custom aspect ratio. Set the custom aspect ratio with
aspectRatio
.
|
RECTANGLE_4_3
|
Applies a rectangular crop with a 4:3 aspect ratio. |
BorderStyle
The style options for the border of a card or widget, including the border type and color.
JSON representation |
---|
{ "type": enum ( |
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
|
Default value. No border. |
STROKE
|
Outline. |
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. |
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.
Not supported by Chat apps.
JSON representation |
---|
{
"actionLabel": string,
"onClick": {
object (
|
Fields | |
---|---|
actionLabel
|
The label that displays as the action menu item. |
onClick
|
The
|
DisplayStyle
In Google Workspace Add-ons, determines how a card is displayed.
Not supported by Chat apps.
Enums | |
---|---|
DISPLAY_STYLE_UNSPECIFIED
|
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
|
Default value. The card is shown by replacing the view of the top card in the card stack. |