# what3words developer documentation: Search Box > Add what3words address search to a form, app or checkout: search box SDKs for Android, iOS and the web, e-commerce plugins and integrations. Every page in this section, in menu order, as Markdown. Section page: https://developer.what3words.com/docs/search-box.md. All sections: https://developer.what3words.com/llms.txt --- # Creating an Android AutoSuggest edittext field with the what3words AutoSuggest Component Adding a 3 word address edittext field with AutoSuggest to an Android App Topics: Android, Java, Mobile App Section: [Search Box](https://developer.what3words.com/docs/search-box.md) Source: https://developer.what3words.com/tutorial/creating-an-android-autosuggest-edittext-box-with-what3words-autosuggest-component Updated: 2026-11-27 ### Step by step The what3words Android AutoSuggest Component provides an easy way of adding a what3words EditText field to an Android app. The component allows the user to enter a 3 word address, providing AutoSuggest suggestions whilst typing and error correction to ensure accurate entries. The component is straightforward to use and can be configured using a range of properties. The component uses the what3words API or alternatively can be configured to use our [Enterprise Suite API Server](https://developer.what3words.com/enterprise-suite/api-server). Full sample apps for the component can be found in our Github repo [Android Sample Apps](https://github.com/what3words/w3w-android-samples) Find out how else you can utilise the what3words API in your app by taking a look at the [what3words Android API Wrapper.](https://developer.what3words.com/tutorial/android/) **Minimum supported OS version:** 6.0 (API level 23) ![](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/4459aeb6977c08a0333d6648ef90c97b093bfae827cf8408c1d61e73a3ddee47.gif) Getting started with Mani, what3words Head of Android Developer, on [How to create an AutoSuggest Edittext with Kotlin](http://youtu.be/xY-gac5Cur0) ## 1. Get API key You will need a what3words API key to complete this tutorial. [Get an API Key](https://accounts.what3words.com/select-plan) or [sign in](https://accounts.what3words.com/). ## 2. Installation The artifact is available through [Maven Central](https://search.maven.org/artifact/com.what3words/w3w-android-components). **Gradle** ```groovy implementation 'com.what3words:w3w-android-components:3.1.3' ``` ## 3. Usage Take a look at this repository for samples of how to use the component and some of its more advanced features. [Android Component](https://github.com/what3words/w3w-android-components) The following should be included in AndroidManifest.xml: **XML** ```xml ``` Add the following to build.gradle (app level): **Gradle** ```groovy compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } ``` The following should be included in activity\_main.xml: **XML** ```xml ``` ### Adding the component Replace `YOUR_API_KEY_HERE` with your what3words API key. For each `suggestion` it is possible to obtain the 3 word address (`words`) and other characteristics such as `country`, `latitude` and `longitude` (if `returnCoordinates` has been specified). **Kotlin** ```kotlin class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) suggestionEditText.apiKey("YOUR_API_KEY_HERE") .returnCoordinates(false) .onSuggestionSelected { suggestion -> if (suggestion != null) { Log.i( "MainActivity","words: ${suggestion.words}, country: ${suggestion.country}, distance: ${suggestion.distanceToFocusKm}, near: ${suggestion.nearestPlace}, latitude: ${suggestion.coordinates?.lat}, longitude: ${suggestion.coordinates?.lng}") } else { Log.i("MainActivity", "invalid w3w address") } } .onError { error -> Log.e("MainActivity", "${error.key} - ${error.message}") } } ``` **Java** ```java public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); W3WAutoSuggestEditText autoSuggestEditText = findViewById(R.id.suggestionEditText); autoSuggestEditText.apiKey("YOUR_API_KEY_HERE") .returnCoordinates(false) .onSuggestionSelected(null, null, (SuggestionWithCoordinates suggestion) -> { if (suggestion != null) { Log.i("MainActivity", String.format("words: %s, country: %s, near: %s", suggestion.getWords(), suggestion.getCountry(), suggestion.getNearestPlace())); } else { Log.i("MainActivity", "invalid w3w address"); } }) .onError(null, (APIResponse.What3WordsError what3WordsError) -> Log.e("MainActivity", String.format("%s - %s", what3WordsError.getKey(), what3WordsError.getMessage()))); } ``` ### Enterprise Suite API Server If you run our Enterprise Suite API Server yourself, you may specify the URL to your own server like so: **Kotlin** ```kotlin autoSuggestEditText.apiKey("YOUR_API_KEY_HERE", "https://api.yourserver.com") ``` **Java** ```java autoSuggestEditText.apiKey("YOUR_API_KEY_HERE", "https://api.yourserver.com") ``` ### Enable voice autosuggest ![](https://kpcwlqbjuaezxoatdmqy.supabase.co/storage/v1/object/public/devsite-media/wp/5d4d0ad8ccd28fcc3623bae82ce33b6053b9e1abb51357f88cf918076cac6be1.w1600.webp) The component also allows for voice input using the what3words Voice API. This feature allows the user to say 3 words and using speech recognition technology displays 3 word address suggestions to the user. Before enabling Voice AutoSuggest you will need to add a Voice API plan in [your account](https://accounts.what3words.com/billing). By default the voice language is set to English but this can be changed using the voiceLanguage property (for list of available languages please check the properties table below). Voice input respects the clipping and focus options applied within the general properties. We recommend applying clipping and focus where possible to display as accurate suggestions as possible. To enable voice you can do with programmatically or directly in the XML. The following should be included in AndroidManifest.xml: **XML** ```xml ... ``` The following should be included in activity\_main.xml: **XML** ```xml ``` or MainActivity.kt / MainActivity.java **Kotlin** ```kotlin suggestionEditText.apiKey("YOUR_API_KEY_HERE") .returnCoordinates(false) .voiceEnabled(true) ... ``` ### Advanced usage: properties There are a range of customisation properties you can use to configure the AutoSuggest Component. | Parameter | Default value | Type | Description | XML | Programatically | | --- | --- | --- | --- | --- | --- | | apiKey | N/A | string | Your what3words API key. (mandatory) | | Yes | | hint | e.g. lock.spout.radar | String | Placeholder text to display in the input in its default empty state. | Yes | Yes | | errorMessage | An error occurred. Please try again later | String | Overwrite the generic error message with a custom value. | Yes | Yes | | invalidAddressMessage | No valid what3words address found | String | Overwrite the validation error message with a custom value. | Yes | Yes | | focus | N/A | Coordinates | This is a location, specified as a latitude/longitude (often where the user making the query is). If specified, the results will be weighted to give preference to those near the \`focus\` | | Yes | | clipToCountry | N/A | String | Clip results to a given country or comma separated list of countries. Example value:"GB,US". | | Yes | | clipToCircle | N/A | Coordinates, Int | Clip results to a circle, specified by Coordinate(lat,lng) and kilometres, where kilometres in the radius of the circle. | | Yes | | clipToBoundingBox | N/A | BoundingBox | Clip results to a bounding box specified using co-ordinates. | | Yes | | clipToPolygon | N/A | List of Coordinates | Clip results to a bounding box specified using co-ordinates. | | Yes | | allowInvalid3wa | false | Boolean | By default the EditText field will clear an inputted value if a valid 3 word address is not entered. Setting allowInvalid3wa to true stops this behaviour and the value is persisted in the EditText. | | Yes | | returnCoordinates | false | Boolean | Calls the what3words API to obtain the coordinates for the selected 3 word address (to then use on a map or pass through to a logistic company, etc) | Yes | Yes | | displayUnit | DisplayUnits.SYSTEM | DisplayUnits | Set end-user display unit, DisplayUnits.SYSTEM (default), DisplayUnits.METRIC, DisplayUnits.IMPERIAL | Yes | Yes | | allowFlexibleDelimiters | false | Boolean | Allow EditText to accept different delimiters than the what3words standard full stop "index.home.raft", i.e "index home raft" or "index,home,raft". | Yes | Yes | Voice properties: | Property | Default value | Type | Description | XML | Programatically | | --- | --- | --- | --- | --- | --- | | voiceEnabled | false | Boolean | Enables voice suggestion to allow the user to say the three word address instead of writing it. | Yes | Yes | | voiceLangauge | en | String | Available voice languages: ar for Arabic, cmn for Mandarin Chinese, de for German, en for Global English (default), es for Spanish, hi for Hindi, ja for Japanese and ko for Korean | Yes | Yes | ## 4. Styling Use our base style as parent and you can set the custom properties available with XML on the table above and the normal EditText styling, i.e: **XML** ```xml ``` ## 5. Troubleshooting If you encounter errors or issues related to convert-to-coordinate requests while using the Free plan, please check the network panel for the following error message `Error 402 payment required` and its response, indicating the need to upgrade to a higher plan: **JSON** ```json { "error": { "code": "QuotaExceeded", "message": "Quota Exceeded. Please upgrade your usage plan, or contact support@what3words.com" } } ``` For more information, visit our [API plans page](https://accounts.what3words.com/select-plan). If you need further assistance, contact [support@what3words.com](mailto:support@what3words.com). --- # Using the Notes Component Adding a what3words address to an existing textarea field with the Notes Component. Topics: Angular, JavaScript, React, Vue, Website Section: [Search Box](https://developer.what3words.com/docs/search-box.md) Source: https://developer.what3words.com/tutorial/using-the-notes-component Updated: 2026-11-27 ### Tutorial The easiest way to add what3words to your technology is to use one of our components. We have components available for JavaScript, iOS and Android which require minimal development to integrate. The JavaScript component can also be used in React.js, Vue.js and Angular. The what3words Notes Component allows users to input a 3-word address in the delivery notes field alongside free text. It provides real-time suggestions and validation, ensuring accurate address input. By default, it uses the what3words API but can be configured to use a private instance. This tutorial guides you through adding the JavaScript Notes Component to your website, whether you have static pages or use npm. It also covers customisation options to refine the 3-word address suggestions and how to style the component to match your site’s design. If you aim to integrate the what3words Public API into your Node.js or browser-based applications, our [JavaScript API Wrapper](https://developer.what3words.com/tutorial/javascript) is ideal. You can also access the JavaScript API Wrapper via the window object using our [JavaScript SDK](https://developer.what3words.com/tutorial/javascript-sdk). ### Quickstart The Notes Component requires just a few lines of code to be added to a form to create a what3words-powered textarea field. **Note:** - Replace `YOUR-API-KEY` with your actual what3words API key. - Customise the `placeholder` and `label` text as needed. #### Integrate within a Textarea Field To add the what3words Notes Component to a textarea field in your checkout page, e.g. Delivery Notes, use the following code snippet: **HTML** ```html Checkout Page
``` **React** ```jsx import { useState } from 'react'; import { What3wordsNotes } from '@what3words/react-components'; function MyFormElement() { const [value, setValue] = useState(''); const onChange = e => setValue(e.target.value); return ( ``` **React** ```jsx ``` **React** ```jsx ``` **Vue** ```vue ``` **Angular** ```typescript

Custom title

Custom content

``` **React** ```jsx

Custom title

Custom content

``` **Vue** ```vue

Custom title

Custom content

``` **Angular** ```typescript

Custom title

Custom content

``` ## 3. Localise the Component ### Supported languages The Notes Component will accept any 3-word address in any language supported by the what3words API. It can also be added to a site using a right-to-left language as long as the HTML direction has been set, for example: **HTML** ```html ``` **React** ```jsx ``` **React** ```jsx ``` **Vue** ```vue ``` **Angular** ```typescript ``` ### Country clipping To refine the suggestions supplied to a user we recommend using country clipping where appropriate. If, for example, the component is to be used on a checkout page then country clipping can be specified using the `clip-to-country` attribute for the delivery country to ensure that only suggestions are shown in that country and closer matches are displayed. Multiple countries can be specified as comma-separated. **HTML** ```html ``` **React** ```jsx ``` **Vue** ```vue ``` **Angular** ```typescript ``` ### Focus In addition to country clipping, it is also possible to add focus to results using the `search-focus` attribute. The focus should be supplied as a lat, long, usually the user’s location from the GPS on their device. Supplying focus will ensure that suggestions displayed to the user are biased to their location. **HTML** ```html ``` **React** ```jsx ``` **Vue** ```vue ``` **Angular** ```typescript ``` ### Controlling Tooltip Display The `showHintsTooltip` property of the what3words Notes Component allows you to control whether the what3words hint tooltip is displayed when the status icon is clicked. By setting the `show-hints-tooltip` attribute to `true` or `false`, you can choose whether to display the tooltip based on your application’s requirements. Here is an example where you decided to hide the tooltip by setting `show-hints-tooltip` attribute to `"false"`. **HTML** ```html ``` **React** ```jsx ``` **Vue** ```vue ``` **Angular** ```typescript ``` ## 5. Streamlining Delivery and Data Extraction **1\. Ensuring Smooth Deliveries:** For flawless fulfilment, getting the identified what3words address into the hands of everyone involved is crucial. This includes integrating it with your order management system and carrier partners. By doing so, you ensure addresses are processed accurately, leading to efficient deliveries. **2\. Extracting what3words Addresses:** Need to isolate what3words addresses from your existing order data? We’ve got you covered! Utilise the provided RegEx formula (included below with a cautionary note). This code helps detect potential what3words addresses within your data. **Have further questions or require assistance?** Feel free to contact our technology partner team at [technology.partnerships@what3words.com](mailto:technology.partnerships@what3words.com). We’re happy to help you navigate what3words integration and ensure a smooth user experience. **Important Considerations:** - While this approach simplifies integration, it’s crucial to note that the RegEx only validates the format, not the actual validity of the what3words address. Further verification might be necessary. Please refer to this [tutorial](https://developer.what3words.com/tutorial/detecting-if-text-is-in-the-format-of-a-3-word-address) for more information on this RegEx and its variations. Implementing these steps will allow you to leverage the power of what3words to streamline your deliveries and extract valuable location data from your existing system. ## 6. Attributes Table ### Component script parameters | Property | Attribute | Type | Description | | --- | --- | --- | --- | | apikey | api-key | String | An API key is required for the component to function correctly. Example: `api-key=Your-API-Key` | | apiVersion | api-version | ApiVersion.Version1 | The API version to use for the what3words API requests. Example: `'v3' as import('@what3words/api').ApiVersion` | | baseUrl | base-url | String | The component can be used with an Enterprise Suite API Server instance by using baseUrl. Example: `baseUrl=https://example.com/v3` | | callback | callback | String | Allows for a callback to be fired once the component has loaded. This should be the function name to be fired. Example: `callback=initMap` | | headers | headers | String | Enterprise API Server only - Allows for custom headers to be passed through in requests. | ### Recommended textarea or input element attributes | Attribute | Type | Description | | --- | --- | --- | | name | String | Standard CSS name. Example: name="what3words" | | id | String | Standard CSS input ID. If not specified then one will be added by our component. Example: id="what3words" | | class | String | Standard CSS class - use with the variant=inherit attribute to apply this class to the input element of the component. Example: class="input-field" | | placeholder | String | Placeholder text to display. We recommend keeping the placeholder as a what3words address proceeded with "e.g." Example: placeholder="e.g ///filled.count.soap" | ### Slots | Slot | Description | | --- | --- | | "input" | The textarea element to get suggestions from when typing. Example: textarea slot="input". | | "label" | The label element for the input slot element. Example: label slot="label" | | "tooltip" | The tooltip content to display when the status icon is clicked. Example div slot="tooltip | ### Component attributes | Property | Attribute | Type | Description | | --- | --- | --- | --- | | addressFormat | address-format | "slashes" \| "url" | The format to display the what3words address in - slashes - e.g. ///filled.count.soap (default) - url - e.g. https://w3w.co/filled.count.soap. Example: address-format="url" | | apiKey | api-key | String | Your what3words API Key can be specified as an attribute to the component. Example: api-key="Your-API-Key" | | clipToBoundingBox | clip-to-bounding-box | String | Restrict suggestions to a bounding box specified using co-ordinates. Example: clip-to-bounding-box="51.521,-0.343,52.6,2.3324" | | clipToCircle | clip-to-circle | String | Restrict suggestions to a circle, specified by lat,lng,kilometres, where kilometres is the radius of the circle. Example: clip-to-circle="51.521251,-0.203586,2" | | clipToCountry | clip-to-country | String | Restrict suggestions to a given country or comma separated list of countries. Example: clip-to-country="GB,US" | | clipToPolygon | clip-to-polygon | String | Restrict suggestions to a polygon, specified by a comma-separated list of lat,lng pairs. The polygon should be closed, i.e. the first element should be repeated as the last element; also the list should contain at least 4 entries. The API is currently limited to accepting up to 25 pairs. Example: clip-to-polygon="51.521,-0.343,52.6,2.3324,54.234,8.343,51.521,-0.343" | | language | language | String | Allows you to add a preferred suggestion fallback language. Only used when input value language cannot be determined. Example: language="EN" | | nFocusResults | n-focus-results | Number | The number of AutoSuggest results to apply the focus to. Example: n-focus-results="2" | | searchFocus | search-focus | {number},${number} | The focus point to prioritise results around. If not provided, the user's current location is used. Example: search-focus="51.5,-020" | | showHintsTooltip | show-hints-tooltip | Boolean | Show the what3words hints tooltip when clicking on the what3words status icon. Example: show-hints-tooltip="true" | | typeaheadDelay | typeahead-delay | Number | The delay in milliseconds to wait after the user has finished typing before making an autosuggest request. Example: typeahead-delay="300" | ## 7. Events Table | Event | Description | | --- | --- | | apiError | Emitted when an error occurs with the what3words API | | suggestionsHover | Emitted when a suggestion is hovered over | | suggestionsChanged | Emitted when the list of suggestions changes | | suggestionSelected | Emitted when a suggestion is selected | | valueChanged | Emitted when the input value changes | | valueInvalid | Emitted when the input value is not a valid what3words address | | valueValid | Emitted when the input value is a valid what3words address | ### Listening for events Using an event listener, it is possible to fire other functionality in a site when something changes in the Notes Component. For example, it is possible to listen for when a valid what3words address has been entered and update another element in the page or to listen for when new coordinates have been returned and pan/zoom a map to the location. **JavaScript** ```javascript document.addEventListener('DOMContentLoaded', () => { const notesComponent = document.querySelector('what3words-notes'); notesComponent.addEventListener('suggestionSelected', (event) => { const selectedSuggestion = event.detail.suggestion; console.log('Suggestion selected:', selectedSuggestion); // You can add additional code here to handle the selected suggestion }); }); ``` **React** ```jsx import { useState } from 'react'; import { What3wordsNotes } from '@what3words/react-components'; function MyFormElement() { const [value, setValue] = useState(''); const onChange = e => setValue(e.target.value); return ( console.log(detail.value)} onValueValid={({ detail }) => console.log(detail.value)} onValueInvalid={({ detail }) => console.log(detail.value)} onSuggestionSelected={({ detail }) => console.log(detail.suggestion)} onSuggestionsChanged={({ detail }) => console.log(detail.suggestions)} >