LocationProNew in 5.18+
Collect a structured address with built-in inputs or map the address to your own fields. For autocomplete, connect Google Places. The Twig field type is location.
Settings

Choosing a setup
| To collect an address… | Choose |
|---|---|
| With manual entry | Manual entry only + Include fields |
| With search and editable inputs | Include fields + Always show |
| With a single search box | Include fields + Search only |
| With editable inputs after a suggestion is picked | Include fields + Show after selection |
| With custom labels, dropdowns, or layout | Map fields |
- Included fields use text inputs. Choose which components to show. If you omit Address Line 2, Address Line 1 is labeled Address.
- Mapped fields can be Text, Hidden, or Dropdown fields on the same form page. Use a separate target for each component. Dropdowns match the configured full name or code against option labels or values and clear when no option matches. Use individual mapped fields in conditional rules.
- Validation checks the included inputs you select in Required Components. If you enable Require this field and leave that selection empty, any non-empty address is accepted. Mapped fields use their own validation rules.
- Search behavior replaces component values when a visitor picks a new address and clears them and the mapped targets when they clear the search. If Google is unavailable or returns no suggestions, both Search only and Show after selection reveal manual inputs. On validation errors, Search only highlights the search box and keeps components hidden. Show after selection reveals missing details.
You can restrict suggestions to up to 15 comma-separated two-letter country codes. Leave the list blank for worldwide search. Require only components your supported countries use, and allow for visitors to add apartment details manually.
Editing submissions
Edit included address inputs as a group in the Craft control panel. In Map fields mode, edit the mapped fields directly and use them in templates or integrations that need the revised values. Control panel edits leave the original Location value intact in mapped mode.
Languages and translations
Override the built-in labels and messages in translations/<language>/freeform.php. Translate custom placeholders and validation messages through the form’s translation settings.
Google supplies the suggestion text using the browser language or the existing Maps loader’s language. Keep Google Maps attribution visible. Google Maps localization
Values and templates
Use the Location handle to access each address component in Twig.
{{ form.address.value.line1 }}
{{ form.address.value.line2 }}
{{ form.address.value.city }}
{{ form.address.value.state }}
{{ form.address.value.postalCode }}
{{ form.address.value.country }}
- Notifications use paths like
submission.address.value.city. - Integration Custom Values use expressions like
{{ address.city }}. Mapped fields also appear in the regular field pickers. - Exports include the search text and six component columns in CSV. JSON and GraphQL preserve the structured address. React and Vue support the same field configuration.
Customizing Location markup and styles
Pass locationAttributes to field.render(), field.renderInput(), field.setParameters(), or a form field selector such as @location. Use +class to append classes, =class to replace them, and -class to remove them.
| To style | Attribute slots |
|---|---|
| The whole field | wrapper |
| Search | searchContainer, searchInput, searchLabel, searchIcon |
| Address fields | components, componentContainer, componentInput, componentLabel |
{{ field.render({
locationAttributes: {
wrapper: { '+class': 'checkout-address' },
components: { '=class': 'checkout-address-grid' },
componentContainer: { '+class': 'address-part-{{ component }}' },
searchInput: { '+class': 'checkout-input' },
componentInput: { '+class': 'checkout-input' },
componentLabel: { '+class': 'checkout-label' },
},
}) }}
Wrappers accept tag. Use {{ component }} in component attributes for the component name. If you write your own input markup, preserve the generated names and the data-freeform-location, data-freeform-location-search, and data-location-component hooks. Include the form’s collected scripts.
CSS hooks
- Address grid uses
--ff-location-columns,--ff-location-gap, and--ff-location-components-spacing. - Search icon uses
.freeform-location-search-icon,data-state="search"ordata-state="selected", and the--ff-location-icon-colorand--ff-location-icon-spacevariables. - Suggestions inherit the search input’s styling. Override the
--ff-location-variables forbackground,color,border,radius,highlight,shadow, andoption-padding, or use.freeform-location-suggestions,.freeform-location-suggestion, and.freeform-location-attribution.
Floating label example
Render the main label inside the search wrapper with locationSearchLabel and place it after the input with locationLabelPosition.
{% do field.setParameters({
locationLabelPosition: 'after',
locationSearchLabel: true,
locationAttributes: {
searchContainer: { '+class': 'form-floating' },
componentContainer: { '+class': 'form-floating' },
},
}) %}
{{ field.renderContainerOpeningTag }}
{{ field.renderInput }}
{{ field.renderInstructions }}
{{ field.renderErrors }}
{{ field.renderContainerClosingTag }}