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::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/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Columns "Google::Apps::Card::V1::Columns (class)"). 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:

<br />

`
"grid": {
"title": "A fine collection of items",
"columnCount": 2,
"borderStyle": {
"type": "STROKE",
"cornerRadius": 4
},
"items": [
{
"image": {
"imageUri": "https://www.example.com/image.png&quot;,
"cropStyle": {
"type": "SQUARE"
},
"borderStyle": {
"type": "STROKE"
}
},
"title": "An item",
"textAlignment": "CENTER"
}
],
"onClick": {
"openLink": {
"url": "https://www.example.com"
}
}
}
`

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #border_style

    def border_style() -> ::Google::Apps::Card::V1::BorderStyle

**Returns**

- ([::Google::Apps::Card::V1::BorderStyle](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-BorderStyle)) --- The border style to apply to each grid item.

### #border_style=

    def border_style=(value) -> ::Google::Apps::Card::V1::BorderStyle

**Parameter**

- **value** ([::Google::Apps::Card::V1::BorderStyle](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-BorderStyle)) --- The border style to apply to each grid item.
**Returns**

- ([::Google::Apps::Card::V1::BorderStyle](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-BorderStyle)) --- The border style to apply to each grid item.

### #column_count

    def column_count() -> ::Integer

**Returns**

- (::Integer) --- 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).

### #column_count=

    def column_count=(value) -> ::Integer

**Parameter**

- **value** (::Integer) --- 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**

- (::Integer) --- 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).

### #items

    def items() -> ::Array<::Google::Apps::Card::V1::Grid::GridItem>

**Returns**

- (::Array\<[::Google::Apps::Card::V1::Grid::GridItem](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Grid-GridItem)\>) --- The items to display in the grid.

### #items=

    def items=(value) -> ::Array<::Google::Apps::Card::V1::Grid::GridItem>

**Parameter**

- **value** (::Array\<[::Google::Apps::Card::V1::Grid::GridItem](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Grid-GridItem)\>) --- The items to display in the grid.
**Returns**

- (::Array\<[::Google::Apps::Card::V1::Grid::GridItem](https://docs.cloud.google.com/ruby/docs/reference/google-apps-chat-v1/latest/Google-Apps-Card-V1-Grid-GridItem)\>) --- The items to display in the grid.

### #on_click

    def on_click() -> ::Google::Apps::Card::V1::OnClick

**Returns**

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

### #on_click=

    def on_click=(value) -> ::Google::Apps::Card::V1::OnClick

**Parameter**

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

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

### #title

    def title() -> ::String

**Returns**

- (::String) --- The text that displays in the grid header.

### #title=

    def title=(value) -> ::String

**Parameter**

- **value** (::String) --- The text that displays in the grid header.
**Returns**

- (::String) --- The text that displays in the grid header.