# 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](https://workstation.repzo.com/docs/developers/block-kit/blocks/rich-text-block) |

## 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](https://workstation.repzo.com/docs/developers/block-kit/rich-text/text-rich-text-element) or [link](https://workstation.repzo.com/docs/developers/block-kit/rich-text/link-rich-text-element) 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 |

> **How Repzo Chat differs from Slack**
>
> - `language` and `border` are accepted but ignored: the text is shown without syntax highlighting.

## Examples

### A code block

```json
{
  "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}"
            }
          ]
        }
      ]
    }
  ]
}
```

## Related

- [Rich text elements](https://workstation.repzo.com/docs/developers/block-kit/rich-text)
- [Block Kit overview](https://workstation.repzo.com/docs/developers/block-kit)
