Google Maps API Required: You must add the Google Maps JavaScript API script to your application and provide a valid API key with Places API enabled.
Setup
Add the Google Maps script to your HTML:.env:
Import
Usage
Props
Must be
true when Google Maps API is fully loaded. Input is disabled while false.If
true, only shows route + number in input after selection (e.g., “Calle Mayor 15”). Full address data is still provided in onLocationChange.Google Places API search types. Common options:
['address']: Street addresses['(cities)']: Cities only['establishment']: Businesses and points of interest['geocode']: Geocoding results
Google Places API fields to fetch. Determines what data is available in the response.
Common fields:
geometry: Coordinates (lat/lng)address_components: Parsed address partsformatted_address: Full formatted addressname: Place nameplace_id: Unique identifier
Callback with parsed location data when user selects an address from the dropdown.
Placeholder text for the input. Shows “Cargando…” while API is loading.
Visual variant inherited from Input component.
Error message displayed below the input.
Default address value to display in the input.
Disables the input. Note: Input is automatically disabled when
isLoaded is false.Location Data Interface
Examples
With Loading State
Address Validation
Search for Cities Only
Error Handling
The component displays built-in error messages in Spanish:- Missing street number: “Necesitamos una dirección más precisa para encontrar tu código postal. Por favor, indica el número de la calle.”
- Connection error: “Parece que hubo un error de conexión al obtener la dirección. Prueba de nuevo más tarde.”
Features
- Debounced search: 500ms delay to reduce API calls
- Spanish localization: Results and interface in Spanish
- Autocomplete dropdown: Suggestions appear below input
- Structured parsing: Extracts street, number, city, province, zip code, country
- Coordinate support: Returns lat/lng for mapping
- Error validation: Built-in validation for complete addresses