Class Widget (0.1.0)

  public 
  
 final 
  
 class 
 Widget 
  
 extends 
  
 GeneratedMessageV3 
  
 implements 
  
 WidgetOrBuilder 
 

Each card is made up of widgets.

A widget is a composite object that can represent one of text, images, buttons, and other object types.

Protobuf type google.apps.card.v1.Widget

Implements

WidgetOrBuilder

Static Fields

BUTTON_LIST_FIELD_NUMBER

  public 
  
 static 
  
 final 
  
 int 
  
 BUTTON_LIST_FIELD_NUMBER 
 
Field Value
Type
Description
int

COLUMNS_FIELD_NUMBER

  public 
  
 static 
  
 final 
  
 int 
  
 COLUMNS_FIELD_NUMBER 
 
Field Value
Type
Description
int

DATE_TIME_PICKER_FIELD_NUMBER

  public 
  
 static 
  
 final 
  
 int 
  
 DATE_TIME_PICKER_FIELD_NUMBER 
 
Field Value
Type
Description
int

DECORATED_TEXT_FIELD_NUMBER

  public 
  
 static 
  
 final 
  
 int 
  
 DECORATED_TEXT_FIELD_NUMBER 
 
Field Value
Type
Description
int

DIVIDER_FIELD_NUMBER

  public 
  
 static 
  
 final 
  
 int 
  
 DIVIDER_FIELD_NUMBER 
 
Field Value
Type
Description
int

GRID_FIELD_NUMBER

  public 
  
 static 
  
 final 
  
 int 
  
 GRID_FIELD_NUMBER 
 
Field Value
Type
Description
int

HORIZONTAL_ALIGNMENT_FIELD_NUMBER

  public 
  
 static 
  
 final 
  
 int 
  
 HORIZONTAL_ALIGNMENT_FIELD_NUMBER 
 
Field Value
Type
Description
int

IMAGE_FIELD_NUMBER

  public 
  
 static 
  
 final 
  
 int 
  
 IMAGE_FIELD_NUMBER 
 
Field Value
Type
Description
int

SELECTION_INPUT_FIELD_NUMBER

  public 
  
 static 
  
 final 
  
 int 
  
 SELECTION_INPUT_FIELD_NUMBER 
 
Field Value
Type
Description
int

TEXT_INPUT_FIELD_NUMBER

  public 
  
 static 
  
 final 
  
 int 
  
 TEXT_INPUT_FIELD_NUMBER 
 
Field Value
Type
Description
int

TEXT_PARAGRAPH_FIELD_NUMBER

  public 
  
 static 
  
 final 
  
 int 
  
 TEXT_PARAGRAPH_FIELD_NUMBER 
 
Field Value
Type
Description
int

Static Methods

getDefaultInstance()

  public 
  
 static 
  
 Widget 
  
 getDefaultInstance 
 () 
 
Returns
Type
Description

getDescriptor()

  public 
  
 static 
  
 final 
  
 Descriptors 
 . 
 Descriptor 
  
 getDescriptor 
 () 
 
Returns
Type
Description

newBuilder()

  public 
  
 static 
  
 Widget 
 . 
 Builder 
  
 newBuilder 
 () 
 
Returns
Type
Description

newBuilder(Widget prototype)

  public 
  
 static 
  
 Widget 
 . 
 Builder 
  
 newBuilder 
 ( 
 Widget 
  
 prototype 
 ) 
 
Parameter
Name
Description
prototype
Returns
Type
Description

parseDelimitedFrom(InputStream input)

  public 
  
 static 
  
 Widget 
  
 parseDelimitedFrom 
 ( 
 InputStream 
  
 input 
 ) 
 
Parameter
Name
Description
input
Returns
Type
Description
Exceptions
Type
Description

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

  public 
  
 static 
  
 Widget 
  
 parseDelimitedFrom 
 ( 
 InputStream 
  
 input 
 , 
  
 ExtensionRegistryLite 
  
 extensionRegistry 
 ) 
 
Parameters
Name
Description
input
extensionRegistry
Returns
Type
Description
Exceptions
Type
Description

parseFrom(byte[] data)

  public 
  
 static 
  
 Widget 
  
 parseFrom 
 ( 
 byte 
 [] 
  
 data 
 ) 
 
Parameter
Name
Description
data
byte []
Returns
Type
Description
Exceptions
Type
Description

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

  public 
  
 static 
  
 Widget 
  
 parseFrom 
 ( 
 byte 
 [] 
  
 data 
 , 
  
 ExtensionRegistryLite 
  
 extensionRegistry 
 ) 
 
Parameters
Name
Description
data
byte []
extensionRegistry
Returns
Type
Description
Exceptions
Type
Description

parseFrom(ByteString data)

  public 
  
 static 
  
 Widget 
  
 parseFrom 
 ( 
 ByteString 
  
 data 
 ) 
 
Parameter
Name
Description
data
Returns
Type
Description
Exceptions
Type
Description

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

  public 
  
 static 
  
 Widget 
  
 parseFrom 
 ( 
 ByteString 
  
 data 
 , 
  
 ExtensionRegistryLite 
  
 extensionRegistry 
 ) 
 
Parameters
Name
Description
data
extensionRegistry
Returns
Type
Description
Exceptions
Type
Description

parseFrom(CodedInputStream input)

  public 
  
 static 
  
 Widget 
  
 parseFrom 
 ( 
 CodedInputStream 
  
 input 
 ) 
 
Parameter
Name
Description
Returns
Type
Description
Exceptions
Type
Description

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

  public 
  
 static 
  
 Widget 
  
 parseFrom 
 ( 
 CodedInputStream 
  
 input 
 , 
  
 ExtensionRegistryLite 
  
 extensionRegistry 
 ) 
 
Parameters
Name
Description
extensionRegistry
Returns
Type
Description
Exceptions
Type
Description

parseFrom(InputStream input)

  public 
  
 static 
  
 Widget 
  
 parseFrom 
 ( 
 InputStream 
  
 input 
 ) 
 
Parameter
Name
Description
input
Returns
Type
Description
Exceptions
Type
Description

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

  public 
  
 static 
  
 Widget 
  
 parseFrom 
 ( 
 InputStream 
  
 input 
 , 
  
 ExtensionRegistryLite 
  
 extensionRegistry 
 ) 
 
Parameters
Name
Description
input
extensionRegistry
Returns
Type
Description
Exceptions
Type
Description

parseFrom(ByteBuffer data)

  public 
  
 static 
  
 Widget 
  
 parseFrom 
 ( 
 ByteBuffer 
  
 data 
 ) 
 
Parameter
Name
Description
data
Returns
Type
Description
Exceptions
Type
Description

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

  public 
  
 static 
  
 Widget 
  
 parseFrom 
 ( 
 ByteBuffer 
  
 data 
 , 
  
 ExtensionRegistryLite 
  
 extensionRegistry 
 ) 
 
Parameters
Name
Description
data
extensionRegistry
Returns
Type
Description
Exceptions
Type
Description

parser()

  public 
  
 static 
  
 Parser<Widget> 
  
 parser 
 () 
 
Returns
Type
Description

Methods

equals(Object obj)

  public 
  
 boolean 
  
 equals 
 ( 
 Object 
  
 obj 
 ) 
 
Parameter
Name
Description
obj
Returns
Type
Description
Overrides

getButtonList()

  public 
  
 ButtonList 
  
 getButtonList 
 () 
 

A list of buttons.

For example, the following JSON creates two buttons. The first is a blue text button and the second is an image button that opens a link: <code><code> "buttonList": { "buttons": [ { "text": "Edit", "color": { "red": 0, "green": 0, "blue": 1, "alpha": 1 }, "disabled": true, }, { "icon": { "knownIcon": "INVITE", "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } } ] } </code></code>

.google.apps.card.v1.ButtonList button_list = 4;

Returns
Type
Description

The buttonList.

getButtonListOrBuilder()

  public 
  
 ButtonListOrBuilder 
  
 getButtonListOrBuilder 
 () 
 

A list of buttons.

For example, the following JSON creates two buttons. The first is a blue text button and the second is an image button that opens a link: <code><code> "buttonList": { "buttons": [ { "text": "Edit", "color": { "red": 0, "green": 0, "blue": 1, "alpha": 1 }, "disabled": true, }, { "icon": { "knownIcon": "INVITE", "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } } ] } </code></code>

.google.apps.card.v1.ButtonList button_list = 4;

Returns
Type
Description

getColumns()

  public 
  
 Columns 
  
 getColumns 
 () 
 

Displays up to 2 columns.

To include more than 2 columns, or to use rows, use the Grid widget.

For example, the following JSON creates 2 columns that each contain text paragraphs:

<code><code> "columns": { "columnItems": [ { "horizontalSizeStyle": "FILL_AVAILABLE_SPACE", "horizontalAlignment": "CENTER", "verticalAlignment": "CENTER", "widgets": [ { "textParagraph": { "text": "First column text paragraph" } } ] }, { "horizontalSizeStyle": "FILL_AVAILABLE_SPACE", "horizontalAlignment": "CENTER", "verticalAlignment": "CENTER", "widgets": [ { "textParagraph": { "text": "Second column text paragraph" } } ] } ] } </code></code>

.google.apps.card.v1.Columns columns = 11;

Returns
Type
Description

The columns.

getColumnsOrBuilder()

  public 
  
 ColumnsOrBuilder 
  
 getColumnsOrBuilder 
 () 
 

Displays up to 2 columns.

To include more than 2 columns, or to use rows, use the Grid widget.

For example, the following JSON creates 2 columns that each contain text paragraphs:

<code><code> "columns": { "columnItems": [ { "horizontalSizeStyle": "FILL_AVAILABLE_SPACE", "horizontalAlignment": "CENTER", "verticalAlignment": "CENTER", "widgets": [ { "textParagraph": { "text": "First column text paragraph" } } ] }, { "horizontalSizeStyle": "FILL_AVAILABLE_SPACE", "horizontalAlignment": "CENTER", "verticalAlignment": "CENTER", "widgets": [ { "textParagraph": { "text": "Second column text paragraph" } } ] } ] } </code></code>

.google.apps.card.v1.Columns columns = 11;

Returns
Type
Description

getDataCase()

  public 
  
 Widget 
 . 
 DataCase 
  
 getDataCase 
 () 
 
Returns
Type
Description

getDateTimePicker()

  public 
  
 DateTimePicker 
  
 getDateTimePicker 
 () 
 

Displays a widget that lets users input a date, time, or date and time.

For example, the following JSON creates a date time picker to schedule an appointment:

<code><code> "dateTimePicker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DATE_AND_TIME", "valueMsEpoch": "796435200000" } </code></code>

.google.apps.card.v1.DateTimePicker date_time_picker = 7;

Returns
Type
Description

The dateTimePicker.

getDateTimePickerOrBuilder()

  public 
  
 DateTimePickerOrBuilder 
  
 getDateTimePickerOrBuilder 
 () 
 

Displays a widget that lets users input a date, time, or date and time.

For example, the following JSON creates a date time picker to schedule an appointment:

<code><code> "dateTimePicker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DATE_AND_TIME", "valueMsEpoch": "796435200000" } </code></code>

.google.apps.card.v1.DateTimePicker date_time_picker = 7;

Returns
Type
Description

getDecoratedText()

  public 
  
 DecoratedText 
  
 getDecoratedText 
 () 
 

Displays a decorated text item.

For example, the following JSON creates a decorated text widget showing email address:

<code><code> "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "text": "sasha&#64;example.com", "bottomLabel": "This is a new Email address!", "switchControl": { "name": "has_send_welcome_email_to_sasha", "selected": false, "controlType": "CHECKBOX" } } </code></code>

.google.apps.card.v1.DecoratedText decorated_text = 3;

Returns
Type
Description

The decoratedText.

getDecoratedTextOrBuilder()

  public 
  
 DecoratedTextOrBuilder 
  
 getDecoratedTextOrBuilder 
 () 
 

Displays a decorated text item.

For example, the following JSON creates a decorated text widget showing email address:

<code><code> "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "text": "sasha&#64;example.com", "bottomLabel": "This is a new Email address!", "switchControl": { "name": "has_send_welcome_email_to_sasha", "selected": false, "controlType": "CHECKBOX" } } </code></code>

.google.apps.card.v1.DecoratedText decorated_text = 3;

Returns
Type
Description

getDefaultInstanceForType()

  public 
  
 Widget 
  
 getDefaultInstanceForType 
 () 
 
Returns
Type
Description

getDivider()

  public 
  
 Divider 
  
 getDivider 
 () 
 

Displays a horizontal line divider between widgets.

For example, the following JSON creates a divider: <code><code> "divider": { } </code></code>

.google.apps.card.v1.Divider divider = 9;

Returns
Type
Description

The divider.

getDividerOrBuilder()

  public 
  
 DividerOrBuilder 
  
 getDividerOrBuilder 
 () 
 

Displays a horizontal line divider between widgets.

For example, the following JSON creates a divider: <code><code> "divider": { } </code></code>

.google.apps.card.v1.Divider divider = 9;

Returns
Type
Description

getGrid()

  public 
  
 Grid 
  
 getGrid 
 () 
 

Displays a grid with a collection of items.

A grid supports any number of columns and items. The number of rows is determined by the upper bounds of the number items divided by the number of 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:

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

.google.apps.card.v1.Grid grid = 10;

Returns
Type
Description

The grid.

getGridOrBuilder()

  public 
  
 GridOrBuilder 
  
 getGridOrBuilder 
 () 
 

Displays a grid with a collection of items.

A grid supports any number of columns and items. The number of rows is determined by the upper bounds of the number items divided by the number of 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:

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

.google.apps.card.v1.Grid grid = 10;

Returns
Type
Description

getHorizontalAlignment()

  public 
  
 Widget 
 . 
 HorizontalAlignment 
  
 getHorizontalAlignment 
 () 
 

Specifies whether widgets align to the left, right, or center of a column.

.google.apps.card.v1.Widget.HorizontalAlignment horizontal_alignment = 8;

Returns
Type
Description

The horizontalAlignment.

getHorizontalAlignmentValue()

  public 
  
 int 
  
 getHorizontalAlignmentValue 
 () 
 

Specifies whether widgets align to the left, right, or center of a column.

.google.apps.card.v1.Widget.HorizontalAlignment horizontal_alignment = 8;

Returns
Type
Description
int

The enum numeric value on the wire for horizontalAlignment.

getImage()

  public 
  
 Image 
  
 getImage 
 () 
 

Displays an image.

For example, the following JSON creates an image with alternative text: <code><code> "image": { "imageUrl": "https://developers.google.com/chat/images/quickstart-app-avatar.png", "altText": "Chat app avatar" } </code></code>

.google.apps.card.v1.Image image = 2;

Returns
Type
Description

The image.

getImageOrBuilder()

  public 
  
 ImageOrBuilder 
  
 getImageOrBuilder 
 () 
 

Displays an image.

For example, the following JSON creates an image with alternative text: <code><code> "image": { "imageUrl": "https://developers.google.com/chat/images/quickstart-app-avatar.png", "altText": "Chat app avatar" } </code></code>

.google.apps.card.v1.Image image = 2;

Returns
Type
Description

getParserForType()

  public 
  
 Parser<Widget> 
  
 getParserForType 
 () 
 
Returns
Type
Description
Overrides

getSelectionInput()

  public 
  
 SelectionInput 
  
 getSelectionInput 
 () 
 

Displays a selection control that lets users select items. Selection controls can be checkboxes, radio buttons, switches, or dropdown menus.

For example, the following JSON creates a dropdown menu that lets users choose a size:

<code><code> "selectionInput": { "name": "size", "label": "Size" "type": "DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } </code></code>

.google.apps.card.v1.SelectionInput selection_input = 6;

Returns
Type
Description

The selectionInput.

getSelectionInputOrBuilder()

  public 
  
 SelectionInputOrBuilder 
  
 getSelectionInputOrBuilder 
 () 
 

Displays a selection control that lets users select items. Selection controls can be checkboxes, radio buttons, switches, or dropdown menus.

For example, the following JSON creates a dropdown menu that lets users choose a size:

<code><code> "selectionInput": { "name": "size", "label": "Size" "type": "DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } </code></code>

.google.apps.card.v1.SelectionInput selection_input = 6;

Returns
Type
Description

getSerializedSize()

  public 
  
 int 
  
 getSerializedSize 
 () 
 
Returns
Type
Description
int
Overrides

getTextInput()

  public 
  
 TextInput 
  
 getTextInput 
 () 
 

Displays a text box that users can type into.

For example, the following JSON creates a text input for an email address:

` "textInput": { "name": "mailing_address", "label": "Mailing Address" }

As another example, the following JSON creates a text input for a programming language with static suggestions: "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } `

.google.apps.card.v1.TextInput text_input = 5;

Returns
Type
Description

The textInput.

getTextInputOrBuilder()

  public 
  
 TextInputOrBuilder 
  
 getTextInputOrBuilder 
 () 
 

Displays a text box that users can type into.

For example, the following JSON creates a text input for an email address:

` "textInput": { "name": "mailing_address", "label": "Mailing Address" }

As another example, the following JSON creates a text input for a programming language with static suggestions: "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } `

.google.apps.card.v1.TextInput text_input = 5;

Returns
Type
Description

getTextParagraph()

  public 
  
 TextParagraph 
  
 getTextParagraph 
 () 
 

Displays a text paragraph. Supports simple HTML formatted text. For more information about formatting text, see Formatting text in Google Chat apps and Formatting text in Google Workspace Add-ons .

For example, the following JSON creates a bolded text: <code><code> "textParagraph": { "text": " &lt;b&gt;bold text&lt;/b&gt;" } </code></code>

.google.apps.card.v1.TextParagraph text_paragraph = 1;

Returns
Type
Description

The textParagraph.

getTextParagraphOrBuilder()

  public 
  
 TextParagraphOrBuilder 
  
 getTextParagraphOrBuilder 
 () 
 

Displays a text paragraph. Supports simple HTML formatted text. For more information about formatting text, see Formatting text in Google Chat apps and Formatting text in Google Workspace Add-ons .

For example, the following JSON creates a bolded text: <code><code> "textParagraph": { "text": " &lt;b&gt;bold text&lt;/b&gt;" } </code></code>

.google.apps.card.v1.TextParagraph text_paragraph = 1;

Returns
Type
Description

hasButtonList()

  public 
  
 boolean 
  
 hasButtonList 
 () 
 

A list of buttons.

For example, the following JSON creates two buttons. The first is a blue text button and the second is an image button that opens a link: <code><code> "buttonList": { "buttons": [ { "text": "Edit", "color": { "red": 0, "green": 0, "blue": 1, "alpha": 1 }, "disabled": true, }, { "icon": { "knownIcon": "INVITE", "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } } ] } </code></code>

.google.apps.card.v1.ButtonList button_list = 4;

Returns
Type
Description

Whether the buttonList field is set.

hasColumns()

  public 
  
 boolean 
  
 hasColumns 
 () 
 

Displays up to 2 columns.

To include more than 2 columns, or to use rows, use the Grid widget.

For example, the following JSON creates 2 columns that each contain text paragraphs:

<code><code> "columns": { "columnItems": [ { "horizontalSizeStyle": "FILL_AVAILABLE_SPACE", "horizontalAlignment": "CENTER", "verticalAlignment": "CENTER", "widgets": [ { "textParagraph": { "text": "First column text paragraph" } } ] }, { "horizontalSizeStyle": "FILL_AVAILABLE_SPACE", "horizontalAlignment": "CENTER", "verticalAlignment": "CENTER", "widgets": [ { "textParagraph": { "text": "Second column text paragraph" } } ] } ] } </code></code>

.google.apps.card.v1.Columns columns = 11;

Returns
Type
Description

Whether the columns field is set.

hasDateTimePicker()

  public 
  
 boolean 
  
 hasDateTimePicker 
 () 
 

Displays a widget that lets users input a date, time, or date and time.

For example, the following JSON creates a date time picker to schedule an appointment:

<code><code> "dateTimePicker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DATE_AND_TIME", "valueMsEpoch": "796435200000" } </code></code>

.google.apps.card.v1.DateTimePicker date_time_picker = 7;

Returns
Type
Description

Whether the dateTimePicker field is set.

hasDecoratedText()

  public 
  
 boolean 
  
 hasDecoratedText 
 () 
 

Displays a decorated text item.

For example, the following JSON creates a decorated text widget showing email address:

<code><code> "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "text": "sasha&#64;example.com", "bottomLabel": "This is a new Email address!", "switchControl": { "name": "has_send_welcome_email_to_sasha", "selected": false, "controlType": "CHECKBOX" } } </code></code>

.google.apps.card.v1.DecoratedText decorated_text = 3;

Returns
Type
Description

Whether the decoratedText field is set.

hasDivider()

  public 
  
 boolean 
  
 hasDivider 
 () 
 

Displays a horizontal line divider between widgets.

For example, the following JSON creates a divider: <code><code> "divider": { } </code></code>

.google.apps.card.v1.Divider divider = 9;

Returns
Type
Description

Whether the divider field is set.

hasGrid()

  public 
  
 boolean 
  
 hasGrid 
 () 
 

Displays a grid with a collection of items.

A grid supports any number of columns and items. The number of rows is determined by the upper bounds of the number items divided by the number of 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:

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

.google.apps.card.v1.Grid grid = 10;

Returns
Type
Description

Whether the grid field is set.

hasImage()

  public 
  
 boolean 
  
 hasImage 
 () 
 

Displays an image.

For example, the following JSON creates an image with alternative text: <code><code> "image": { "imageUrl": "https://developers.google.com/chat/images/quickstart-app-avatar.png", "altText": "Chat app avatar" } </code></code>

.google.apps.card.v1.Image image = 2;

Returns
Type
Description

Whether the image field is set.

hasSelectionInput()

  public 
  
 boolean 
  
 hasSelectionInput 
 () 
 

Displays a selection control that lets users select items. Selection controls can be checkboxes, radio buttons, switches, or dropdown menus.

For example, the following JSON creates a dropdown menu that lets users choose a size:

<code><code> "selectionInput": { "name": "size", "label": "Size" "type": "DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } </code></code>

.google.apps.card.v1.SelectionInput selection_input = 6;

Returns
Type
Description

Whether the selectionInput field is set.

hasTextInput()

  public 
  
 boolean 
  
 hasTextInput 
 () 
 

Displays a text box that users can type into.

For example, the following JSON creates a text input for an email address:

` "textInput": { "name": "mailing_address", "label": "Mailing Address" }

As another example, the following JSON creates a text input for a programming language with static suggestions: "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } `

.google.apps.card.v1.TextInput text_input = 5;

Returns
Type
Description

Whether the textInput field is set.

hasTextParagraph()

  public 
  
 boolean 
  
 hasTextParagraph 
 () 
 

Displays a text paragraph. Supports simple HTML formatted text. For more information about formatting text, see Formatting text in Google Chat apps and Formatting text in Google Workspace Add-ons .

For example, the following JSON creates a bolded text: <code><code> "textParagraph": { "text": " &lt;b&gt;bold text&lt;/b&gt;" } </code></code>

.google.apps.card.v1.TextParagraph text_paragraph = 1;

Returns
Type
Description

Whether the textParagraph field is set.

hashCode()

  public 
  
 int 
  
 hashCode 
 () 
 
Returns
Type
Description
int
Overrides

internalGetFieldAccessorTable()

  protected 
  
 GeneratedMessageV3 
 . 
 FieldAccessorTable 
  
 internalGetFieldAccessorTable 
 () 
 
Returns
Type
Description
Overrides

isInitialized()

  public 
  
 final 
  
 boolean 
  
 isInitialized 
 () 
 
Returns
Type
Description
Overrides

newBuilderForType()

  public 
  
 Widget 
 . 
 Builder 
  
 newBuilderForType 
 () 
 
Returns
Type
Description

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

  protected 
  
 Widget 
 . 
 Builder 
  
 newBuilderForType 
 ( 
 GeneratedMessageV3 
 . 
 BuilderParent 
  
 parent 
 ) 
 
Parameter
Name
Description
parent
Returns
Type
Description
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

  protected 
  
 Object 
  
 newInstance 
 ( 
 GeneratedMessageV3 
 . 
 UnusedPrivateParameter 
  
 unused 
 ) 
 
Parameter
Name
Description
Returns
Type
Description
Overrides

toBuilder()

  public 
  
 Widget 
 . 
 Builder 
  
 toBuilder 
 () 
 
Returns
Type
Description

writeTo(CodedOutputStream output)

  public 
  
 void 
  
 writeTo 
 ( 
 CodedOutputStream 
  
 output 
 ) 
 
Parameter
Name
Description
Overrides
Exceptions
Type
Description
Design a Mobile Site
View Site in Mobile | Classic
Share by: