Newer Version Available
ui:inputURL
An input field for entering a URL.
A ui:inputURL component represents an input field for a URL, which is rendered as an HTML input tag of type url. To apply Lightning Design System styling, we recommend that you use lightning:input with type="url" instead of ui:inputURL.
This is a basic set up of a ui:inputURL component.
1<ui:inputURL aura:id="url" label="Venue URL" class="field" value="http://www.myURL.com"/>This example results in the following HTML.
1<div class="uiInput uiInputText uiInputURL uiInput--default uiInput--input">
2 <label class="uiLabel-left form-element__label uiLabel">
3 <span>Venue URL</span>
4 </label>
5 <input class="field input" type="url">
6</div>This example retrieves the value of a ui:inputURL component and displays it using ui:outputURL. To apply Lightning Design System styling, we recommend that you use lightning:input with type="url" instead of ui:inputURL.
1<aura:component>
2 <ui:inputURL aura:id="url" label="Venue URL" class="field" value="http://www.myURL.com"/>
3 <ui:button class="btn" label="Submit" press="{!c.setOutput}"/>
4 <div aura:id="msg" class="hide">
5 You entered: <ui:outputURL aura:id="oURL" value=""/>
6 </div>
7</aura:component>1({
2 setOutput : function(component, event, helper) {
3 var cmpMsg = component.find("msg");
4 $A.util.removeClass(cmpMsg, 'hide');
5
6 var url = component.find("url").get("v.value");
7 var oURL = component.find("oURL");
8 oURL.set("v.value", url);
9 oURL.set("v.label", url);
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. | |
| disabled | Boolean | Specifies whether the component should be displayed in a disabled state. Default value is "false". | |
| errors | List | The list of errors to be displayed. | |
| label | String | The text of the label component | |
| labelClass | String | The CSS class of the label component | |
| maxlength | Integer | The maximum number of characters that can be typed into the input field. Corresponds to the maxlength attribute of the rendered HTML input element. | |
| placeholder | String | Text that is displayed when the field is empty, to prompt the user for a valid entry. | |
| required | Boolean | Specifies whether the input is required. Default value is "false". | |
| requiredIndicatorClass | String | The CSS class of the required indicator component | |
| size | Integer | The width of the input field, in characters. Corresponds to the size attribute of the rendered HTML input element. | |
| updateOn | String | Updates the component's value binding if the updateOn attribute is set to the handled event. Default value is "change". | |
| value | String | The value currently in the input field. |
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. |
| select | COMPONENT | The event fired when the user selects some text. |
| blur | COMPONENT | The event fired when the user moves off from the component. |
| focus | COMPONENT | The event fired when the user focuses on the component. |
| keypress | COMPONENT | The event fired when the user presses or holds down a keyboard key on the component. |
| keyup | COMPONENT | The event fired when the user releases a keyboard key on the component. |
| keydown | COMPONENT | The event fired when the user presses a keyboard key on the component. |
| cut | COMPONENT | The event fired when the user cuts content to the clipboard. |
| onError | COMPONENT | The event fired when there are any validation errors on the component. |
| onClearErrors | COMPONENT | The event fired when any validation errors should be cleared. |
| change | COMPONENT | The event fired when the user changes the content of the input. |
| copy | COMPONENT | The event fired when the user copies content to the clipboard. |
| paste | COMPONENT | The event fired when the user pastes content from the clipboard. |