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
Method | Return type | Brief description |
---|---|---|
setMaxLines(maxLines) | TextParagraph | Sets the maximum number of lines of text that are displayed in the widget. |
setText(text) | TextParagraph | Sets 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
Name | Type | Description |
---|---|---|
maxLines | Integer | The 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
Name | Type | Description |
---|---|---|
text | String | The text to display. |
Return
TextParagraph
— This object, for chaining.