Class ChipList

  • A ChipList holds a set of Chip objects displayed in a row, wrapping to the next line or allowing horizontal scrolling.

  • It is available for Google Chat apps and in developer preview for Google Workspace add-ons.

  • Key methods include addChip(chip) to add chips and setLayout(layout) to set the display layout.

ChipList

Holds a set of Chip objects that are displayed in a row, wrapping to the next line to horizontal scrollable.

Available for Google Chat apps. In developer preview for Google Workspace add-ons.

constchip=CardService.newChip();
// Finish building the text chip...
constchipList=CardService.newChipList()
.setLayout(CardService.ChipListLayout.WRAPPED)
.addChip(chip);

Methods

MethodReturn typeBrief description
addChip(chip) ChipList Adds a chip.
setLayout(layout) ChipList Sets the chip list layout.

Detailed documentation

addChip(chip)

Adds a chip.

Parameters

NameTypeDescription
chipChip The chip to add.

Return

ChipList — This object, for chaining.


setLayout(layout)

Sets the chip list layout. If unset, it defaults to ChipListLayout.WRAPPED layout.

constchip=CardService.newChip();
// Finish building the text chip...
constchipList=
CardService.newChipList()
.setLayout(CardService.ChipListLayout.HORIZONTAL_SCROLLABLE)
.addChip(chip);

Parameters

NameTypeDescription
layoutChipListLayout The chip list layout.

Return

ChipList — This object, for chaining.

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

Last updated 2025年01月30日 UTC.