HTTP Agent
For downstream clients like core-node and core-browser, this will default to the native platform HTTP client
Automatically aligns address finder
API Key from your Ideal Postcodes account. Typically begins ak_
Configures 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"
Sets 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.
Target API domain
An 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.
CSS class assigned to the AddressFinder container/wrapper
Defaults to "idpc_autocomplete"
Applies additional styling to the the Address Finder container element. Accepts CSSStyleDeclaration object `containerStyle encapsulates all elements of Address Finder including the input, ARIA controls
Provide a custom list of possible contexts to select a new country or context from
CSS class assigned to country toggle button
Default Country
Specify the Document to operate on
Specify the format to receive the resolved address in.
String map specifying default headers
Hide a list of HTML elements when Postcode Lookup is instantiated
Specify these elements using query selectors or direct HTMLElement references
Hides the toolbar. Users are unable to change the country
Inject 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 stringCSS selector or HTML Element which specifies the <input>
field which the
Address Finder View should bind.
Applies 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
An object specifying the labels associated with HTML Input Elements to target for address population
Applies additional styling to the the Address Finder list element. Accepts CSSStyleDeclaration object
CSS class assigned to suggestion list
Defaults to "idpc_ul"
Applies 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
CSS 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"
Applies 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
CSS class assigned to message box
Defaults to "idpc_error"
Aria-label attached to country select bytton
Defaults to "Click to change your country"
Fallback message in case communication message with API fails
Defaults to "Please enter your address manually"
Initial message when Address Finder opens an no query is available
Defaults to "Start typing to find address"
Aria-label attached to the suggestion list. Prompts screen reader user on how to operate list
Defaults to "Select your address"
Message presented when no matches found for a particular query
Defaults to "No matches found"
Message in input placeholder when address results are suggested
Defaults to "Try the first line or postal code of your address"
Message in input placeholder when country suggestions are presented
Defaults to "Select your country"
Message shown to user to unhide address fields if hide
attribute is configured
An 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
Offset of AddressFinder from input in pixels
Invoked when selected address is populated into address fields of user address form
Invoked 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.
Invoked immediately after the user has selected a suggestion (either by click or keypress). The first argument is an object which represents the suggestion selected.
Invoked when blur
event is dispatched by Address Finder input field
Invoked when the Address Finder view closes (i.e. disappears)
Invoked when a user selects a country.
Invoked when checkKey
is enabled and the key is discovered to be in an
unusable state (e.g. daily limit reached, no balance, etc).
Invoked when focus
event is dispatched by Address Finder input field
Invoked when input
event is dispatched by Address Finder input field
Invoked when keypress on input field occurs
Invoked when Address Finder has been successfully attached to the input element.
Invoked when view is attached to the DOM
Invoked when mouse click on Address suggestion occuers
Invoked when Address Finder suggestion box is opened (i.e. presented to the user).
Invoked when view is detached from the DOM
Invoked 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.
Invoked when a suggestion has been selected
Invoked 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.
Invoked immediately after address suggestions are retrieved from the API. The first argument is an array of address suggestions.
Invoked when hidden fields are unhidden (i.e. user selects an address or opts for manual input)
An 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.
Specify parent element for output fields to looking for them to narrow search area
Suppresses county
from being populated if set to false
Suppresses organisation_name
from being populated if set to false
Optional configuration object to apply to address queries
Optional. An optional field to remove organisation name from address lines.
This is false
by default.
Narrow 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
Scopes the operable area of the DOM
Force autocomplete authorisation via HTTP headers only
Append 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
Default time in ms before HTTP request timeout. Defaults to 10s (10000
)
An optional field to convert the case of the Post Town from upper case
into title case. E.g. "LONDON"
becomes "London".
Default is true
Use TLS
CSS class assigned to toolbar at bottom of Address Finder
Specify a clickable element to unhide elements hidden with hide
Class of clickable unhide element
API version
Configuration options for an Address Finder instance