Formatted Text
lightning-formatted-text
Displays text, replaces newlines with line breaks, and linkifies if requested.
For Use In
Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App, Mobile Offline
A lightning-formatted-text component displays a read-only representation of
text, and can convert URLs and email addresses to links, or "linkify" them.
It also converts the \r and \n characters into <br /> tags.
By default, URLs and email addresses display as plain text.
To display URLs and email addresses in a block of text as links, include
linkify on the lightning-formatted-text tag.
linkify wraps URLs and email addresses in anchor tags with
target="_blank". If the URL protocol isn't specified in the text,
the link's href uses https:// or http:// to match the host domain's
protocol. For example, www.example.com is prefixed with https://
if the host domain's protocol is https://. The href uses mailto://
for email addresses.
This example uses domain names without protocols in the text.
The example renders like this.
lightning-formatted-text supports the following protocols: http, https,
ftp, and mailto.
If you're working with hyperlinks and want to specify the target value, use
lightning-formatted-url instead. If you're working with email addresses only,
use lightning-formatted-email.
For rich text that uses tags beyond anchor tags, use
lightning-formatted-rich-text instead.