user-interfacegoogle-apps-scriptadd-on

TextButton Full Width


I am creating a gmail add-on using app script. According to design requirement I want to create a TextButton which is full width i.e. It covers the entire width of the add on. I am using TextButton class for this as below -

var textButton = CardService.newTextButton()
    .setText(btnName)
    .setOnClickAction(action)
    .setTextButtonStyle(CardService.TextButtonStyle.FILLED);

Can anyone please confirm how can I make this button full width? TIA.


Solution

  • Unfortunately you can't change the width - the button always wraps the containing text and ignores leading and trailing whitespace.

    The button has to be added either to the header or footer and then it'll automatically be full-width.

    Otherwise I would suggest filing this as a feature request directly to Google here.