Class TextParagraph

TextParagraph

A widget that displays text and supports basic HTML formatting.

Available for Google Workspace Add-ons and Google Chat apps.

const textParagraph = CardService.newTextParagraph().setText(
    'This is a text paragraph widget. Multiple lines are allowed if needed.',
);

Methods

MethodReturn typeBrief description
setMaxLines(maxLines)TextParagraphSets the maximum number of lines of text that are displayed in the widget.
setText(text)TextParagraphSets the text of the paragraph.

Detailed documentation

setMaxLines(maxLines)

Sets the maximum number of lines of text that are displayed in the widget. If the text exceeds the specified maximum number of lines, the excess content is concealed behind a "show more" button. If the text is equal or shorter than the specified maximum number of lines, a "show more" button isn't displayed.

Only available for Google Chat apps. Not available for Google Workspace Add-ons.

const textParagraph =
    CardService.newTextParagraph()
        .setText(
            'This is a text paragraph widget. Multiple lines are allowed if needed.',
            )
        .setMaxLines(1);

Parameters

NameTypeDescription
maxLinesIntegerThe maximum number of lines of text that are displayed.

Return

TextParagraph — This object, for chaining.


setText(text)

Sets the text of the paragraph. Required.

Parameters

NameTypeDescription
textStringThe text to display.

Return

TextParagraph — This object, for chaining.