Tag Archives: FormattedUrl

Hyperlink to recordId in Lightning Aura Component

A lightning:formattedUrl component displays a read-only representation of a URL as a hyperlink with an href attribute. The link can be a relative or absolute URL.

Sample Code:

<aura:component> 
    <aura:attribute name="recordId" type="String" default="0063X0000146rTLQAY"/>
    <lightning:formattedUrl value="{!'/' + recordId}" tooltip="Opportunity" label="Opportunity" target="_blank" />
</aura:component>