Skip to content

AddressList - Vant 4

AddressList

📍 Create beautiful, interactive address lists that make managing delivery locations a breeze!

Intro

Display a list of receiving addresses with style and functionality! 🏠 The AddressList component provides an elegant way to show multiple addresses, allowing users to select, edit, and manage their delivery locations with ease. Perfect for e-commerce apps, delivery services, and any application that needs address management!

Install 📦

Register component globally via app.use, refer to Component Registration for more registration ways. Get started in seconds!

js
import { createApp } from'vue'; import { AddressList } from'vant'; const app = createApp(); app.use(AddressList);

Usage

Basic Usage - Smart Address Management! 🎯

Create a comprehensive address list with selection, editing, and management features! This example shows how to build a complete address management system with default addresses, disabled states, and interactive controls. Watch how easy it is to give users a delightful address selection experience!

html
js
import { ref } from'vue'; import { showToast } from'vant'; exportdefault { setup() { const chosenAddressId = ref('1'); const list = [ { id: '1', name: 'John Snow', tel: '13000000000', address: 'Somewhere', isDefault: true, }, { id: '2', name: 'Ned Stark', tel: '1310000000', address: 'Somewhere', }, ]; const disabledList = [ { id: '3', name: 'Tywin', tel: '1320000000', address: 'Somewhere', }, ]; constonAdd = () => showToast('Add'); constonEdit = (item, index) => showToast('Edit:' + index); return { list, onAdd, onEdit, disabledList, chosenAddressId, }; }, };

API

Props

AttributeDescriptionTypeDefault
v-modelId of chosen address, support multiple selection (type is [])*numberstring
listAddress listAddress[][]
disabled-listDisabled address listAddress[][]
disabled-textDisabled textstring-
switchableWhether to allow switch addressbooleantrue
show-add-buttonWhether to show add buttonbooleantrue
add-button-textAdd button textstringAdd new address
default-tag-textDefault tag textstring-
right-icon v4.5.0Right Iconstringedit

Events

EventDescriptionArguments
addEmitted when the add button is clicked-
editEmitted when the edit icon of address is clickeditem: Address, index: number
selectEmitted when an address is selecteditem: Address, index: number
edit-disabledEmitted when the edit icon of disabled address is clickeditem: Address, index: number
select-disabledEmitted when a disabled address is selecteditem: Address, index: number
click-itemEmitted when an address item is clickeditem: Address, index: number, { event }

Data Structure of Address

KeyDescriptionType
idId*number
nameNamestring
telPhone*number
addressAddressstring
isDefaultIs default addressboolean

Slots

NameDescriptionSlotProps
defaultCustom content after list-
topCustom content before list-
item-bottomCustom content after list itemitem: Address
tagCustom tag of list itemitem: Address

Types

The component exports the following type definitions:

ts
importtype { AddressListProps, AddressListAddress } from'vant';

Theming

CSS Variables

The component provides the following CSS variables, which can be used to customize styles. Please refer to ConfigProvider component.

NameDefault ValueDescription
--van-address-list-paddingvar(--van-padding-sm) var(--van-padding-sm) 80px-
--van-address-list-disabled-text-colorvar(--van-text-color-2)-
--van-address-list-disabled-text-paddingvar(--van-padding-base) * 5 0 var(--van-padding-md)-
--van-address-list-disabled-text-font-sizevar(--van-font-size-md)-
--van-address-list-disabled-text-line-heightvar(--van-line-height-md)-
--van-address-list-add-button-z-index999-
--van-address-list-item-paddingvar(--van-padding-sm)-
--van-address-list-item-text-colorvar(--van-text-color)-
--van-address-list-item-disabled-text-colorvar(--van-text-color-3)-
--van-address-list-item-font-size13px-
--van-address-list-item-line-heightvar(--van-line-height-sm)-
--van-address-list-radio-colorvar(--van-primary-color)-
--van-address-list-edit-icon-size20px-

Explore more components and features to enhance your mobile app experience:

  • AddressEdit - Learn about address editing components for creating and modifying addresses
  • Area - Master area selection components for location picking
  • Radio - Understand radio button components for single selections
  • Button - Discover button components and interactions
  • Cell - Explore cell components for list items
  • Icon - Learn about icon components and customization
  • Toast - Master toast notifications for user feedback
  • ConfigProvider - Customize themes and global configurations
  • Advanced Usage - Component registration and advanced techniques
  • Vant 4 Overview - Explore all Vant 4 features and components

Enterprise-level mobile solution based on Vant