Google Chat V1 API - Class Google::Apps::Card::V1::Grid (v0.18.0)

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 orimages. For responsive columns, or to include more than text or images, useColumns. For an example in Google Chat apps,seeDisplay a Grid with a collection ofitems.

A grid supports any number of columns and items. The number of rows isdetermined by items divided by columns. A grid with10 items and 2 columns has 5 rows. A grid with 11 items and 2 columnshas 6 rows.

Google Workspace add-ons and Chatapps:

For example, the following JSON creates a 2 column grid with a singleitem:

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

Inherits

  • Object

Extended By

  • Google::Protobuf::MessageExts::ClassMethods

Includes

  • Google::Protobuf::MessageExts

Methods

#border_style

defborder_style()->::Google::Apps::Card::V1::BorderStyle
Returns

#border_style=

defborder_style=(value)->::Google::Apps::Card::V1::BorderStyle
Parameter
Returns

#column_count

defcolumn_count()->::Integer
Returns
  • (::Integer) — The number of columns to display in the grid. A default valueis used if this field isn't specified, and that default value isdifferent depending on where the grid is shown (dialog versus companion).

#column_count=

defcolumn_count=(value)->::Integer
Parameter
  • value (::Integer) — The number of columns to display in the grid. A default valueis used if this field isn't specified, and that default value isdifferent depending on where the grid is shown (dialog versus companion).
Returns
  • (::Integer) — The number of columns to display in the grid. A default valueis used if this field isn't specified, and that default value isdifferent depending on where the grid is shown (dialog versus companion).

#items

defitems()->::Array<::Google::Apps::Card::V1::Grid::GridItem>
Returns

#items=

defitems=(value)->::Array<::Google::Apps::Card::V1::Grid::GridItem>
Parameter
Returns

#on_click

defon_click()->::Google::Apps::Card::V1::OnClick
Returns
  • (::Google::Apps::Card::V1::OnClick) — This callback is reused by each individual grid item, but with theitem's identifier and index in the items list added to the callback'sparameters.

#on_click=

defon_click=(value)->::Google::Apps::Card::V1::OnClick
Parameter
  • value (::Google::Apps::Card::V1::OnClick) — This callback is reused by each individual grid item, but with theitem's identifier and index in the items list added to the callback'sparameters.
Returns
  • (::Google::Apps::Card::V1::OnClick) — This callback is reused by each individual grid item, but with theitem's identifier and index in the items list added to the callback'sparameters.

#title

deftitle()->::String
Returns
  • (::String) — The text that displays in the grid header.

#title=

deftitle=(value)->::String
Parameter
  • value (::String) — The text that displays in the grid header.
Returns
  • (::String) — The text that displays in the grid header.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-16 UTC.