Show / Hide Table of Contents

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][google.apps.card.v1.Columns]. For an example in Google Chat apps, see 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:

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

"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"
    }
  }
}
Inheritance
object
Grid
Implements
IMessage<Grid>
IEquatable<Grid>
IDeepCloneable<Grid>
IBufferMessage
IMessage
Inherited Members
object.GetHashCode()
object.GetType()
object.ToString()
Namespace: Google.Apps.Card.V1
Assembly: Google.Apps.Card.V1.dll
Syntax
public sealed class Grid : IMessage<Grid>, IEquatable<Grid>, IDeepCloneable<Grid>, IBufferMessage, IMessage

Constructors

Grid()

Declaration
public Grid()

Grid(Grid)

Declaration
public Grid(Grid other)
Parameters
Type Name Description
Grid other

Properties

BorderStyle

The border style to apply to each grid item.

Declaration
public BorderStyle BorderStyle { get; set; }
Property Value
Type Description
BorderStyle

ColumnCount

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

Declaration
public int ColumnCount { get; set; }
Property Value
Type Description
int

Items

The items to display in the grid.

Declaration
public RepeatedField<Grid.Types.GridItem> Items { get; }
Property Value
Type Description
RepeatedField<Grid.Types.GridItem>

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.

Declaration
public OnClick OnClick { get; set; }
Property Value
Type Description
OnClick

Title

The text that displays in the grid header.

Declaration
public string Title { get; set; }
Property Value
Type Description
string
In this article
Back to top Generated by DocFX