0.31.0 (latest) 0.30.0 0.29.0 0.28.0 0.27.0 0.23.0 0.20.0 0.19.0 0.18.0 0.17.1 0.16.1 0.15.0 0.14.0 0.13.1 0.12.1 0.11.2 0.10.0 0.9.0 0.8.1 0.7.2 0.6.1 0.5.0 0.4.0 0.3.0 0.2.0 0.1.4 Reference documentation and code samples for the Google Apps Chat V1 Client class 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: `php
  {
  "cardsV2": [
  {
  "cardId": "unique-card-id",
  "card": {
  "header": {
  "title": "Sasha",
  "subtitle": "Software Engineer",
  "imageUrl":
  "https://developers.google.com/workspace/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"
  }
  ]
  }
  }
  }
  ]
  }
  }
  ]
  }
  ]
  }
  }
  ]
  }`

Generated from protobuf message `google.apps.card.v1.Card`

## Namespace

Google \\ Apps \\ Card \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ header` | `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. |
| `↳ sections` | `array<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). |
| `↳ section_divider_style` | `int` The divider style between the header, sections and footer. |
| `↳ card_actions` | `array<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" } } } ]` |
| `↳ name` | `string` Name of the card. Used as a card identifier in card navigation. [Google Workspace add-ons](https://developers.google.com/workspace/add-ons): |
| `↳ fixed_footer` | `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): |
| `↳ display_style` | `int` In Google Workspace add-ons, sets the display properties of the `peekCardHeader`. [Google Workspace add-ons](https://developers.google.com/workspace/add-ons): |
| `↳ peek_card_header` | `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): |

### 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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Card\CardHeader|null` |   |

### hasHeader

### clearHeader

### setHeader

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Card\CardHeader` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSections

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** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<Card\Section>` |   |

### setSections

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).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<Card\Section>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSectionDividerStyle

The divider style between the header, sections and footer.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [DividerStyle](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Card.V1.Card.DividerStyle.md.txt). |

### setSectionDividerStyle

The divider style between the header, sections and footer.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [DividerStyle](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Card.V1.Card.DividerStyle.md.txt). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCardActions

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:

```php
"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** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<Card\CardAction>` |   |

### setCardActions

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:

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<Card\CardAction>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getName

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

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

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

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

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### 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](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** ||
|---|---|
| **Type** | **Description** |
| `Card\CardFixedFooter|null` |   |

### hasFixedFooter

### clearFixedFooter

### setFixedFooter

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):

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Card\CardFixedFooter` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDisplayStyle

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

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

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [DisplayStyle](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Card.V1.Card.DisplayStyle.md.txt). |

### setDisplayStyle

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

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [DisplayStyle](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Card.V1.Card.DisplayStyle.md.txt). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### 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](https://developers.google.com/workspace/add-ons):

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Card\CardHeader|null` |   |

### hasPeekCardHeader

### clearPeekCardHeader

### setPeekCardHeader

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):

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Card\CardHeader` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |