Skip to main content
Version: 2.0.0

GiftCreateModal

The gift create modal is used when the user wants to start the subscription gifting flow. once the user submits the gift recipient's information successfully in this modal, the information is stored in usePelcro's giftRecipient field.

Loading...

Usage#

import React from "react";
import {
GiftCreateModal,
PelcroModalController,
usePelcro,
} from "@pelcro/react-pelcro-js";
import "@pelcro/react-pelcro-js/dist/pelcro.css";
export const GiftCreateExample = () => {
const { switchView } = usePelcro();
return (
<>
<button onClick={() => switchView("gift-create")}>Send a gift</button>
<PelcroModalController>
<GiftCreateModal />
</PelcroModalController>
</>
);
};

Reference#

Props#

onDisplay#

() โ‡’ void

Callback function called when the modal is first displayed.

onClose#

() โ‡’ void

Callback function called when the modal is closed.

onSuccess#

(giftRecipient) โ‡’ void

Callback function called when the gift recipient's information is submitted succesfully.

onFailure#

() โ‡’ void

Callback function called when submitting the gift recipient's information fails.