Skip to main content
Version: 3.14.0

CartModal

The cart modal is used to show the user's cart items and to start the checkout flow, the user can remove items from the cart as well.

Loading...

Usage#

import React from "react";
import {
CartModal,
PelcroModalController,
usePelcro,
} from "@pelcro/react-pelcro-js";
import "@pelcro/react-pelcro-js/dist/pelcro.css";
export const CartExample = () => {
const { switchView } = usePelcro();
return (
<>
<button onClick={() => switchView("cart")}>Show cart</button>
<PelcroModalController>
<CartModal />
</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#

(cartItems) โ‡’ void

Callback function called when the user clicks the checkout button.