Address field
Description
The address field is used to collect structured address information from the user. It allows the user to search for their address, and select it from a list of suggestions. Then the field is expanded to show the different address components like street, city, state, postal code, and country.
User experience
The address field initially shows a single input for the user to enter their address. As the user types, the field suggests matching addresses from a database of known addresses.
When the user selects an address from the search results, the field is expanded to show the different editable address components.
Address components
The address field collects the following components:
- Line 1: The first line of the address, typically the street address.
- Line 2: The second line of the address, typically the apartment or suite number.
- City: The city or locality.
- State / Province / Region: The state or region.
- Postal code / Zip: The postal code.
- Country: The country.
Address components can be used in the following ways:
- Field references: You can reference the address components in other fields, like in a confirmation message, or in a hidden field. Example: Show the user’s city in a confirmation message.
- Conditional logic: You can use the address components in conditional logic to show or hide fields based on the user’s address. Example: Show an error message if the user’s country is not supported.
- Calculations: You can use the address components in calculations to calculate shipping costs, or tax rates based on the user’s address. Example: Calculate the shipping cost based on the user’s country.
Configuration
- Restrict: You can restrict the address field to specific countries, or allow all countries. This is useful if you only ship to certain countries, or if you want to collect addresses from all over the world.
Under the hood
The address field uses Open Street Map (OSM) for address suggestions. OSM is a free and open-source map database that is maintained by a global community of contributors. The address suggestions are based on the user’s input, and are not stored or shared with OSM.