Drop-in UK address lookup for any website. One script tag — no framework, no build step, no dependencies.
Add the script and a container element. That’s it.
<div id="addresso" data-api-key="ak_your_api_key"></div> <script src="https://unpkg.com/@addresso/widget"></script>
The widget auto-initialises on any element with id="addresso" or a data-addresso attribute. Configure via data attributes.
<div
id="addresso"
data-api-key="ak_your_api_key"
data-placeholder="Type your postcode"
data-button-text="Search"
></div>
<script src="https://unpkg.com/@addresso/widget"></script>
<script>
document.getElementById("addresso")
.addEventListener("addresso:select", function (e) {
var address = e.detail;
console.log(address.building_number, address.street);
console.log(address.town, address.postcode);
});
</script>For more control, use Addresso.init() instead of data attributes.
<div id="address-lookup"></div>
<script src="https://unpkg.com/@addresso/widget"></script>
<script>
Addresso.init({
target: "#address-lookup",
apiKey: "ak_your_api_key",
placeholder: "Enter postcode",
buttonText: "Find address",
onSelect: function (address) {
document.getElementById("street").value = address.street;
document.getElementById("town").value = address.town;
document.getElementById("postcode").value = address.postcode;
},
});
</script>Pass these to Addresso.init() or use the equivalent data-* attributes.
apiKeystringrequiredYour Addresso API key. HTML: data-api-key.
targetstring | ElementrequiredCSS selector or DOM element to mount into. Not needed for data-attribute mode.
baseUrlstringAPI base URL. Defaults to https://addresso.co.uk. HTML: data-base-url.
placeholderstringInput placeholder. Defaults to "Enter postcode". HTML: data-placeholder.
buttonTextstringButton label. Defaults to "Find address". HTML: data-button-text.
onSelectfunctionCalled with the full address object when a user picks an address.
In data-attribute mode, listen for the addresso:select custom event on the container. The full address object is in event.detail.
document.getElementById("addresso")
.addEventListener("addresso:select", function (e) {
var address = e.detail;
// address.postcode, address.town, address.street, etc.
});The widget includes minimal built-in styles. All elements use .addresso-widget__* BEM classes that you can override in your own CSS.
/* Example: match your site's brand colour */
.addresso-widget__btn {
background: #4F46E5;
}
.addresso-widget__btn:hover {
background: #4338CA;
}
.addresso-widget__input:focus {
border-color: #4F46E5;
box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}