Address Input
A postal address form that renders the fields the chosen country actually writes, in that country's order, with that country's labels, and with only that country's fields required. Japan asks for a postal code, then a prefecture, then the address — and no city at all. The United Kingdom has no state and calls its city a post town. Hong Kong has no postal code but requires an area. Singapore has no state but requires a six-digit postal code. Ireland has a townland line above the town and an optional Eircode. Reach for it wherever a form collects somewhere a letter or a parcel could actually arrive: checkout shipping and billing addresses; sign-up and onboarding; KYC, AML and identity verification; a company, store, clinic or venue's registered address; invoicing, VAT and tax details; bank, payout and remittance details; delivery, collection and installation; the address row on a profile, customer or organisation record; insurance, loan and mortgage applications; a change-of-address or moving form; shipping labels and customs declarations; and the address block on any admin or CRM record. Common asks it answers: "address form react", "address input component", "international address form", "shadcn address form", "shadcn address input", "shadcn address fields", "country specific address fields", "address fields by country", "dynamic address form by country", "address form i18n", "localized address form react", "address form that changes by country", "postal code validation react", "zip code validation by country", "validate postcode regex by country", "state field optional for international addresses", "address form without state field", "required state breaks international checkout", "japan address form react", "japanese address no city field", "prefecture field react", "uk address form post town", "hong kong address no postal code", "singapore address form", "ireland eircode optional", "address autocomplete attributes react", "autocomplete address-level1 address-level2", "autocomplete street-address vs address-line1", "browser autofill address form react", "autofill puts city in the wrong field", "shipping and billing autofill same page", "autocomplete section prefix shipping billing", "react address form validation", "google libaddressinput react", "libaddressinput data react component", "i18n-postal-address alternative", "@shopify/address react component", "react-country-region-selector alternative", "use-places-autocomplete alternative", "react-google-places-autocomplete alternative", "address form without google places api", "address form no api key", "accessible address form labels", "住所 フォーム react", "住所入力 コンポーネント", "国別 住所 項目 変わる", "海外 住所 入力 フォーム", "都道府県 入力 フォーム", "郵便番号 バリデーション 国別", "住所 autocomplete 属性", "自動入力 住所 ずれる", "州 必須 海外 住所 入力できない", "post town イギリス 住所", "請求先 配送先 住所 フォーム". Official shadcn/ui has nothing of the kind, measured today rather than remembered. Fetching every entry in its registry — 65 listed, 62 fetchable, code-block, questionnaire and trace 404 on both style tracks — and searching all 223,287 bytes of files[].content, address, postalCode, postcode, locality, administrativeArea, addressLine, street, zip, address-level1, street-address, prefecture, province, county, Eircode and CLDR are every one of them a zero hit: its field, input-group and native-select are empty containers that know nothing about where anything is. The decision everything else follows from: there is no such thing as the fields of an address, so the field list is data and not layout. A form with a required State and a required ZIP is a form a large part of the world cannot complete, and the usual workaround — marking them optional and hiding the rest behind an "international" branch — moves the problem into the data instead of solving it. So the field set, the order, the labels, the required flags and the shape of the postal code all come out of a 252-country table derived from the dataset Chrome's own address autofill uses (Google's Address Data Service, the data behind libaddressinput, Apache-2.0). It is re-derivable rather than a snapshot nobody can check: scripts/address-data.mjs prints the table, and --check diffs the shipped one against upstream and names every country that has drifted. Nothing in it was written from memory, and that is not a figure of speech — this component's own design note had Japan down as postal code, prefecture, municipality and had Hong Kong as having neither a state nor a postal code, and the measured data contradicts both. What the data decides, field by field: the order (Japan ZSA, the US ACSZ, Hong Kong SCA — largest unit first in the countries that write it that way), which fields exist at all, which may be left empty (Ireland overrides nothing and so inherits street-and-town, leaving its county and Eircode optional), and what the field is called — twelve different names for the administrative area alone, so prefecture, state, province, county, parish, island, department, emirate, area, oblast and Do / Si each read as themselves, and ZIP code, PIN code, Eircode and postal code likewise. Labels are keyed by the name upstream gives the field rather than by country, so labels={{ prefecture: "都道府県" }} translates every country that calls it that in one line. The second half is browser autofill, which matters more here than in any other field because there are six of them: each input carries the token the browser fills it from — street-address when there is one address line and address-line1/2/3 when there are several, address-level1 for the administrative area even in the countries that do not call it a state, address-level2 for the locality, address-level3 for the line above it, postal-code for the code — and autoCompleteSection prefixes every one of them, because a page with a shipping and a billing address otherwise hands the browser two fields both claiming to be postal-code and it fills one of them. The country is a native select for the same reason: a custom combobox cannot be autofilled, and autocomplete="country" on the field that decides every other field is worth more than a searchable list. It is asked first whatever order that country writes it in, because it is what the rest of the form is; changing it clears the fields the new country does not have, since keeping them means the value carries a US state while the address is in Hong Kong and that is what eventually gets submitted. Postal codes are checked against their own country's pattern, and the anchoring is the part worth stating: several patterns upstream are a top-level alternation — the UK's is GIR ?0AA|(?:AB|AL|…)…|BFPO ?\d{1,4} — so anchors written straight onto one bind the first and last branch only, and "nonsense SW1A 1AA nonsense" sails through. They are wrapped before they are anchored, and a test fails if the wrapper is removed. Codes are matched in capitals because no postal code is case-sensitive, and capitalised on the way out only where upstream says that country capitalises them — an Eircode is left as typed, because overriding the data there would be this component's opinion rather than the data's. An empty code is the required check's business and not the shape check's, so an optional code can actually be left empty. The mobile keyboard goes numeric only where the pattern cannot contain a letter: numeric for Japan, Germany and Singapore, text for the UK, Canada and the Netherlands. Controlled or uncontrolled, and typable in both — the value carries every field including the ones the country does not use, so a half-filled address round-trips through a controlled parent without losing a keystroke, and the re-seed compares field by field so a parent that rebuilds an equal object on every render does not reset the field being typed in. That is a bug this registry has shipped once already and it has a test here. Accessibility is the rest of it: a labelled role="group", a real label pointing at every input, optional fields saying so in their label, aria-required, and an error that appears once a field has been visited — announced through role="alert" and wired into aria-describedby and aria-invalid — with showErrors to surface every problem at once on submit. What it deliberately does not do: no subdivision lists (the administrative area is a text input with address-level1 so the browser can fill it; pass administrativeAreaOptions to make it a select where you do have the list), no recipient name or organisation (almost always already collected elsewhere in the form, and bundling them produces two name fields — in the countries that write largest-unit-first the recipient conventionally comes last), no address lookup, no Places call, no network, and no claim that a real address exists at that code. Within this registry the neighbours are each one field of this one: country-select picks the country and supplies the country names used here, phone-input collects a number, masked-input enforces a shape, slug-input a character set, and filter-builder and sort-builder build queries rather than addresses. None of them knows what fields an address has. The API: value and onChange make it controlled, or defaultValue uncontrolled, over a flat { country, addressLine1, addressLine2, addressLine3, dependentLocality, locality, administrativeArea, postalCode }; addressLines picks 1 to 3 street lines; countries narrows the list; locale names the countries; labels and messages cover the wording; autoCompleteSection, namePrefix, legend, showErrors, administrativeAreaOptions and disabled cover the rest, and namePrefix posts the whole address through a plain form or a server action. The rules are exported as pure functions so a server route, a shipping-label renderer, a confirmation screen or a test can have the same answers without mounting anything: rulesFor, fieldsFor, validateAddress, isValidPostalCode, postalCodePattern, normalizePostalCode and emptyAddress. Styled entirely with shadcn tokens (input, ring, destructive, muted-foreground, background) so it follows light and dark mode, and it ships zero npm dependencies — no address library, no country-data package, no icon package, one file.
Installation
Requires @pulld in the registries of your components.json (shadcn adds official directory namespaces automatically).
Use with Coding Agent
Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.
Use the "Address Input" component (pulld/address-input) from its shadcn registry.1. Install it with: npx shadcn@latest add @pulld/address-input2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.Files & dependencies
- registry/ui/address-input.tsx
Looks similar, elsewhere
There is no screenshot of this item to compare yet.