Skip to content
Calm motion: animations on this site only fade, with no movement

Address fields ​

Address fields whose order and names follow the country

Asks for a postal address in the form that people of each country know. For example, a US address has a state and a ZIP code, and a Japanese address starts with the postal code. For one line of free text, use the input.

Basic
Shipping address

Change the country to see the fields move. {"country":"ID","line1":"Jl. Braga No. 41","city":"Bandung","region":"Jawa Barat"}

  • v-model is the address: country as an ISO code, and line1, line2, city, region, and postal.
  • countries sets the list of countries, as codes. Their names come from Intl.DisplayNames in the locale (default English).
  • A small table gives the rows of fields for Indonesia, the US, Canada, the UK, Germany, France, and Japan. Other countries get a common form. formats adds a country or changes one, with its rows and the names of its region and postal code.
  • Each field has the right autocomplete value, so the browser can fill in a saved address. All fields but the second line are required.
  • The fields are native fields in a group named by label (default "Address"). Change the names with labels or a label pack: country, line1, line2, city, state, province, prefecture, county, zip, postcode, and postal.

Usage ​

ts
import { BlessAddressFields } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
countriesstring[]["ID", "US", "GB", "DE", "FR", "JP", "CA"]the countries to offer, as ISO codes
formatsRecord<string, BlessAddressFormat>—more formats, or changes to the built-in ones, by country code
localestring"en"the language of the country names, for example `id`
labelstring"Address"names the group of fields
labelsPartial<{ country: string; line1: string; line2: string; city: string; state: string; province: string; prefecture: string; county: string; zip: string; postcode: string; postal: string; }>—
modelValueBlessAddress{ country: "ID" }

Events

NamePayloadDescription
update:modelValue[value: BlessAddress]

Released under the MIT License. Character names and artwork belong to their owners.