New:Socket for Asana Is Now Available.Learn more
Get Started

@postio/address-finder

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@postio/address-finder

Drop-in UK address autocomplete — accessible combobox over the Postio API.

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

@postio/address-finder

Drop-in UK address autocomplete — accessible combobox over Postio, the UK validation API for addresses, emails and phone numbers.

First time? Sign up free — first 100 lookups on us, no card needed.

This is the source package — for use with bundlers (Vite, Webpack, esbuild, Rollup, Next.js, etc.). For a script-tag drop-in with no build step, install @postio/address-finder-bundled or load from https://cdn.postio.co.uk/v1/address-finder.js.

Install

npm install @postio/address-finder

Use

<input id="address-search" />
<input id="address-line-1" />
<input id="town" />
<input id="postcode" />
import { setup } from "@postio/address-finder";

const finder = setup({
  apiKey: "pk_…",
  input: "#address-search",
  output: {
    address_line_1: "#address-line-1",
    post_town: "#town",
    postcode: "#postcode",
  },
});

// Later, if needed:
finder.clear();
finder.close();
finder.destroy();

Options

OptionTypeDefaultNotes
apiKeystringRequired. pk_* publishable key.
inputstring | HTMLInputElementRequired. The text input the user types into.
outputOutputMapRequired. Map of API field → DOM target to populate.
baseUrlstringhttps://api.postio.co.uk/v1Override for self-hosted / staging.
barebooleanfalseSkip the visual CSS layer; ship structural only.
minLengthnumber2Min chars before searching.
debounceMsnumber80Debounce input by N ms.
maxResultsnumber7Max suggestions in dropdown (cap 50).
classNamestringExtra class on the listbox element.
zIndexnumber1000z-index of the dropdown.
onReady() => voidCalled once after setup.
onSearch(query, results) => voidAfter every search response.
onSelect(address) => voidWhen the user picks an address. Gets the full record.
onError(err) => voidAny search or fetch error.

output keys are the API field names — address_line_1, post_town, postcode, udprn, latitude, longitude, etc. See @postio/api-types for the full list.

output values can be a CSS selector or an HTMLElement. <input>, <textarea> and <select> get their .value set + input and change events dispatched (so React/Vue/Angular pick up the change). Anything else gets .textContent set.

Theming

Default styling is intentionally minimal and inherits font + color from the parent. Override via CSS custom properties on any ancestor:

.my-form {
  --postio-af-bg: white;
  --postio-af-border: 1px solid #d0d4dc;
  --postio-af-radius: 6px;
  --postio-af-padding: 4px;
  --postio-af-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --postio-af-option-padding: 8px 10px;
  --postio-af-option-radius: 4px;
  --postio-af-option-hover-bg: #f3f4f6;
  --postio-af-focus-ring: 2px solid #2563eb;
  --postio-af-z: 1000;
}

Or target the BEM-style classes directly:

.postio-af__listbox { /* … */ }
.postio-af__option { /* … */ }
.postio-af__option[aria-selected="true"] { /* … */ }

For full control, opt out of visual defaults — setup({ ..., bare: true }) ships only the structural CSS (positioning, list semantics, hide/show).

Accessibility

  • ARIA combobox pattern (WAI-ARIA 1.2): role="combobox" on the input, role="listbox" on the dropdown, role="option" per suggestion, aria-expanded / aria-controls / aria-activedescendant updated live.
  • Full keyboard nav: / / Home / End / Enter / Escape / Tab.
  • Mouse hover follows keyboard highlight.
  • Inherits font-family, color, and font-size so it picks up the page's typography automatically.

Performance

  • One in-flight search at a time — the previous one is aborted on the next keystroke.
  • Free /connect warm-up fired on first input focus (no billing impact).
  • Debounced input by default at 80 ms.

License

MIT.

Keywords

postio

FAQs

Package last updated on 12 Aug 2026

Related posts