Newer Version Available
ui:outputPhone
Displays the phone number in a URL link format.
A ui:outputPhone component represents a phone number output that is wrapped in an HTML span tag. This component can be used with ui:inputPhone, which takes in a phone number input. The following example is a simple set up of a ui:outputPhone component.
1<ui:outputPhone value="415-123-4567"/>The previous example renders the following HTML.
1<span class="uiOutputPhone">415-123-4567</span>When viewed on a mobile device, the example renders as an actionable link.
1<span class="uiOutputPhone">
2 <a href="tel:415-123-4567">415-123-4567</a>
3</span>
This example shows how you can bind data from a ui:inputPhone component.
1<aura:component>
2 <ui:inputPhone aura:id="phone" label="Phone Number" class="field" value="415-123-4567" />
3 <ui:button class="btn" label="Submit" press="{!c.setOutput}"/>
4
5 <div aura:id="msg" class="hide">
6 You entered: <ui:outputPhone aura:id="oPhone" value="" />
7 </div>
8</aura:component>1({
2
3 setOutput : function(component, event, helper) {
4 var cmpMsg = component.find("msg");
5 $A.util.removeClass(cmpMsg, 'hide');
6
7 var phone = component.find("phone").get("v.value");
8 var oPhone = component.find("oPhone");
9 oPhone.set("v.value", phone);
10 }
11})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 style to be attached to the component. This style is added in addition to base styles output by the component. | |
| value | String | The phone number displayed when this component is rendered. | Yes |
Events
| Event Name | Event Type | Description |
|---|---|---|
| dblclick | COMPONENT | The event fired when the user double-clicks the component. |
| mouseover | COMPONENT | The event fired when the user moves the mouse pointer over the component. |
| mouseout | COMPONENT | The event fired when the user moves the mouse pointer away from the component. |
| mouseup | COMPONENT | The event fired when the user releases the mouse button over the component. |
| mousemove | COMPONENT | The event fired when the user moves the mouse pointer over the component. |
| click | COMPONENT | The event fired when the user clicks on the component. |
| mousedown | COMPONENT | The event fired when the user clicks a mouse button over the component. |