DeleteAddressButton
Delete an address with a confirmation dialog. Safe-deletion
rules are enforced server-side; a ValidationError surfaces as a
failed mutation the caller can toast.
import { DeleteAddressButton } from "@evolve-storefront/feature-account/delete-address-button";Renders inside AccountProvider.
Preview
Usage
Each card in the book can be deleted, behind a confirmation.
<AddressBook addresses={book.items} renderItem={(address) => ( <AddressCard> <AddressLines lines={formatAddressLines(address, { locale })} /> <AddressCardFooter> <DeleteAddressButton address={address} /> </AddressCardFooter> </AddressCard> )}/>;Props
| Prop | Type | Description |
|---|---|---|
address | Address | |
defaultOpen? | boolean | |
onDeleted? | (() => void) | |
children? | ReactNode | Custom trigger; defaults to a small destructive button. |
Examples
Custom Triggerchildren replaces the trigger; the confirmation and the write stay the same.
<DeleteAddressButton address={address}> <Button variant="tertiary" tone="destructive"> {t("remove")} </Button></DeleteAddressButton>;
