Card with sections and card list - Gmail Add-On

459 Views Asked by At

I'm currently trying to create a card with two section, the first section will be a simple text section, but the second will be a card list. I have no idea how to include card list in this section, do you think it is possible?

I have this method that just gives me the list I want to add in the parent Card:

function createCardList(){
  var listCard = [];

  var card1 = CardService.newCardBuilder().setHeader(CardService.newCardHeader().setTitle('test1').build());
  listCard.push(card1);
  var card2 = CardService.newCardBuilder().setHeader(CardService.newCardHeader().setTitle('test2').build());
  listCard.push(card2);

  return listCard;
}
1

There are 1 best solutions below

0
On

Even if it's possible, from the overview documentation it doesn't looks like it's advised:

When designing add-ons, it's best to limit the number of cards you display at once, since cards must share a limited amount of screen space. It's also best to avoid unnecessary complexity in cards.

And

Most Gmail add-ons are built using multiple cards. To have an effective user experience, you should use simple and natural navigation between cards in your add-on.

They give a code example "that shows how to construct several cards with navigation buttons that jump between them".

Hopefully that helps you on your way to building what you want!