Class Icon
An icon displayed in a widget on a card. For an example in Google Chat apps, see Add an icon.
Namespace: Google.Apps.Card.V1
Assembly: Google.Apps.Card.V1.dll
Syntax
public sealed class Icon : IMessage<Icon>, IEquatable<Icon>, IDeepCloneable<Icon>, IBufferMessage, IMessage
Constructors
Icon()
Declaration
public Icon()
Icon(Icon)
Declaration
public Icon(Icon other)
Parameters
Type | Name | Description |
---|---|---|
Icon | other |
Properties
AltText
Optional. A description of the icon used for accessibility.
If unspecified, the default value Button
is provided. As a best practice,
you should set a helpful description for what the icon displays, and if
applicable, what it does. For example, A user's account portrait
, or
Opens a new browser tab and navigates to the Google Chat developer documentation at https://developers.google.com/workspace/chat
.
If the icon is set in a [Button
][google.apps.card.v1.Button], the
altText
appears as helper text when the user hovers over the button.
However, if the button also sets text
, the icon's altText
is ignored.
Declaration
public string AltText { get; set; }
Property Value
Type | Description |
---|---|
string |
HasIconUrl
Gets whether the "icon_url" field is set
Declaration
public bool HasIconUrl { get; }
Property Value
Type | Description |
---|---|
bool |
HasKnownIcon
Gets whether the "known_icon" field is set
Declaration
public bool HasKnownIcon { get; }
Property Value
Type | Description |
---|---|
bool |
IconUrl
Display a custom icon hosted at an HTTPS URL.
For example:
"iconUrl":
"https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png"
Supported file types include .png
and .jpg
.
Declaration
public string IconUrl { get; set; }
Property Value
Type | Description |
---|---|
string |
IconsCase
Declaration
public Icon.IconsOneofCase IconsCase { get; }
Property Value
Type | Description |
---|---|
Icon.IconsOneofCase |
ImageType
The crop style applied to the image. In some cases, applying a
CIRCLE
crop causes the image to be drawn larger than a built-in
icon.
Declaration
public Widget.Types.ImageType ImageType { get; set; }
Property Value
Type | Description |
---|---|
Widget.Types.ImageType |
KnownIcon
Display one of the built-in icons provided by Google Workspace.
For example, to display an airplane icon, specify AIRPLANE
.
For a bus, specify BUS
.
For a full list of supported icons, see built-in icons.
Declaration
public string KnownIcon { get; set; }
Property Value
Type | Description |
---|---|
string |
MaterialIcon
Display one of the Google Material Icons.
For example, to display a checkbox icon, use
"material_icon": {
"name": "check_box"
}
Declaration
public MaterialIcon MaterialIcon { get; set; }
Property Value
Type | Description |
---|---|
MaterialIcon |