Newer Version Available
lightning:formattedPhone
Displays a phone number as a hyperlink with the tel: URL scheme. This component requires API version 41.0 and later.
A lightning:formattedPhone component displays a read-only representation of a phone number as a hyperlink using the tel: URL scheme. Clicking the phone number opens the default VOIP call application on a desktop. On mobile devices, clicking the phone number calls the number.
Providing a phone number with 10 or 11 digits that starts with 1 displays the number in the format (999) 999-9999. Including a "+" sign before the number displays the number in the format +19999999999.
Here are two ways to display (425) 333-4444 as a hyperlink.
1<aura:component>
2 <p><lightning:formattedPhone value="4253334444"></lightning:formattedPhone></p>
3 <p><lightning:formattedPhone value="14253334444"></lightning:formattedPhone></p>
4</aura:component>The previous example renders the following HTML.
1<a href="tel:4253334444">(425) 333-4444</a>
2<a href="tel:14253334444">(425) 333-4444</a>Attributes
| Attribute Name | Attribute type | Description | Required? |
|---|---|---|---|
| body | Component[] | The body of the component. In markup, this is everything in the body of the tag. | |
| class | String | A CSS class for the outer element, in addition to the component's base classes. | |
| title | String | Displays tooltip text when the mouse moves over the element. | |
| value | Integer | Sets the phone number to display. | |
| onclick | Action | The action triggered when the phone number is clicked. |