Core Concepts

Address Element

Collect address details for 236+ regional formats

Address Element

The Address Element collects address details for 236+ regional formats. It automatically adapts to show the correct fields based on the customer's country, making it easy to collect accurate address information for shipping and billing.

The Address Element can be used in two modes:

  • Billing Address - For collecting billing addresses
  • Shipping Address - For collecting shipping addresses

Basic Usage

<script setup>
import { loadStripe } from '@stripe/stripe-js'
import { AddressElement, Elements } from 'vue-stripe'

const stripePromise = loadStripe('pk_test_xxx')
</script>

<template>
  <Elements :stripe="stripePromise">
    <form>
      <AddressElement />
      <button type="submit">
        Continue
      </button>
    </form>
  </Elements>
</template>

With Options

<template>
  <AddressElement
    :options="{
      mode: 'billing',
      allowedCountries: ['US', 'CA', 'GB'],
      blockPoBox: true,
      fields: {
        phone: 'always',
      },
    }"
  />
</template>

Billing and Shipping Address Variants

Vue Stripe provides specialized components for billing and shipping addresses:

BillingAddressElement

<script setup>
import { BillingAddressElement } from 'vue-stripe/checkout'
</script>

<template>
  <BillingAddressElement />
</template>

ShippingAddressElement

<script setup>
import { ShippingAddressElement } from 'vue-stripe/checkout'
</script>

<template>
  <ShippingAddressElement />
</template>

Props

PropTypeDescription
optionsAddressElementOptionsConfiguration options for the Address Element. See available options.

Events

EventDescription
@readyTriggered when the Address Element is fully rendered
@changeTriggered when address data changes
@focusTriggered when the Element receives focus
@blurTriggered when the Element loses focus
@loaderstartTriggered when the loader UI is mounted
@loadererrorTriggered when the Element fails to load

Example with Value Retrieval

<script setup>
import { ref } from 'vue'
import { AddressElement, useElements } from 'vue-stripe'

const elements = useElements()
const address = ref(null)

async function handleChange(event) {
  if (event.complete) {
    const addressElement = elements.value?.getElement(AddressElement)
    if (addressElement) {
      const { complete, value } = await addressElement.getValue()
      if (complete) {
        address.value = value
      }
    }
  }
}
</script>

<template>
  <form>
    <AddressElement @change="handleChange" />
    <button type="submit">
      Continue
    </button>
  </form>
</template>

Supported Countries

The Address Element supports 236+ countries and automatically formats address fields based on the selected country. It handles:

  • Different address formats (street, city, state, postal code variations)
  • Regional validation rules
  • Localized field labels
  • Required vs optional fields per country

Common Use Cases

Collecting Billing Address

<template>
  <BillingAddressElement
    :options="{
      fields: {
        phone: 'always',
      },
    }"
  />
</template>

Collecting Shipping Address

<template>
  <ShippingAddressElement
    :options="{
      fields: {
        phone: 'always',
      },
    }"
  />
</template>

Restricting Countries

<template>
  <AddressElement
    :options="{
      allowedCountries: ['US', 'CA', 'MX'],
    }"
  />
</template>

For detailed information about the Address Element and its usage, refer to the Stripe Address Element documentation.