Class Card (0.1.0)

  public 
  
 final 
  
 class 
 Card 
  
 extends 
  
 GeneratedMessageV3 
  
 implements 
  
 CardOrBuilder 
 

A card interface displayed in a Google Chat message or Google Workspace Add-on.

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.

Card builder

To learn how to build cards, see the following documentation:

  • For Google Chat apps, see Design dynamic, interactive, and consistent UIs with cards .
  • For Google Workspace Add-ons, see Card-based interfaces .

    Example: Card message for a Google Chat app

    ! Example contact card

    To create the sample card message in Google Chat, use the following JSON:

    <code><code> { "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&#64;example.com", } }, { "decoratedText": { "startIcon": { "knownIcon": "PERSON", }, "text": "&lt;font color=&#92;"#80e27e&#92;"&gt;Online&lt;/font&gt;", }, }, { "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", } ], } } }, ], } }, ], }, ], }, } ], } </code></code>

Protobuf type google.apps.card.v1.Card

Implements

CardOrBuilder

Static Fields

CARD_ACTIONS_FIELD_NUMBER

  public 
  
 static 
  
 final 
  
 int 
  
 CARD_ACTIONS_FIELD_NUMBER 
 
Field Value
Type
Description
int

DISPLAY_STYLE_FIELD_NUMBER

  public 
  
 static 
  
 final 
  
 int 
  
 DISPLAY_STYLE_FIELD_NUMBER 
 
Field Value
Type
Description
int
  public 
  
 static 
  
 final 
  
 int 
  
 FIXED_FOOTER_FIELD_NUMBER 
 
Field Value
Type
Description
int

HEADER_FIELD_NUMBER

  public 
  
 static 
  
 final 
  
 int 
  
 HEADER_FIELD_NUMBER 
 
Field Value
Type
Description
int

NAME_FIELD_NUMBER

  public 
  
 static 
  
 final 
  
 int 
  
 NAME_FIELD_NUMBER 
 
Field Value
Type
Description
int

PEEK_CARD_HEADER_FIELD_NUMBER

  public 
  
 static 
  
 final 
  
 int 
  
 PEEK_CARD_HEADER_FIELD_NUMBER 
 
Field Value
Type
Description
int

SECTIONS_FIELD_NUMBER

  public 
  
 static 
  
 final 
  
 int 
  
 SECTIONS_FIELD_NUMBER 
 
Field Value
Type
Description
int

SECTION_DIVIDER_STYLE_FIELD_NUMBER

  public 
  
 static 
  
 final 
  
 int 
  
 SECTION_DIVIDER_STYLE_FIELD_NUMBER 
 
Field Value
Type
Description
int

Static Methods

getDefaultInstance()

  public 
  
 static 
  
 Card 
  
 getDefaultInstance 
 () 
 
Returns
Type
Description

getDescriptor()

  public 
  
 static 
  
 final 
  
 Descriptors 
 . 
 Descriptor 
  
 getDescriptor 
 () 
 
Returns
Type
Description

newBuilder()

  public 
  
 static 
  
 Card 
 . 
 Builder 
  
 newBuilder 
 () 
 
Returns
Type
Description

newBuilder(Card prototype)

  public 
  
 static 
  
 Card 
 . 
 Builder 
  
 newBuilder 
 ( 
 Card 
  
 prototype 
 ) 
 
Parameter
Name
Description
prototype
Returns
Type
Description

parseDelimitedFrom(InputStream input)

  public 
  
 static 
  
 Card 
  
 parseDelimitedFrom 
 ( 
 InputStream 
  
 input 
 ) 
 
Parameter
Name
Description
input
Returns
Type
Description
Exceptions
Type
Description

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

  public 
  
 static 
  
 Card 
  
 parseDelimitedFrom 
 ( 
 InputStream 
  
 input 
 , 
  
 ExtensionRegistryLite 
  
 extensionRegistry 
 ) 
 
Parameters
Name
Description
input
extensionRegistry
Returns
Type
Description
Exceptions
Type
Description

parseFrom(byte[] data)

  public 
  
 static 
  
 Card 
  
 parseFrom 
 ( 
 byte 
 [] 
  
 data 
 ) 
 
Parameter
Name
Description
data
byte []
Returns
Type
Description
Exceptions
Type
Description

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

  public 
  
 static 
  
 Card 
  
 parseFrom 
 ( 
 byte 
 [] 
  
 data 
 , 
  
 ExtensionRegistryLite 
  
 extensionRegistry 
 ) 
 
Parameters
Name
Description
data
byte []
extensionRegistry
Returns
Type
Description
Exceptions
Type
Description

parseFrom(ByteString data)

  public 
  
 static 
  
 Card 
  
 parseFrom 
 ( 
 ByteString 
  
 data 
 ) 
 
Parameter
Name
Description
data
Returns
Type
Description
Exceptions
Type
Description

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

  public 
  
 static 
  
 Card 
  
 parseFrom 
 ( 
 ByteString 
  
 data 
 , 
  
 ExtensionRegistryLite 
  
 extensionRegistry 
 ) 
 
Parameters
Name
Description
data
extensionRegistry
Returns
Type
Description
Exceptions
Type
Description

parseFrom(CodedInputStream input)

  public 
  
 static 
  
 Card 
  
 parseFrom 
 ( 
 CodedInputStream 
  
 input 
 ) 
 
Parameter
Name
Description
Returns
Type
Description
Exceptions
Type
Description

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

  public 
  
 static 
  
 Card 
  
 parseFrom 
 ( 
 CodedInputStream 
  
 input 
 , 
  
 ExtensionRegistryLite 
  
 extensionRegistry 
 ) 
 
Parameters
Name
Description
extensionRegistry
Returns
Type
Description
Exceptions
Type
Description

parseFrom(InputStream input)

  public 
  
 static 
  
 Card 
  
 parseFrom 
 ( 
 InputStream 
  
 input 
 ) 
 
Parameter
Name
Description
input
Returns
Type
Description
Exceptions
Type
Description

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

  public 
  
 static 
  
 Card 
  
 parseFrom 
 ( 
 InputStream 
  
 input 
 , 
  
 ExtensionRegistryLite 
  
 extensionRegistry 
 ) 
 
Parameters
Name
Description
input
extensionRegistry
Returns
Type
Description
Exceptions
Type
Description

parseFrom(ByteBuffer data)

  public 
  
 static 
  
 Card 
  
 parseFrom 
 ( 
 ByteBuffer 
  
 data 
 ) 
 
Parameter
Name
Description
data
Returns
Type
Description
Exceptions
Type
Description

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

  public 
  
 static 
  
 Card 
  
 parseFrom 
 ( 
 ByteBuffer 
  
 data 
 , 
  
 ExtensionRegistryLite 
  
 extensionRegistry 
 ) 
 
Parameters
Name
Description
data
extensionRegistry
Returns
Type
Description
Exceptions
Type
Description

parser()

  public 
  
 static 
  
 Parser<Card> 
  
 parser 
 () 
 
Returns
Type
Description
Parser < Card >

Methods

equals(Object obj)

  public 
  
 boolean 
  
 equals 
 ( 
 Object 
  
 obj 
 ) 
 
Parameter
Name
Description
obj
Returns
Type
Description
Overrides

getCardActions(int index)

  public 
  
 Card 
 . 
 CardAction 
  
 getCardActions 
 ( 
 int 
  
 index 
 ) 
 

The card's actions. Actions are added to the card's toolbar menu.

Google Workspace Add-ons :

For example, the following JSON constructs a card action menu with Settings and Send Feedback options:

<code><code> "card_actions": [ { "actionLabel": "Settings", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] </code></code>

repeated .google.apps.card.v1.Card.CardAction card_actions = 3;

Parameter
Name
Description
index
int
Returns
Type
Description

getCardActionsCount()

  public 
  
 int 
  
 getCardActionsCount 
 () 
 

The card's actions. Actions are added to the card's toolbar menu.

Google Workspace Add-ons :

For example, the following JSON constructs a card action menu with Settings and Send Feedback options:

<code><code> "card_actions": [ { "actionLabel": "Settings", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] </code></code>

repeated .google.apps.card.v1.Card.CardAction card_actions = 3;

Returns
Type
Description
int

getCardActionsList()

  public 
  
 List<Card 
 . 
 CardAction 
>  
 getCardActionsList 
 () 
 

The card's actions. Actions are added to the card's toolbar menu.

Google Workspace Add-ons :

For example, the following JSON constructs a card action menu with Settings and Send Feedback options:

<code><code> "card_actions": [ { "actionLabel": "Settings", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] </code></code>

repeated .google.apps.card.v1.Card.CardAction card_actions = 3;

Returns
Type
Description

getCardActionsOrBuilder(int index)

  public 
  
 Card 
 . 
 CardActionOrBuilder 
  
 getCardActionsOrBuilder 
 ( 
 int 
  
 index 
 ) 
 

The card's actions. Actions are added to the card's toolbar menu.

Google Workspace Add-ons :

For example, the following JSON constructs a card action menu with Settings and Send Feedback options:

<code><code> "card_actions": [ { "actionLabel": "Settings", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] </code></code>

repeated .google.apps.card.v1.Card.CardAction card_actions = 3;

Parameter
Name
Description
index
int
Returns
Type
Description

getCardActionsOrBuilderList()

  public 
  
 List 
< ? 
  
 extends 
  
 Card 
 . 
 CardActionOrBuilder 
>  
 getCardActionsOrBuilderList 
 () 
 

The card's actions. Actions are added to the card's toolbar menu.

Google Workspace Add-ons :

For example, the following JSON constructs a card action menu with Settings and Send Feedback options:

<code><code> "card_actions": [ { "actionLabel": "Settings", "onClick": { "action": { "functionName": "goToView", "parameters": [ { "key": "viewType", "value": "SETTING" } ], "loadIndicator": "LoadIndicator.SPINNER" } } }, { "actionLabel": "Send Feedback", "onClick": { "openLink": { "url": "https://example.com/feedback" } } } ] </code></code>

repeated .google.apps.card.v1.Card.CardAction card_actions = 3;

Returns
Type
Description
List < ? extends com.google.apps.card.v1.Card.CardActionOrBuilder >

getDefaultInstanceForType()

  public 
  
 Card 
  
 getDefaultInstanceForType 
 () 
 
Returns
Type
Description

getDisplayStyle()

  public 
  
 Card 
 . 
 DisplayStyle 
  
 getDisplayStyle 
 () 
 

In Google Workspace Add-ons, sets the display properties of the peekCardHeader .

Google Workspace Add-ons :

.google.apps.card.v1.Card.DisplayStyle display_style = 6;

Returns
Type
Description

The displayStyle.

getDisplayStyleValue()

  public 
  
 int 
  
 getDisplayStyleValue 
 () 
 

In Google Workspace Add-ons, sets the display properties of the peekCardHeader .

Google Workspace Add-ons :

.google.apps.card.v1.Card.DisplayStyle display_style = 6;

Returns
Type
Description
int

The enum numeric value on the wire for displayStyle.

getFixedFooter()

  public 
  
 Card 
 . 
 CardFixedFooter 
  
 getFixedFooter 
 () 
 

The fixed footer shown at the bottom of this card.

Setting fixedFooter without specifying a primaryButton or a secondaryButton causes an error. For Chat apps, you can use fixed footers in dialogs , but not card messages .

Google Workspace Add-ons and Chat apps :

.google.apps.card.v1.Card.CardFixedFooter fixed_footer = 5;

Returns
Type
Description

The fixedFooter.

getFixedFooterOrBuilder()

  public 
  
 Card 
 . 
 CardFixedFooterOrBuilder 
  
 getFixedFooterOrBuilder 
 () 
 

The fixed footer shown at the bottom of this card.

Setting fixedFooter without specifying a primaryButton or a secondaryButton causes an error. For Chat apps, you can use fixed footers in dialogs , but not card messages .

Google Workspace Add-ons and Chat apps :

.google.apps.card.v1.Card.CardFixedFooter fixed_footer = 5;

Returns
Type
Description

getHeader()

  public 
  
 Card 
 . 
 CardHeader 
  
 getHeader 
 () 
 

The header of the card. A header usually contains a leading image and a title. Headers always appear at the top of a card.

.google.apps.card.v1.Card.CardHeader header = 1;

Returns
Type
Description

The header.

getHeaderOrBuilder()

  public 
  
 Card 
 . 
 CardHeaderOrBuilder 
  
 getHeaderOrBuilder 
 () 
 

The header of the card. A header usually contains a leading image and a title. Headers always appear at the top of a card.

.google.apps.card.v1.Card.CardHeader header = 1;

Returns
Type
Description

getName()

  public 
  
 String 
  
 getName 
 () 
 

Name of the card. Used as a card identifier in card navigation.

Google Workspace Add-ons :

string name = 4;

Returns
Type
Description

The name.

getNameBytes()

  public 
  
 ByteString 
  
 getNameBytes 
 () 
 

Name of the card. Used as a card identifier in card navigation.

Google Workspace Add-ons :

string name = 4;

Returns
Type
Description

The bytes for name.

getParserForType()

  public 
  
 Parser<Card> 
  
 getParserForType 
 () 
 
Returns
Type
Description
Parser < Card >
Overrides

getPeekCardHeader()

  public 
  
 Card 
 . 
 CardHeader 
  
 getPeekCardHeader 
 () 
 

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.

Google Workspace Add-ons :

.google.apps.card.v1.Card.CardHeader peek_card_header = 7;

Returns
Type
Description

The peekCardHeader.

getPeekCardHeaderOrBuilder()

  public 
  
 Card 
 . 
 CardHeaderOrBuilder 
  
 getPeekCardHeaderOrBuilder 
 () 
 

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.

Google Workspace Add-ons :

.google.apps.card.v1.Card.CardHeader peek_card_header = 7;

Returns
Type
Description

getSectionDividerStyle()

  public 
  
 Card 
 . 
 DividerStyle 
  
 getSectionDividerStyle 
 () 
 

The divider style between sections.

.google.apps.card.v1.Card.DividerStyle section_divider_style = 9;

Returns
Type
Description

The sectionDividerStyle.

getSectionDividerStyleValue()

  public 
  
 int 
  
 getSectionDividerStyleValue 
 () 
 

The divider style between sections.

.google.apps.card.v1.Card.DividerStyle section_divider_style = 9;

Returns
Type
Description
int

The enum numeric value on the wire for sectionDividerStyle.

getSections(int index)

  public 
  
 Card 
 . 
 Section 
  
 getSections 
 ( 
 int 
  
 index 
 ) 
 

Contains a collection of widgets. Each section has its own, optional header. Sections are visually separated by a line divider. For an example in Google Chat apps, see Card section .

repeated .google.apps.card.v1.Card.Section sections = 2;

Parameter
Name
Description
index
int
Returns
Type
Description

getSectionsCount()

  public 
  
 int 
  
 getSectionsCount 
 () 
 

Contains a collection of widgets. Each section has its own, optional header. Sections are visually separated by a line divider. For an example in Google Chat apps, see Card section .

repeated .google.apps.card.v1.Card.Section sections = 2;

Returns
Type
Description
int

getSectionsList()

  public 
  
 List<Card 
 . 
 Section 
>  
 getSectionsList 
 () 
 

Contains a collection of widgets. Each section has its own, optional header. Sections are visually separated by a line divider. For an example in Google Chat apps, see Card section .

repeated .google.apps.card.v1.Card.Section sections = 2;

Returns
Type
Description

getSectionsOrBuilder(int index)

  public 
  
 Card 
 . 
 SectionOrBuilder 
  
 getSectionsOrBuilder 
 ( 
 int 
  
 index 
 ) 
 

Contains a collection of widgets. Each section has its own, optional header. Sections are visually separated by a line divider. For an example in Google Chat apps, see Card section .

repeated .google.apps.card.v1.Card.Section sections = 2;

Parameter
Name
Description
index
int
Returns
Type
Description

getSectionsOrBuilderList()

  public 
  
 List 
< ? 
  
 extends 
  
 Card 
 . 
 SectionOrBuilder 
>  
 getSectionsOrBuilderList 
 () 
 

Contains a collection of widgets. Each section has its own, optional header. Sections are visually separated by a line divider. For an example in Google Chat apps, see Card section .

repeated .google.apps.card.v1.Card.Section sections = 2;

Returns
Type
Description
List < ? extends com.google.apps.card.v1.Card.SectionOrBuilder >

getSerializedSize()

  public 
  
 int 
  
 getSerializedSize 
 () 
 
Returns
Type
Description
int
Overrides

hasFixedFooter()

  public 
  
 boolean 
  
 hasFixedFooter 
 () 
 

The fixed footer shown at the bottom of this card.

Setting fixedFooter without specifying a primaryButton or a secondaryButton causes an error. For Chat apps, you can use fixed footers in dialogs , but not card messages .

Google Workspace Add-ons and Chat apps :

.google.apps.card.v1.Card.CardFixedFooter fixed_footer = 5;

Returns
Type
Description

Whether the fixedFooter field is set.

hasHeader()

  public 
  
 boolean 
  
 hasHeader 
 () 
 

The header of the card. A header usually contains a leading image and a title. Headers always appear at the top of a card.

.google.apps.card.v1.Card.CardHeader header = 1;

Returns
Type
Description

Whether the header field is set.

hasPeekCardHeader()

  public 
  
 boolean 
  
 hasPeekCardHeader 
 () 
 

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.

Google Workspace Add-ons :

.google.apps.card.v1.Card.CardHeader peek_card_header = 7;

Returns
Type
Description

Whether the peekCardHeader field is set.

hashCode()

  public 
  
 int 
  
 hashCode 
 () 
 
Returns
Type
Description
int
Overrides

internalGetFieldAccessorTable()

  protected 
  
 GeneratedMessageV3 
 . 
 FieldAccessorTable 
  
 internalGetFieldAccessorTable 
 () 
 
Returns
Type
Description
Overrides

isInitialized()

  public 
  
 final 
  
 boolean 
  
 isInitialized 
 () 
 
Returns
Type
Description
Overrides

newBuilderForType()

  public 
  
 Card 
 . 
 Builder 
  
 newBuilderForType 
 () 
 
Returns
Type
Description

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

  protected 
  
 Card 
 . 
 Builder 
  
 newBuilderForType 
 ( 
 GeneratedMessageV3 
 . 
 BuilderParent 
  
 parent 
 ) 
 
Parameter
Name
Description
parent
Returns
Type
Description
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

  protected 
  
 Object 
  
 newInstance 
 ( 
 GeneratedMessageV3 
 . 
 UnusedPrivateParameter 
  
 unused 
 ) 
 
Parameter
Name
Description
Returns
Type
Description
Overrides

toBuilder()

  public 
  
 Card 
 . 
 Builder 
  
 toBuilder 
 () 
 
Returns
Type
Description

writeTo(CodedOutputStream output)

  public 
  
 void 
  
 writeTo 
 ( 
 CodedOutputStream 
  
 output 
 ) 
 
Parameter
Name
Description
Overrides
Exceptions
Type
Description
Design a Mobile Site
View Site in Mobile | Classic
Share by: