Formatted Text
lightning:formattedText
Displays text, replaces newlines with line breaks, and linkifies if requested. This component requires API version 41.0 and later.
For Aura components only. For LWC development, use lightning-formatted-text.
For Use In
Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App, Mobile Offline
A lightning:formattedText 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 or \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, set linkify="true".
Setting linkify="true" 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:formattedText supports the following protocols: http, https, ftp, and mailto.
If you're working with hyperlinks and need to specify the target value, use lightning:formattedURL instead. If you're working with email addresses only, use lightning:formattedEmail.
For rich text that uses tags beyond anchor tags, use lightning:formattedRichText instead.