0.34.0 (latest) 0.33.0 0.32.0 0.31.0 0.30.0 0.29.0 0.28.0 0.27.0 0.26.0 0.25.0 0.24.0 0.23.0 0.22.0 0.21.0 0.20.0 0.19.0 0.18.0 0.17.0 0.16.0 0.15.0 0.14.0 0.13.0 0.12.0 0.11.1 0.10.0 0.9.1 0.8.0 0.7.0 0.6.0 0.5.1 0.4.0 0.3.1 0.2.0 0.1.2 Reference documentation and code samples for the Google Chat V1 API class Google::Apps::Card::V1::Card.

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](https://addons.gsuite.google.com/uikit/builder)

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

- For Google Chat apps, see [Design the components of a card or
  dialog](https://developers.google.com/workspace/chat/design-components-card-dialog).
- For Google Workspace add-ons, see [Card-based
  interfaces](https://developers.google.com/apps-script/add-ons/concepts/cards).

Note: You can add up to 100 widgets per card. Any widgets beyond this
limit are ignored. This limit applies to both card messages and dialogs
in Google Chat apps, and to cards in Google Workspace add-ons.

**Example: Card message for a Google Chat app**

![Example contact
card](https://developers.google.com/workspace/chat/images/card_api_reference.png)

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

<br />

`
{
"cardsV2": [
{
"cardId": "unique-card-id",
"card": {
"header": {
"title": "Sasha",
"subtitle": "Software Engineer",
"imageUrl":
"https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png&quot;,
"imageType": "CIRCLE",
"imageAltText": "Avatar for Sasha"
},
"sections": [
{
"header": "Contact Info",
"collapsible": true,
"uncollapsibleWidgetsCount": 1,
"widgets": [
{
"decoratedText": {
"startIcon": {
"knownIcon": "EMAIL"
},
"text": &quot;sasha@example.com"
}
},
{
"decoratedText": {
"startIcon": {
"knownIcon": "PERSON"
},
"text": "<font color=&quot;#80e27e&quot;>Online</font>"
}
},
{
"decoratedText": {
"startIcon": {
"knownIcon": "PHONE"
},
"text": "+1 (555) 555-1234"
}
},
{
"buttonList": {
"buttons": [
{
"text": "Share",
"onClick": {
"openLink": {
"url": "https://example.com/share&quot;
}
}
},
{
"text": "Edit",
"onClick": {
"action": {
"function": "goToView",
"parameters": [
{
"key": "viewType",
"value": "EDIT"
}
]
}
}
}
]
}
}
]
}
]
}
}
]
}
`

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #card_actions

    def card_actions() -> ::Array<::Google::Apps::Card::V1::Card::CardAction>

**Returns**

- (::Array\<[::Google::Apps::Card::V1::Card::CardAction](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-CardAction)\>) --- The card's actions. Actions are added to the card's toolbar menu.


  [Google Workspace
  add-ons](https://developers.google.com/workspace/add-ons):

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

  `
  "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"
  }
  }
  }
  ]
  `

### #card_actions=

    def card_actions=(value) -> ::Array<::Google::Apps::Card::V1::Card::CardAction>

**Parameter**

- **value** (::Array\<[::Google::Apps::Card::V1::Card::CardAction](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-CardAction)\>) --- The card's actions. Actions are added to the card's toolbar menu.


  [Google Workspace
  add-ons](https://developers.google.com/workspace/add-ons):

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

  `
  "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"
  }
  }
  }
  ]
  `
**Returns**

- (::Array\<[::Google::Apps::Card::V1::Card::CardAction](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-CardAction)\>) --- The card's actions. Actions are added to the card's toolbar menu.


  [Google Workspace
  add-ons](https://developers.google.com/workspace/add-ons):

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

  `
  "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"
  }
  }
  }
  ]
  `

### #display_style

    def display_style() -> ::Google::Apps::Card::V1::Card::DisplayStyle

**Returns**

- ([::Google::Apps::Card::V1::Card::DisplayStyle](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-DisplayStyle)) --- In Google Workspace add-ons, sets the display properties of the `peekCardHeader`.


  [Google Workspace
  add-ons](https://developers.google.com/workspace/add-ons):

### #display_style=

    def display_style=(value) -> ::Google::Apps::Card::V1::Card::DisplayStyle

**Parameter**

- **value** ([::Google::Apps::Card::V1::Card::DisplayStyle](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-DisplayStyle)) --- In Google Workspace add-ons, sets the display properties of the `peekCardHeader`.


  [Google Workspace
  add-ons](https://developers.google.com/workspace/add-ons):
**Returns**

- ([::Google::Apps::Card::V1::Card::DisplayStyle](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-DisplayStyle)) --- In Google Workspace add-ons, sets the display properties of the `peekCardHeader`.


  [Google Workspace
  add-ons](https://developers.google.com/workspace/add-ons):

### #fixed_footer

    def fixed_footer() -> ::Google::Apps::Card::V1::Card::CardFixedFooter

**Returns**

- ([::Google::Apps::Card::V1::Card::CardFixedFooter](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-CardFixedFooter)) --- 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](https://developers.google.com/workspace/chat/dialogs), but not
  [card
  messages](https://developers.google.com/workspace/chat/create-messages#create).

  [Google Workspace add-ons and Chat
  apps](https://developers.google.com/workspace/extend):

### #fixed_footer=

    def fixed_footer=(value) -> ::Google::Apps::Card::V1::Card::CardFixedFooter

**Parameter**

- **value** ([::Google::Apps::Card::V1::Card::CardFixedFooter](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-CardFixedFooter)) --- 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](https://developers.google.com/workspace/chat/dialogs), but not
  [card
  messages](https://developers.google.com/workspace/chat/create-messages#create).

  [Google Workspace add-ons and Chat
  apps](https://developers.google.com/workspace/extend):
**Returns**

- ([::Google::Apps::Card::V1::Card::CardFixedFooter](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-CardFixedFooter)) --- 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](https://developers.google.com/workspace/chat/dialogs), but not
  [card
  messages](https://developers.google.com/workspace/chat/create-messages#create).

  [Google Workspace add-ons and Chat
  apps](https://developers.google.com/workspace/extend):

### #header

    def header() -> ::Google::Apps::Card::V1::Card::CardHeader

**Returns**

- ([::Google::Apps::Card::V1::Card::CardHeader](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-CardHeader)) --- The header of the card. A header usually contains a leading image and a title. Headers always appear at the top of a card.

### #header=

    def header=(value) -> ::Google::Apps::Card::V1::Card::CardHeader

**Parameter**

- **value** ([::Google::Apps::Card::V1::Card::CardHeader](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-CardHeader)) --- The header of the card. A header usually contains a leading image and a title. Headers always appear at the top of a card.
**Returns**

- ([::Google::Apps::Card::V1::Card::CardHeader](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-CardHeader)) --- The header of the card. A header usually contains a leading image and a title. Headers always appear at the top of a card.

### #name

    def name() -> ::String

**Returns**

- (::String) --- Name of the card. Used as a card identifier in card navigation.

  [Google Workspace
  add-ons](https://developers.google.com/workspace/add-ons):

### #name=

    def name=(value) -> ::String

**Parameter**

- **value** (::String) --- Name of the card. Used as a card identifier in card navigation.


  [Google Workspace
  add-ons](https://developers.google.com/workspace/add-ons):
**Returns**

- (::String) --- Name of the card. Used as a card identifier in card navigation.

  [Google Workspace
  add-ons](https://developers.google.com/workspace/add-ons):

### #peek_card_header

    def peek_card_header() -> ::Google::Apps::Card::V1::Card::CardHeader

**Returns**

- ([::Google::Apps::Card::V1::Card::CardHeader](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-CardHeader)) --- 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](https://developers.google.com/workspace/add-ons):

### #peek_card_header=

    def peek_card_header=(value) -> ::Google::Apps::Card::V1::Card::CardHeader

**Parameter**

- **value** ([::Google::Apps::Card::V1::Card::CardHeader](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-CardHeader)) --- 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](https://developers.google.com/workspace/add-ons):
**Returns**

- ([::Google::Apps::Card::V1::Card::CardHeader](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-CardHeader)) --- 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](https://developers.google.com/workspace/add-ons):

### #section_divider_style

    def section_divider_style() -> ::Google::Apps::Card::V1::Card::DividerStyle

**Returns**

- ([::Google::Apps::Card::V1::Card::DividerStyle](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-DividerStyle)) --- The divider style between the header, sections and footer.

### #section_divider_style=

    def section_divider_style=(value) -> ::Google::Apps::Card::V1::Card::DividerStyle

**Parameter**

- **value** ([::Google::Apps::Card::V1::Card::DividerStyle](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-DividerStyle)) --- The divider style between the header, sections and footer.
**Returns**

- ([::Google::Apps::Card::V1::Card::DividerStyle](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-DividerStyle)) --- The divider style between the header, sections and footer.

### #sections

    def sections() -> ::Array<::Google::Apps::Card::V1::Card::Section>

**Returns**

- (::Array\<[::Google::Apps::Card::V1::Card::Section](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-Section)\>) --- 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 [Define a section of a
  card](https://developers.google.com/workspace/chat/design-components-card-dialog#define_a_section_of_a_card).

### #sections=

    def sections=(value) -> ::Array<::Google::Apps::Card::V1::Card::Section>

**Parameter**

- **value** (::Array\<[::Google::Apps::Card::V1::Card::Section](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-Section)\>) --- 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 [Define a section of a
  card](https://developers.google.com/workspace/chat/design-components-card-dialog#define_a_section_of_a_card).
**Returns**

- (::Array\<[::Google::Apps::Card::V1::Card::Section](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Card-Section)\>) --- 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 [Define a section of a
  card](https://developers.google.com/workspace/chat/design-components-card-dialog#define_a_section_of_a_card).