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

Displays a grid with a collection of items. Items can only include text or
images. For responsive columns, or to include more than text or images, use
[`Columns`](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Card.V1.Columns.md.txt). For an example in Google Chat apps,
see [Display a Grid with a collection of
items](https://developers.google.com/workspace/chat/format-structure-card-dialog#display_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.
[Google Workspace add-ons and Chat
apps](https://developers.google.com/workspace/extend):
For example, the following JSON creates a 2 column grid with a single
item:

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

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

## Namespace

Google \\ Apps \\ Card \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ title` | `string` The text that displays in the grid header. |
| `↳ items` | `array<Grid\GridItem>` The items to display in the grid. |
| `↳ border_style` | `BorderStyle` The border style to apply to each grid item. |
| `↳ column_count` | `int` 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). |
| `↳ on_click` | `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. |

### getTitle

The text that displays in the grid header.

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

### setTitle

The text that displays in the grid header.

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

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

### getItems

The items to display in the grid.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<Grid\GridItem>` |   |

### setItems

The items to display in the grid.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<Grid\GridItem>` |

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

### getBorderStyle

The border style to apply to each grid item.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `BorderStyle|null` |   |

### hasBorderStyle

### clearBorderStyle

### setBorderStyle

The border style to apply to each grid item.

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

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

### getColumnCount

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

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setColumnCount

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

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

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

### getOnClick

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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `OnClick|null` |   |

### hasOnClick

### clearOnClick

### setOnClick

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.

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

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