AutoSuggest Component

To add a what3words field with AutoSuggest to your website (we call this the AutoSuggest Component), follow these simple steps:


1

Choose API Key

You will need a valid API key in order to use this component within your website.


2

Customise the AutoSuggest Component

For further details of how to customise the component using HTML attributes take a look at our tutorial


1


3

Choose Technology


4

Add the component to a form


Add this snippet of code between the <head></head> tags.

<script 
  type="module" 
  src="https://cdn.what3words.com/javascript-components@4-latest/dist/what3words/what3words.esm.js" 
/>
<script 
  nomodule 
  src="https://cdn.what3words.com/javascript-components@4-latest/dist/what3words/what3words.js?key=YOUR-API-KEY"
/>
Copied

Add this snippet of code within an HTML form element.

<what3words-autosuggest 
  api_key="YOUR-API-KEY">
  <input 
    autocomplete="off"
    type="text" 
  />
</what3words-autosuggest>
Copied

For further details of how to ensure the component inherits the styling of your form and to look at other available attributes, take a look at our tutorial

Using an e-commerce platform? Try one of our plugins instead…