Optional
agentHTTP Agent
For downstream clients like core-node and core-browser, this will default to the native platform HTTP client
Optional
alignAutomatically aligns address finder
true
API Key from your Ideal Postcodes account. Typically begins ak_
Optional
ariaConfigures which WAI-ARIA specification version Address Finder should target.
"1.1"
will target the most recent spec"1.0"
will enable some regressions to support the 1.0 spec.Although 1.1 was released in 2017, this currently defaults to "1.0" as it receives the widest support among screen readers. VoiceOver (for MacOS and iOS) and NVDA in particular benefit from this.
Defaults to "1.0"
Optional
autocompleteSets the autocomplete=
attribute of the input element. Setting this attribute aims to prevent some browsers (particularly Chrome) from providing a clashing autofill overlay.
The best practice for this attribute breaks over time (see https://stackoverflow.com/questions/15738259/disabling-chrome-autofill) and is specific to different forms. If you are observing chrome's autofill clashing on your form, update this attribute to the best practice du jour.
"none"
Optional
baseTarget API domain
"api.ideal-postcodes.co.uk"
Optional
checkAn optional field to check whether the key is usable against the Ideal
Postcodes API. This should be used in conjunction with the
onFailedCheck
callback to specify the necessary behaviour when the API
Key is not in a usable state. This is true
by default.
Optional
containerCSS class assigned to the AddressFinder container/wrapper
Defaults to "idpc_autocomplete"
"idpc_autocomplete"
Optional
containerApplies additional styling to the the Address Finder container element. Accepts CSSStyleDeclaration object `containerStyle encapsulates all elements of Address Finder including the input, ARIA controls
@default
{}
{
containerStyle: {
backgroundColor: "#000",
},
}
Optional
contextsProvide a custom list of possible contexts to select a new country or context from
Optional
countryCSS class assigned to country toggle button
"idpc_country"
Optional
defaultDefault Country
"GBR"
Optional
detectDetects country based on IP address.
true
Optional
documentSpecify the Document to operate on
window.document
Optional
fixedSet CSS display attribute to fixed
on the Address Finder list element
false
Optional
formatSpecify the format to receive the resolved address in.
"gbr"
Optional
headerString map specifying default headers
{}
Optional
hideHide a list of HTML elements when Postcode Lookup is instantiated
Specify these elements using query selectors or direct HTMLElement references
[]
Optional
hideHides the toolbar. Users are unable to change the country
false
Optional
injectInject stylesheet into DOM to style Address Finder with default theme. Default is true
Styling of the Address Finder can be achieved using a CSS file. Set this to false
if you wish to do this
true
Injects the default styles into the DOMstring
e.g. https://cdn.jsdelivr.net/npm/@ideal-postcodes/address-finder@1.1.1/css/address-finder.min.css
will include a CSS Stylesheet in the DOM with the src set as the stringOptional
inputCSS selector or HTML Element which specifies the <input>
field which the
Address Finder View should bind.
Optional
inputApplies additional styling to the input field. Ideal for quick tweaks. Accepts CSSStyleDeclaration object Input styles are restored to original when controller is detached from DOM
{}
{
inputStyle: {
backgroundColor: "#000",
},
}
Optional
labelsAn object specifying the labels associated with HTML Input Elements to target for address population
Optional
liApplies additional styling to the the Address Finder list element. Accepts CSSStyleDeclaration object
{}
{
liStyle: {
backgroundColor: "#000",
},
}
Optional
listCSS class assigned to suggestion list
Defaults to "idpc_ul"
"idpc_ul"
Optional
listApplies additional styling to the the suggestion list. Accepts CSSStyleDeclaration object
style
encapsulates all visible elements of Address Finder. This element is actively shown/hidden when AddressFinder is toggled
{}
{
listStyle: {
backgroundColor: "#000",
},
}
Optional
mainCSS class assigned to Address Finder element. This element is the main visible element containing address suggestions, messages and toolbar underneath the address finder
Defaults to "idpc_af"
"idpc_af"
Optional
mainApplies additional styling to the the Address Finder Main Component. The Main Component contains the visible elements of the Address Finder such as the address suggestion list, toolbar and messages which appears underneath the input field.
Accepts CSSStyleDeclaration object
{}
{
mainStyle: {
backgroundColor: "#000",
},
}
Optional
messageCSS class assigned to message box
Defaults to "idpc_error"
"idpc_error"
Optional
msgAria-label attached to country select bytton
Defaults to "Click to change your country"
Optional
msgFallback message in case communication message with API fails
Defaults to "Please enter your address manually"
Optional
msgInitial message when Address Finder opens an no query is available
Defaults to "Start typing to find address"
Optional
msgAria-label attached to the suggestion list. Prompts screen reader user on how to operate list
Defaults to "Select your address"
"Select your address"
Optional
msgMessage presented when no matches found for a particular query
Defaults to "No matches found"
Optional
msgMessage in input placeholder when address results are suggested
Defaults to "Try the first line or postal code of your address"
Optional
msgMessage in input placeholder when country suggestions are presented
Defaults to "Select your country"
Optional
msgMessage shown to user to unhide address fields if hide
attribute is configured
"Enter address manually"
Optional
namesAn object specifying the name
s of HTML Input Elements to target for address population
This will fallback to aria-name
if a name cannot be detected
Optional
offsetOffset of AddressFinder from input in pixels
2
Optional
onInvoked when selected address is populated into address fields of user address form
Optional
onInvoked when the Address Finder client has retrieved a full address from the API following a user accepting a suggestion. The first argument is an object representing the address that has been retrieved.
Optional
onInvoked immediately after the user has selected a suggestion (either by click or keypress). The first argument is an object which represents the suggestion selected.
Optional
onInvoked when blur
event is dispatched by Address Finder input field
Optional
onInvoked when the Address Finder view closes (i.e. disappears)
Optional
onInvoked each time context changed (i.e. user change country to search address)
Optional
onInvoked when a user selects a country.
Optional
onInvoked when checkKey
is enabled and the key is discovered to be in an
unusable state (e.g. daily limit reached, no balance, etc).
Optional
onInvoked when focus
event is dispatched by Address Finder input field
Optional
onInvoked when input
event is dispatched by Address Finder input field
Optional
onInvoked when keypress on input field occurs
Optional
onInvoked when Address Finder has been successfully attached to the input element.
Optional
onInvoked when view is attached to the DOM
Optional
onInvoked when mouse click on Address suggestion occuers
Optional
onInvoked when Address Finder suggestion box is opened (i.e. presented to the user).
Optional
onInvoked when view is detached from the DOM
Optional
onInvoked when an error has occurred following an attempt to retrieve a full address. i.e. the API request made after the user selects a suggestion.
The first argument is an error instance (i.e. inherits from Error
)
representing the error which has occurred.
In this scenario the user will also receive a message to manually input an address if address retrieval fails.
Optional
onInvoked when a suggestion has been selected
Optional
onInvoked when an address suggestion retrieval request has failed.
In this scenario the user will be alerted that no address suggestions could be found and to manually input an address.
Optional
onInvoked immediately after address suggestions are retrieved from the API. The first argument is an array of address suggestions.
Optional
onInvoked when hidden fields are unhidden (i.e. user selects an address or opts for manual input)
Optional
outputAn object specifying where address field data points should be piped.
The attribute of the document should be the same as the address attribute
as found in the documentation. E.g. line_1
, post_town
, postcode
.
You may use a CSS selector string
or a HTMLElement
. E.g.
{ line_1: "#line_1" }
or { line_1: document.getElementById("line_1") }
Using an HTMLElement
as an outputField
selector has the effect of eagerly binding the Address Finder instance to your output fields. When using string
selectors, Address Finder will bind to your ouput fields when when an address is selected.
Optional
outputSpecify parent element for output fields to looking for them to narrow search area
Optional
populateSuppresses county
from being populated if set to false
true
Optional
populateSuppresses organisation_name
from being populated if set to false
true
Optional
queryOptional configuration object to apply to address queries
Optional
removeOptional. An optional field to remove organisation name from address lines.
This is false
by default.
Optional
resolveOptional configuration object to apply to address resolve queries
Optional
restrictNarrow the countries you wish to support
Setting this to an empty array (default) will enable all countries
Setting this to a single country will disable country selection and hide the country selection toolbar
[]
Optional
scopeScopes the operable area of the DOM
window.document
Optional
strictForce autocomplete authorisation via HTTP headers only
false
Optional
tagsAppend tags to helper requests like lookupPostcode
and lookupUDPRN
Tags attached to the client are overwritten on an request if it is also specified in the helper request options
[]
Optional
timeoutDefault time in ms before HTTP request timeout. Defaults to 10s (10000
)
10000
Optional
titleizeAn optional field to convert the case of the Post Town from upper case
into title case. E.g. "LONDON"
becomes "London".
Default is true
Optional
tlsUse TLS
true
Optional
toolbarCSS class assigned to toolbar at bottom of Address Finder
"idpc_toolbar"
Optional
unhideSpecify a clickable element to unhide elements hidden with hide
null
Optional
unhideClass of clickable unhide element
"idpc-unhide"
Optional
versionAPI version
"v1"
Configuration options for an Address Finder instance