yarn add @colabcommerce/elements
npm install @colabcommerce/elements
import ProductForm from '@colabcommerce/elements/ProductForm'
import '@colabcommerce/elements/dist/style.css'
<ProductForm
id="colab-id"
locale="en"
product={{
name: "Product Name",
sku: "product-sku",
external_id: "product-external-id",
image: "https://via.placeholder.com/150",
options: [
{
key: "Size",
value: "Large"
}
],
additionalData: {}
}}
onSuccess={handleSuccess}
onCancel={handleCancel}
onClose={handleClose}
/>onSuccess, onCancel, and onClose props are optional, but recommended to handle user interactions with the form.idStringrequired
The Colab ID of the organization that is using the cart form element.
localeString
The locale that the store locator element is being used in. Default behavior is to use the browser's locale.
productObjectrequired
onSuccessCallback
(leadData) => { console.log({leadData}) }A callback fired when the form is successfully completed.
onCloseCallback
(null) => { }A callback fired when the form is closed, usually after a successful submission.
onCancelCallback
(null) => { }A callback fired when the form is cancelled.