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 |
---|---|---|
set | Text | Sets the maximum number of lines of text that are displayed in the widget. |
set | Text | 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.
Available for Google Chat apps. In developer preview 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 |
---|---|---|
max | Integer | The maximum number of lines of text that are displayed. |
Return
Text
— This object, for chaining.
setText(text)
Sets the text of the paragraph. Required.
Parameters
Name | Type | Description |
---|---|---|
text | String | The text to display. |
Return
Text
— This object, for chaining.