Address Check

Address Check is a copy-paste React component that stops parcel returned for bad address before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/address-check
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsParcel returned for bad address

Was this component page useful?

How do I install Address Check?

pnpm dlx shadcn@latest add @bollard/address-check

The files land in your project. They're yours to edit.

How do I use Address Check in React?

address-check-usage.tsx
import { AddressCheck } from "@/components/ui/address-check"

<AddressCheck
  lookupPostcode={lookup}
  postcodeLookupUnknownMessage="This preview only recognizes a few sample postcodes. Your address isn't sent anywhere."
  defaultValue={{ country: "IN", line1: "Sai Residency, Baner Road", line2: "", city: "Mumbai", region: "Maharashtra", postcode: "411045" }}
/>

What input mistakes does Address Check catch?

  • No flat or house number in the street line
  • Postcodes in the wrong shape for the country, or that fit another country
  • A city that differs from where your postcode lookup places it
  • PO boxes that couriers can't deliver to
  • Postcode formatting fixed to the canonical shape (e.g. SW1A 1AA)

What props does Address Check accept?

AddressCheck props
PropTypeDefault
value

Controlled address.

Address—
defaultValue

Initial address when uncontrolled.

Partial<Address>—
onValueChange

Called with the whole address on every change.

(value: Address) => void—
lookupPostcode

Looks up where a postcode is. Resolve null when no result is returned, undefined when it can't be checked.

(country: string, postcode: string, signal: AbortSignal) => Promise<PostcodePlace | null | undefined>—
postcodeLookupEmptyMessage

Message when the postcode lookup returns no place.

string"No area details were returned for this postcode."
postcodeLookupUnknownMessage

Message when no local lookup data is available.

string"This postcode wasn't checked by a directory."
postcodeLookupFailedMessage

Message when the lookup fails.

string"Couldn't look up this postcode."
postcodeLookupRetryLabel

Retry button label after a lookup failure.

string"Retry"
countries

Country codes offered in the picker, from the built-in rules.

string[]Object.keys(COUNTRIES)
line1Label

Labels and placeholders.

string"Flat / house no., building, street"
line1Placeholder

Placeholder for the first address line.

string"B-204, Sai Residency, Baner Road"
line2Label

Label for the second address line.

string"Area, landmark (optional)"
line2Placeholder

Placeholder for the second address line.

string"Near Balewadi High Street"
cityLabel

Label for the city field.

string"City"
labelHeading

Heading above the printed-label readback.

string"Will print as"
noNumberMessage

Messages. `{city}`, `{typed}`, `{postcode}`, `{label}`, `{example}`, `{country}` are filled in.

string"No flat or house number. Couriers may not find the door."
noNumberDismissLabel

Text for dismissing the missing-number warning.

string"It has none"
poBoxMessage

Warning for PO box addresses.

string"Couriers can't deliver to a PO box. Use a street address."
postcodeFixMessage

Message offering the corrected postcode.

string"{label} should be written {fixed}."
otherCountryMessage

Message when the postcode fits another country.

string"That looks like a {country} postcode."
invalidPostcodeMessage

Message when the postcode doesn't fit the country.

string"{label} should be {example}."
cityMismatchMessage

Message when the city doesn't match the postcode.

string"{postcode} is in {city}, not {typed}."
cityMissingMessage

Message when the city is empty but the postcode is known.

string"{postcode} is in {city}."

* required. Also accepts the native props of <fieldset> (className, aria-*, data-*…), passed through to it.

How is Address Check accessible?

  • Each field has a hint in an aria-live="polite" region
  • Fixes and dismissals are buttons with visible text
  • The highlight animation respects prefers-reduced-motion

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Postcode formats are built in per country; it doesn't confirm the address exists
  • The city check needs a lookupPostcode function from you

What expensive mistakes does Address Check stop?

Parcel returned for bad address

Also known as

address · shipping address · delivery address · postcode · zip · checkout · address form · house number

Field type

What dependencies does Address Check require?

Address Check facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameAddress Check
Registry identifier@bollard/address-check
Install commandnpx shadcn@latest add @bollard/address-check
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-19
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Address Check

How does Address Check prevent financial transaction errors?

Address Check prevents parcel returned for bad address. Blocks No flat or house number in the street line, Postcodes in the wrong shape for the country, or that fit another country, A city that differs from where your postcode lookup places it, PO boxes that couriers can't deliver to, Postcode formatting fixed to the canonical shape (e.g. SW1A 1AA) before processing. Limitation: apply idempotency keys for address-check.

How do I install address-check with shadcn?

Run `npx shadcn@latest add @bollard/address-check`. Sources added: registry/default/address-check/address-check.tsx, registry/default/address-check/address-rules.ts. Package requirements: lucide-react.

What props customize Address Check?

Address Check accepts `value`, `defaultValue`, `onValueChange`, `lookupPostcode`, `postcodeLookupEmptyMessage`. Configures address, shipping address, delivery address behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of address-check?

Postcode formats are built in per country; it doesn't confirm the address exists. The city check needs a lookupPostcode function from you Server requirement: backend verification for address-check.

How does Address Check meet accessibility guidelines?

Each field has a hint in an aria-live="polite" region. Fixes and dismissals are buttons with visible text. The highlight animation respects prefers-reduced-motion. Minimizes errors: missing flat number address, postcode wrong country.

Which components pair with Address Check?