Skip to Content

CheckoutSection

Compose a provider-neutral checkout flow from caller-owned details, payment, review, and order-summary slots.

CheckoutSection is a presentation-only checkout shell. It composes customer, billing, shipping, payment, review, terms, actions, and summary content supplied by the application. It does not calculate prices, validate inventory, create orders, or call a payment provider.

Stable API maturity: Stable. The component API is covered by package tests and is intended to remain backward-compatible within a major version.

390 × 844

Installation

import {
  CheckoutSection,
  PaymentMethodSelector,
} from "@puzzle-ui/pieces";

API

PropTypeDescription
variant"form" | "split" | "compact" | "multi-step" | "sidebar"Controls the layout; defaults to "form".
customerDetailsReactNodeApplication-owned customer fields.
billingDetailsReactNodeApplication-owned billing fields.
shippingDetailsReactNodeApplication-owned shipping fields.
paymentReactNodeProvider-specific payment UI or application-owned payment fields.
reviewReactNodeReview content before submission.
summaryReactNodeApplication-calculated order summary.
paymentMethodsreadonly PaymentMethodOption[]Optional provider-neutral methods rendered by the section.
selectedPaymentMethodstringControlled selected payment method.
defaultPaymentMethodstringInitial payment method for uncontrolled usage.
paymentMethodNamestringNative radio-group name for payment methods.
onPaymentMethodChange(value: string) => voidCalled when the method changes.
stepsreadonly CheckoutStep[]Optional composable progress steps.
currentStepIdstringActive step identifier.
onStepChange(stepId: string) => voidApplication-owned step navigation.
termsReactNodeTerms or privacy consent controls.
actionsReactNodeOptional application-owned additional actions.
onSubmit(formData: FormData) => void | Promise<void>Application-owned submit action.
submitLabelReactNodeSubmit button content; defaults to "Place order".
loadingbooleanDisables submit while the application is processing.
successReactNodeSuccess feedback supplied by the application.
errorReactNodeError feedback supplied by the application.
PropRequiredDefault
variantNo"form"
onSubmitNo—
loadingNofalse

The component renders a named semantic form and exposes loading, error, and success states. All price, tax, discount, shipping, availability, and payment status values must come from trusted application/server state.

Payment providers

CheckoutSection and PaymentMethodSelector do not contain Stripe, Mollie, PayPal, Adyen, or other provider branches. Applications can render a provider-specific client widget in the payment slot while keeping provider credentials and authoritative payment operations on the server.

Accessibility and responsive behavior

The component uses labelled sections, a semantic form, progress semantics, a keyboard-accessible payment radio group, visible error feedback, and a responsive summary layout. Application-provided fields and controls remain responsible for their own labels, validation, and accessible descriptions.

Theme support

The section consumes semantic Puzzle Theme variables for surfaces, borders, spacing, text, focus rings, and status colors. It inherits the active or scoped theme and does not require provider-specific styling.

Data and business logic

Keep order resolution, server-side totals, discounts, tax, payment status, idempotency, webhook processing, and fulfillment outside this Piece. Use the shared commerce contracts and a server integration for those responsibilities.

Customization and composition

Replace individual slots, provide custom steps, omit irrelevant address sections, or render a provider-specific client widget in payment. Keep validation, routing, data loading, and order orchestration in the application.

TypeScript example

Derive wrapper props from the public component rather than duplicating its contract:

import type { ComponentProps } from "react";
import { CheckoutSection } from "@puzzle-ui/pieces";

type CheckoutProps = ComponentProps<typeof CheckoutSection>;

export const BrandedCheckout = (props: CheckoutProps) => (
  <CheckoutSection {...props} className="brand-checkout" />
);

Framework integration

The Piece is router-independent and can be rendered by any React application. See Pieces framework integration for Next.js, TanStack Start, and SSR boundary guidance.