Rich text preformatted element
A block of preformatted text, such as code, in a monospace font.
| Available in | Messages, Modals, Home tab |
| Used in | Rich text block |
Fields
Section titled “Fields”| Field | Type | Description | Required? |
|---|---|---|---|
type |
String | The type of sub-element; in this case, rich_text_preformatted. |
Required |
elements |
Object[] | An array of text or link elements. | Required |
border |
Number | Turns a border on (1) or off (0). | Optional |
language |
String | The language of the code, used for syntax highlighting, e.g. json or python. |
Optional |
Examples
Section titled “Examples”A code block
Section titled “A code block”
{ "blocks": [ { "type": "rich_text", "elements": [ { "type": "rich_text_section", "elements": [ { "type": "text", "text": "The webhook payload we received:" } ] }, { "type": "rich_text_preformatted", "language": "json", "elements": [ { "type": "text", "text": "{\n \"event\": \"invoice.paid\",\n \"invoice\": \"INV-2041\",\n \"amount\": 12450\n}" } ] } ] } ]}