Tally UI

ShippingAddressFields

ShippingAddressFields is the order's shipping address, shown as "Same as billing" until the cashier uses a different address.

Import

import { ShippingAddressFields } from '@tallyui/components';

Usage

<ShippingAddressFields billing={billing} value={shipping} onChange={setShipping} countries={countries} statesFor={statesFor} />

Shipping reads "Same as billing" while value is empty or a copy of billing (email aside). This is read once, when the component mounts, so key it by order to read it again.

"Use a different address" calls onChange with billing's copy, without its email, and shows the address parts as AddressFields. "Same as billing" calls onChange(undefined).

Props

PropTypeDefaultDescription
billingCustomerAddress | undefinedrequiredThe billing address
valueCustomerAddress | undefinedrequiredThe shipping address
onChange(next: CustomerAddress | undefined) => voidrequiredEvery edit; undefined is "Same as billing"
countriesAddressFieldsProps['countries']---Passed to the address parts
statesForAddressFieldsProps['statesFor']---Passed to the address parts
testIDstring'shipping-address'testID prefix

On this page