A lightning:inputLocation component represents a geolocation compound field that accepts user input for a latitude and longitude value. Latitude and longitude are geographic coordinates specified in decimal degrees. The geolocation compound field allows you to identify locations by their latitude and longitude. The latitude field accepts values within -90 and 90, and the longitude field accepts values within -180 and 180. An error message is displayed when you enter a value outside of the accepted range.
Here are a few examples of latitudes: -30, 45, 37.12345678, -10.0. Values such as 90.5 or -90.5 are not valid latitudes. Here are a few examples of longitudes: -100, -120.9762, 115.84. Values such as 180.5 or -180.5 are not valid longitudes.
This example displays a geolocation compound field with a latitude of 37.7938460 and a longitude of -122.3948370.
<aura:component> <lightning:inputLocation label="My Coordinates" latitude="37.7938460" longitude="-122.3948370"/> </aura:component>
Methods
This component supports the following methods.
focus(): Sets focus on the element.
blur(): Removes focus from the element.
checkValidity(): Returns the valid property value (Boolean) on the ValidityState object to indicate whether the combobox has any validity errors.
showHelpMessageIfInvalid(): Shows the help message if the compound field is in an invalid state.
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. | |
latitude | String | The latitude value. Latitude values must be within -90 and 90. | |
longitude | String | The longitude value. Longitude values must be within -180 and 180. | |
required | Boolean | Specifies whether the compound field must be filled out. An error message is displayed if a user interacts with the field and does not provide a value. This value defaults to false. | |
disabled | Boolean | Specifies whether the compound field should be disabled. Disabled fields are grayed out and not clickable. This value defaults to false. | |
readonly | Boolean | Specifies whether the compound field is read-only. This value defaults to false. | |
variant | String | The variant changes the appearance of the compound field. Accepted variants include standard and label-hidden. This value defaults to standard. | |
label | String | Text label for the compound field. | |
onblur | Action | The action triggered when the input releases focus. | |
onchange | Action | The action triggered when the value changes. | |
onfocus | Action | The action triggered when the input receives focus. |