Order Form 1
Two-column direct-response checkout: contact and payment left, summary and reassurance right.
Use it in a prompt
Use checkout/order-form from the FunnelDNA library. Follow the skill and theme contract. Ask me for the copy, images, and brand details you need; do not invent proof.
Paste into Claude or ChatGPT with FunnelDNA connected (MCP setup), or alongside the skill.
Use it in code
- Save
component.tsx(Code tab) ascomponents/funneldna/checkout/order-form.tsx. - Import it and pass your copy and images (Props tab):
import { OrderForm } from "@/components/funneldna/checkout/order-form"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/checkout/order-form/component.tsx 612 lines
// Collects contact and payment details in two persistent steps with the price always visible.
"use client"
import * as React from "react"
import { Check, Lock } from "lucide-react"
import { BelcherButton, type BelcherVariant } from "../offer/belcher-button"
import { TrustBadges1 } from "./trust-badges-1"
export type OrderFormProps = {
/** Supporting copy; templates replace {count}, {items}, {amount} and {value} as text. */
copy?: Partial<OrderFormCopy>
/** Optional reassurance records; defaults remain those of TrustBadges1. */
trustBadges?: React.ComponentProps<typeof TrustBadges1>['items']
/** Labels owned by the shared checkout button. */
buttonCopy?: Pick<React.ComponentProps<typeof BelcherButton>, 'loadingLabel' | 'secureLabel' | 'paymentsLabel' | 'paymentLabels'>
title?: string
/** A phrase inside `title` to mark with a highlighter swipe. */
highlight?: string
/** Short pre-headline above the title. */
eyebrow?: string
/** One clear line under the title. */
subtitle?: string
/** First person, with the price on an order page: "Complete My Order For $97". */
ctaLabel?: string
/** Second line on the buy button, e.g. "Charged once. Access in 60 seconds." */
ctaSublabel?: string
ctaNote?: string
/** Right column: your own summary. Overrides `order`. */
summary?: React.ReactNode
/** Data for the built-in order summary. */
order?: OrderSummaryData
/** Renders directly above the buy button: pass <OrderBump />. */
bump?: React.ReactNode
/** Replaces the placeholder card inputs with your PSP's element. */
paymentFields?: React.ReactNode
twoStep?: boolean
stepLabels?: [string, string]
/** The step-1 advance button. */
nextLabel?: string
backLabel?: string
/** Buy-button colour. Monochrome unless the page opts in. */
variant?: BelcherVariant
/** Card marks under the buy button. On by default because this is a real checkout. */
showPaymentMarks?: boolean
/** Fires once step 1 validates: send the lead to your CRM here. */
onContactSubmit?: (values: Record<string, string>) => void
onSubmit?: (values: Record<string, string>) => void | Promise<void>
className?: string
}
export function OrderForm({
copy: copyOverrides,
trustBadges,
buttonCopy,
title = "Complete Your Order",
highlight,
eyebrow,
subtitle,
ctaLabel = "Complete My Order",
ctaSublabel,
ctaNote,
summary,
order,
bump,
paymentFields,
/** Single-step for cart / upsell checkouts where the lead is already captured. */
twoStep = true,
stepLabels = ["Your Info", "Billing"],
nextLabel = "Go To Step #2",
backLabel = "Back to your info",
variant = "mono",
showPaymentMarks = true,
onContactSubmit,
onSubmit,
className,
}: OrderFormProps) {
const copy = { ...ORDER_COPY, ...Object.fromEntries(Object.entries(copyOverrides ?? {}).filter(([, value]) => value !== undefined)) }
const frame = React.useRef<number | undefined>(undefined)
const alive = React.useRef(true)
React.useEffect(() => {
alive.current = true
return () => { alive.current = false; if (frame.current !== undefined) cancelAnimationFrame(frame.current) }
}, [])
const [step, setStep] = React.useState(0)
const [pending, setPending] = React.useState(false)
const contactRef = React.useRef<HTMLFieldSetElement>(null)
const tabRefs = React.useRef<Array<HTMLButtonElement | null>>([])
const id = React.useId()
const onContactStep = twoStep && step === 0
const onPaymentStep = !twoStep || step === 1
const side = summary ?? (order ? <OrderSummaryCard order={order} copy={copy} /> : null)
function advance(focusTab = false) {
const contact = contactRef.current
if (!contact) return
for (const input of contact.querySelectorAll("input")) {
if (!input.reportValidity()) return
}
const values: Record<string, string> = {}
for (const input of contact.querySelectorAll("input")) {
if (input.name) values[input.name] = input.value
}
onContactSubmit?.(values)
setStep(1)
if (focusTab) frame.current = requestAnimationFrame(() => tabRefs.current[1]?.focus())
}
function back(focusTab = false) {
setStep(0)
if (focusTab) frame.current = requestAnimationFrame(() => tabRefs.current[0]?.focus())
}
const focusRing =
"focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
return (
<div className={cn("cf-order-form", className)}>
<section className="of-root border-b">
<style>{CSS}</style>
<div className="mx-auto max-w-5xl px-4 py-12 sm:py-16">
<header className="mb-9 sm:mb-12">
{eyebrow && <p className="of-eyebrow">{eyebrow}</p>}
<h2 className="of-title">{renderTitle(title, highlight)}</h2>
{subtitle && <p className="of-sub">{subtitle}</p>}
</header>
<form
className="grid gap-8 lg:grid-cols-[1.4fr_1fr] lg:items-start"
onSubmit={async (e) => {
e.preventDefault()
const data = Object.fromEntries(
new FormData(e.currentTarget).entries()
) as Record<string, string>
setPending(true)
try {
await onSubmit?.(data)
} finally {
if (alive.current) setPending(false)
}
}}
>
<div className="rounded-lg border bg-[var(--surface)] text-[var(--ink)] of-card">
<div className="p-6 grid gap-6 pt-6">
{twoStep && (
<div
className="of-tabs"
role="tablist"
aria-label={copy.steps}
onKeyDown={(e) => {
if (e.key === "ArrowRight" && step === 0) {
e.preventDefault()
advance(true)
} else if (e.key === "ArrowLeft" && step === 1) {
e.preventDefault()
back(true)
}
}}
>
{stepLabels.map((label, i) => {
const active = step === i
const done = i < step
return (
<button
key={label}
ref={(el) => {
tabRefs.current[i] = el
}}
type="button"
role="tab"
className="of-tab"
id={`${id}-tab-${i}`}
aria-selected={active}
aria-controls={`${id}-panel-${i}`}
data-done={done ? "true" : undefined}
tabIndex={active ? 0 : -1}
// Forward only via validation; back is free.
onClick={() => {
if (i === 0) back()
else if (step === 0) advance()
}}
>
<span className="of-tab-num" aria-hidden>
{done ? <Check size={15} strokeWidth={3.5} /> : i + 1}
</span>
<span className="of-tab-label">{label}</span>
</button>
)
})}
</div>
)}
{/* Both fieldsets stay mounted so values persist across steps
and land in the same FormData on submit. */}
<fieldset
ref={contactRef}
id={`${id}-panel-0`}
role={twoStep ? "tabpanel" : undefined}
aria-labelledby={twoStep ? `${id}-tab-0` : undefined}
className={cn("grid gap-4", twoStep && step !== 0 && "hidden")}
>
{/* With tabs the tab is the visible legend; without, show it. */}
<legend
className={cn(
"mb-3 text-sm font-bold uppercase tracking-widest",
twoStep && "sr-only"
)}
>
{copy.contact}
</legend>
<div className="grid gap-4 sm:grid-cols-2">
<div className="grid gap-2">
<label className="block font-medium" htmlFor={`${id}-firstName`}>{copy.firstName}</label>
<input
id={`${id}-firstName`}
name="firstName"
placeholder={copy.firstNamePlaceholder}
autoComplete="given-name"
className="w-full min-w-0 rounded border bg-[var(--surface)] px-3 py-3 text-[var(--ink)] h-12 of-input"
required
/>
</div>
<div className="grid gap-2">
<label className="block font-medium" htmlFor={`${id}-lastName`}>{copy.lastName}</label>
<input
id={`${id}-lastName`}
name="lastName"
placeholder={copy.lastNamePlaceholder}
autoComplete="family-name"
className="w-full min-w-0 rounded border bg-[var(--surface)] px-3 py-3 text-[var(--ink)] h-12 of-input"
required
/>
</div>
</div>
<div className="grid gap-2">
<label className="block font-medium" htmlFor={`${id}-email`}>{copy.email}</label>
<input
id={`${id}-email`}
name="email"
placeholder={copy.emailPlaceholder}
type="email"
autoComplete="email"
className="w-full min-w-0 rounded border bg-[var(--surface)] px-3 py-3 text-[var(--ink)] h-12 of-input"
required
/>
<p className="text-muted-foreground text-sm">
{copy.emailHelp}
</p>
</div>
</fieldset>
{onContactStep && (
<button type="button" className="of-next" onClick={() => advance()}>
<span>{nextLabel}</span>
</button>
)}
<div
id={`${id}-panel-1`}
role={twoStep ? "tabpanel" : undefined}
aria-labelledby={twoStep ? `${id}-tab-1` : undefined}
className={cn("grid gap-6", onContactStep && "hidden")}
>
{!twoStep && <div role="separator" aria-orientation="horizontal" className="my-4 h-px w-full bg-current" />}
<fieldset className="grid gap-4">
<legend className="mb-3 flex items-center gap-2 text-sm font-bold uppercase tracking-widest">
<Lock className="size-3.5" aria-hidden />
{copy.payment}
</legend>
{paymentFields ?? (
<>
<div className="grid gap-2">
<label className="block font-medium" htmlFor={`${id}-card`}>{copy.card}</label>
<input
id={`${id}-card`}
name="card"
inputMode="numeric"
autoComplete="cc-number"
placeholder={copy.cardPlaceholder}
className="w-full min-w-0 rounded border bg-[var(--surface)] px-3 py-3 text-[var(--ink)] h-12 of-input"
required={onPaymentStep}
/>
</div>
<div className="grid grid-cols-2 gap-4">
<div className="grid gap-2">
<label className="block font-medium" htmlFor={`${id}-exp`}>{copy.expiry}</label>
<input
id={`${id}-exp`}
name="exp"
autoComplete="cc-exp"
placeholder={copy.expiryPlaceholder}
className="w-full min-w-0 rounded border bg-[var(--surface)] px-3 py-3 text-[var(--ink)] h-12 of-input"
required={onPaymentStep}
/>
</div>
<div className="grid gap-2">
<label className="block font-medium" htmlFor={`${id}-cvc`}>{copy.cvc}</label>
<input
id={`${id}-cvc`}
name="cvc"
autoComplete="cc-csc"
inputMode="numeric"
placeholder={copy.cvcPlaceholder}
className="w-full min-w-0 rounded border bg-[var(--surface)] px-3 py-3 text-[var(--ink)] h-12 of-input"
required={onPaymentStep}
/>
</div>
</div>
</>
)}
</fieldset>
{/* The bump sits directly above the buy button: peak intent. */}
{bump && (
<>
<div role="separator" aria-orientation="horizontal" className="my-4 h-px w-full bg-current" />
{bump}
</>
)}
<BelcherButton
{...buttonCopy}
bare
label={ctaLabel}
sublabel={ctaSublabel}
variant={variant}
pending={pending}
showPaymentMarks={showPaymentMarks}
finePrint={ctaNote}
/>
{twoStep && (
<button
type="button"
onClick={() => back()}
className={cn(
"of-back -mt-2 inline-flex min-h-11 items-center justify-center gap-1 justify-self-center rounded-sm px-2 text-sm underline",
focusRing
)}
>
{backLabel}
</button>
)}
</div>
{ctaNote && onContactStep && (
<p className="text-muted-foreground -mt-1 text-center text-sm">{ctaNote}</p>
)}
<TrustBadges1 items={trustBadges} />
</div>
</div>
{/* The price leads on a phone: summary first, then the form. */}
{side && <div className="order-first lg:order-none lg:sticky lg:top-6">{side}</div>}
</form>
</div>
</section>
</div>
)
}
const CSS = `
.cf-order-form{background:var(--surface,#ffffff);color:var(--ink,#18181b)}
:where(.cf-order-form) .of-eyebrow{display:flex;align-items:center;justify-content:center;gap:.75rem;margin:0 0 .875rem;color:var(--muted,#52525b);font-family:var(--font-body,Arial,sans-serif);font-size:14px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;line-height:1.3}
:where(.cf-order-form) .of-eyebrow::before,:where(.cf-order-form) .of-eyebrow::after{content:"";width:28px;height:2px;border-radius:2px;background:currentColor;opacity:.55;flex:none}
:where(.cf-order-form) .of-title{margin:0 auto;text-align:center;color:var(--ink,#18181b);font-family:var(--font-display);font-size:clamp(2.125rem,1.25rem + 3.4vw,3.5rem);font-weight:var(--display-weight,900);line-height:1.04;letter-spacing:var(--display-tracking,-.025em);text-wrap:balance;text-transform:var(--display-case,none)}
:where(.cf-order-form) .of-mark{padding:0 .1em;-webkit-box-decoration-break:clone;box-decoration-break:clone;background-image:linear-gradient(transparent 60%,oklch(from var(--marker,#fae37c) l c h / 0.28) 60%,oklch(from var(--marker,#fae37c) l c h / 0.28) 94%,transparent 94%)}
:where(.cf-order-form) .of-sub{margin:1.125rem auto 0;max-width:52ch;text-align:center;color:var(--muted,#52525b);font-family:var(--font-body,Arial,sans-serif);font-size:clamp(17px,1rem + .3vw,19px);line-height:1.55;text-wrap:balance}
:where(.cf-order-form) .of-tabs{position:relative;display:grid;grid-template-columns:1fr 1fr;gap:6px;padding:6px;border-radius:calc(var(--radius,16px)*.75);background:color-mix(in oklch,var(--ink,#18181b) 6%,var(--surface,#ffffff));border:1px solid oklch(from var(--ink,#18181b) l c h / 0.12)}
:where(.cf-order-form) .of-tab{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:10px;min-width:0;min-height:56px;padding:0 .875rem;border:0;border-radius:var(--button-radius,var(--radius,calc(var(--radius,16px)*.55)));background:var(--button-2-bg,var(--card));color:var(--button-2-ink,var(--ink));font-family:var(--button-font,var(--font-display));font-size:15px;font-weight:var(--button-weight,800);letter-spacing:.06em;text-transform:var(--button-case,none);line-height:1;cursor:pointer;transition:background .2s ease,color .2s ease,box-shadow .2s ease;border-color:var(--button-2-border,oklch(from var(--ink) l c h / 0.22))}
:where(.cf-order-form) .of-tab:hover{color:var(--ink,#18181b);background:var(--surface,#ffffff)}
:where(.cf-order-form) .of-tab:focus-visible{outline:3px solid oklch(from var(--accent,#0f5fc2) l c h / 0.45);outline-offset:2px}
:where(.cf-order-form) .of-tab[aria-selected="true"]{cursor:default;color:var(--band-ink);background:var(--band);box-shadow:0 3px 6px -1px oklch(from var(--band) calc(l - 0.12) c h / 0.35),inset 0 1px 0 oklch(from var(--band) calc(l - 0.12) c h / 0.35)}
:where(.cf-order-form) .of-tab[aria-selected="true"]::after{content:"";position:absolute;left:50%;top:calc(100% - 1px);width:22px;height:12px;transform:translateX(-50%);background:var(--band,#0f2747);clip-path:polygon(0 0,100% 0,50% 100%);z-index:2;pointer-events:none}
:where(.cf-order-form) .of-tab-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
:where(.cf-order-form) .of-tab-num{display:inline-grid;place-items:center;flex:none;width:26px;height:26px;border-radius:999px;border:2px solid currentColor;font-size:13px;font-weight:800;letter-spacing:0;font-variant-numeric:tabular-nums}
:where(.cf-order-form) .of-tab[aria-selected="true"] .of-tab-num{background:var(--band-ink,#ffffff);border-color:var(--band-ink,#ffffff);color:var(--band,#0f2747)}
:where(.cf-order-form) .of-tab[data-done="true"] .of-tab-num{background:var(--success-soft);border-color:var(--success);color:var(--success)}
:where(.cf-order-form) .of-next{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:12px;width:100%;min-height:62px;padding:.5rem 1rem;border:0;border-radius:var(--button-radius,var(--radius,calc(var(--radius,16px)*.7)));background:linear-gradient(180deg in oklch,var(--button-bg,var(--cta)),var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h)));color:var(--button-ink,var(--cta-ink));text-shadow:var(--button-text-shadow, 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.2) c h / 0.75));font-family:var(--button-font,var(--font-display));font-size:19px;font-weight:var(--button-weight,800);line-height:1.15;letter-spacing:-.005em;text-wrap:balance;cursor:pointer;box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l + 0.12) c h / 0.5),inset 0 -3px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.16) c h),var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)));transition:transform .15s ease,box-shadow .15s ease,filter .15s ease;border-color:var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h));text-transform:var(--button-case,none)}
:where(.cf-order-form) .of-next:hover{transform:translateY(-2px);filter:none;background:oklch(from var(--button-bg,var(--cta)) calc(l - 0.06) c h);box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l + 0.12) c h / 0.5),inset 0 -3px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.16) c h),var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)))}
:where(.cf-order-form) .of-next:active{transform:translateY(4px);filter:none;box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l + 0.12) c h / 0.5),inset 0 -3px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.16) c h),var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)))}
:where(.cf-order-form) .of-next:focus-visible{outline:3px solid oklch(from var(--cta,#27272a) l c h / 0.45);outline-offset:4px}
:where(.cf-order-form) .of-card.of-card{background:var(--card);border-color:var(--card-border,oklch(from var(--ink) l c h / 0.16));border-radius:var(--card-radius,var(--radius,16px));box-shadow:var(--card-shadow, var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)))}
:where(.cf-order-form) .of-input.of-input{background:var(--field,var(--card));color:var(--field-ink,var(--ink));border-color:var(--field-border,oklch(from var(--field-ink,var(--ink)) l c h / 0.42));border-radius:var(--field-radius,var(--radius,8px));font-family:var(--font-body);font-size:inherit;line-height:inherit;letter-spacing:inherit}
:where(.cf-order-form) .of-input::placeholder{color:color-mix(in oklch, var(--field-ink) 65%, var(--field));opacity:1}
:where(.cf-order-form) .os{overflow:hidden;border-radius:var(--card-radius,var(--radius,var(--radius,16px)));background:var(--card);color:var(--ink,#18181b);font-family:var(--font-body,Arial,sans-serif);border:1px solid oklch(from var(--ink,#18181b) l c h / 0.14);box-shadow:var(--card-shadow,var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)));border-color:var(--card-border,oklch(from var(--ink) l c h / 0.16))}
:where(.cf-order-form) .os-head{display:flex;align-items:flex-end;justify-content:space-between;gap:1rem;padding:1.25rem 1.5rem;background:var(--band);color:var(--band-ink,#ffffff)}
:where(.cf-order-form) .os-kicker{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:14px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;line-height:1.2}
:where(.cf-order-form) .os-name{margin:0;font-family:var(--font-display);font-size:clamp(20px,1.1rem + .4vw,23px);font-weight:var(--display-weight,800);line-height:1.2;letter-spacing:var(--display-tracking,-.01em);text-wrap:balance;text-transform:var(--display-case,none)}
:where(.cf-order-form) .os-count{flex:none;padding:.375rem .75rem;border-radius:999px;border:1px solid oklch(from var(--band-ink,#ffffff) l c h / 0.4);font-size:14px;font-weight:700;line-height:1.2;white-space:nowrap}
:where(.cf-order-form) .os-cols{display:flex;justify-content:space-between;align-items:center;gap:1rem;margin:0;padding:.75rem 1.5rem;background:linear-gradient(180deg in oklch,color-mix(in oklch,var(--ink,#18181b) 5%,var(--surface,#ffffff)),color-mix(in oklch,var(--ink,#18181b) 3.5%,var(--surface,#ffffff)));border-bottom:1px solid oklch(from var(--ink,#18181b) l c h / 0.11);box-shadow:inset 0 1px 0 oklch(from var(--card) calc(l - 0.12) c h / 0.35);color:var(--muted,#52525b);font-size:14px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;line-height:1.2}
:where(.cf-order-form) .os-list{list-style:none;margin:0;padding:0 1.5rem}
:where(.cf-order-form) .os-row{display:grid;grid-template-columns:64px minmax(0,1fr) auto;align-items:start;gap:1rem;padding:1.125rem 0;border-bottom:1px dashed oklch(from var(--ink,#18181b) l c h / 0.22)}
:where(.cf-order-form) .os-thumb{position:relative;display:block;align-self:start;width:64px;height:48px;margin:0}
:where(.cf-order-form) .os-thumb img{display:block;width:100%;height:100%;object-fit:contain;object-position:center top;border-radius:4px;filter:drop-shadow(0 2px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.28)) drop-shadow(0 2px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.28))}
:where(.cf-order-form) .os-thumb-fallback{display:grid;place-items:center;width:100%;height:100%;border-radius:10px;background:color-mix(in oklch,var(--ink,#18181b) 6%,var(--surface,#ffffff));box-shadow:inset 0 0 0 1px oklch(from var(--ink,#18181b) l c h / 0.1);color:var(--ink,#18181b)}
:where(.cf-order-form) .os-item{min-width:0}
:where(.cf-order-form) .os-item-name{display:block;font-size:16px;font-weight:700;line-height:1.3}
:where(.cf-order-form) .os-item-detail{display:block;margin-top:.25rem;font-size:14px;line-height:1.45;color:var(--muted,#52525b)}
:where(.cf-order-form) .os-value{font-size:16px;font-weight:700;line-height:1.3;font-variant-numeric:tabular-nums;white-space:nowrap;text-align:right}
:where(.cf-order-form) .os-totalv{display:flex;align-items:center;justify-content:space-between;gap:.75rem;flex-wrap:wrap;margin:0 1.5rem;padding:1rem 0 .25rem;font-size:16px;font-weight:700;line-height:1.3}
:where(.cf-order-form) .os-totalv-right{display:inline-flex;align-items:center;gap:.625rem}
:where(.cf-order-form) .os-strike{color:var(--danger);text-decoration:line-through;text-decoration-thickness:2px;font-variant-numeric:tabular-nums}
:where(.cf-order-form) .os-save{padding:.25rem .75rem;border-radius:999px;background:var(--success-soft);color:var(--success);font-size:14px;font-weight:800;line-height:1.3;white-space:nowrap}
:where(.cf-order-form) .os-today{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin:1rem 1.5rem 0;padding:1rem 1.25rem;border-radius:var(--card-radius,var(--radius,calc(var(--radius,16px)*.7)));border:1px solid oklch(from var(--ink) l c h / 0.10);background:color-mix(in oklch,var(--ink,#18181b) 4%,var(--card,#ffffff));box-shadow:none}
:where(.cf-order-form) .os-today-copy{min-width:0}
:where(.cf-order-form) .os-today-label{display:block;font-size:16px;font-weight:700;line-height:1.3;text-wrap:balance}
:where(.cf-order-form) .os-today-note{display:block;margin-top:.25rem;font-size:14px;line-height:1.4;color:var(--muted,#52525b)}
:where(.cf-order-form) .os-price{flex:none;font-family:var(--font-display,Arial,sans-serif);font-size:clamp(2.25rem,1.9rem + 1vw,2.75rem);font-weight:900;line-height:1;letter-spacing:-.02em;font-variant-numeric:tabular-nums}
:where(.cf-order-form) .os-foot{display:grid;grid-template-columns:52px minmax(0,1fr);align-items:center;gap:.875rem;margin:1rem 1.5rem 0;padding:1rem 0 1.5rem;border-top:1px solid oklch(from var(--ink,#18181b) l c h / 0.12)}
:where(.cf-order-form) .os-seal{display:block;color:var(--success)}
:where(.cf-order-form) .os-foot-title{display:block;font-size:16px;font-weight:800;line-height:1.3}
:where(.cf-order-form) .os-foot-sub{display:block;margin-top:.25rem;font-size:14px;line-height:1.45;color:var(--muted,#52525b)}
@media (max-width:420px){
:where(.cf-order-form) .of-tab{gap:6px;padding-inline:.5rem;letter-spacing:0}
:where(.cf-order-form) .of-tab-label{white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere;line-height:1.2}
:where(.cf-order-form) .os-list,:where(.cf-order-form) .os-totalv,:where(.cf-order-form) .os-today,:where(.cf-order-form) .os-foot{margin-left:1.125rem;margin-right:1.125rem}
:where(.cf-order-form) .os-head{margin:0;padding:1.125rem}
:where(.cf-order-form) .os-cols{padding-left:1.125rem;padding-right:1.125rem}
:where(.cf-order-form) .os-list{padding:0}
:where(.cf-order-form) .os-row{grid-template-columns:52px minmax(0,1fr) auto;gap:.75rem}
:where(.cf-order-form) .os-thumb{width:52px;height:39px}
:where(.cf-order-form) .os-today{padding:.875rem 1rem}
}
@media (prefers-reduced-motion:reduce){
:where(.cf-order-form) .of-tab,:where(.cf-order-form) .of-next{transition:none}
:where(.cf-order-form) .of-next:hover,:where(.cf-order-form) .of-next:active{transform:none}
}
:where(.cf-order-form) .of-root{background:var(--surface);color:var(--ink);font-family:var(--font-body)}
:where(.cf-order-form) .of-input.of-input:focus{outline-color:var(--field-focus,var(--accent));border-color:var(--field-focus,var(--accent));box-shadow:0 0 0 3px oklch(from var(--field-focus,var(--accent)) l c h / 0.2)}
:where(.cf-order-form) .of-root label{color:var(--label-ink,var(--ink))}
:where(.cf-order-form) .of-back{color:var(--link, var(--accent));text-decoration-color:oklch(from var(--link, var(--accent)) l c h / 0.45);text-underline-offset:0.18em;font-family:var(--button-font,var(--font-body));font-weight:var(--button-weight,600)}:where(.cf-order-form) .of-back:hover,:where(.cf-order-form) .of-back:focus-visible{color:oklch(from var(--link, var(--accent)) calc(l - 0.08) c h);text-decoration-color:currentColor}
`
function renderTitle(title: string, highlight?: string) {
if (!highlight) return title
const at = title.indexOf(highlight)
if (at === -1) return title
return (
<>
{title.slice(0, at)}
<span className="of-mark">{highlight}</span>
{title.slice(at + highlight.length)}
</>
)
}
export type OrderSummaryItem = {
name: string
detail?: string
value?: string
itemImage?: string
itemImageAlt?: string
}
export type OrderSummaryData = {
/** Product name in the summary header. */
name: string
/** Short line under today's label, e.g. "One payment · Lifetime access". */
note?: string
items: OrderSummaryItem[]
/** Total value, shown struck through. */
regularPrice?: string
/** Today's price, the biggest number in the summary. */
price: string
todayLabel?: string
/** Shown beside the seal. Only pass a guarantee you actually offer. */
guarantee?: string
/** Line under the guarantee. */
guaranteeNote?: string
}
/** "$97" and "$47" give "$50". Returns null unless both prices parse. */
function savingOf(regular?: string, price?: string) {
if (!regular || !price) return null
const num = (s: string) => Number(s.replace(/[^0-9.]/g, ""))
const r = num(regular)
const p = num(price)
if (!Number.isFinite(r) || !Number.isFinite(p) || r <= p || p <= 0) return null
const prefix = price.match(/^[^0-9]*/)?.[0] ?? ""
const diff = r - p
return `${prefix}${Number.isInteger(diff) ? diff : diff.toFixed(2)}`
}
const SEAL_POINTS = Array.from({ length: 36 }, (_, i) => {
const a = (i / 36) * Math.PI * 2 - Math.PI / 2
const r = i % 2 ? 22 : 24.5
return `${(25 + r * Math.cos(a)).toFixed(2)},${(25 + r * Math.sin(a)).toFixed(2)}`
}).join(" ")
function GuaranteeSeal() {
return (
<svg className="os-seal" viewBox="0 0 50 50" width="52" height="52" aria-hidden>
<polygon points={SEAL_POINTS} fill="currentColor" />
<circle cx="25" cy="25" r="18" fill="currentColor" stroke="var(--surface,#ffffff)" strokeOpacity=".55" strokeWidth="1.25" strokeDasharray="2 2.2" />
<path d="M11 19a15 15 0 0 1 22-9" fill="none" stroke="var(--surface,#ffffff)" strokeOpacity=".22" strokeWidth="2" strokeLinecap="round" />
<path d="M17 25.5l5.5 5.5L33.5 19.5" fill="none" stroke="var(--surface,#ffffff)" strokeWidth="3.4" strokeLinecap="round" strokeLinejoin="round" />
</svg>
)
}
function OrderSummaryCard({ order, copy }: { order: OrderSummaryData; copy: OrderFormCopy }) {
const saving = savingOf(order.regularPrice, order.price)
const count = order.items.length
return (
<aside className="os" aria-label={copy.summary}>
<div className="os-head">
<div style={{ minWidth: 0 }}>
<p className="os-kicker">
<Lock size={14} strokeWidth={2.75} aria-hidden />
{copy.summary}
</p>
<h3 className="os-name">{order.name}</h3>
</div>
{count > 0 && (
<span className="os-count">
{formatCopy(copy.count, { count: String(count), items: count === 1 ? copy.itemSingular : copy.itemPlural })}
</span>
)}
</div>
{count > 0 && (
<>
<div className="os-cols" aria-hidden>
<span>{copy.item}</span>
<span>{copy.value}</span>
</div>
<ul className="os-list">
{order.items.map((item) => (
<li key={item.name} className="os-row">
<span className="os-thumb">
{item.itemImage ? (
<img src={item.itemImage} alt={item.itemImageAlt ?? ""} loading="lazy" decoding="async" />
) : (
<span className="os-thumb-fallback">
<Check size={20} strokeWidth={3} aria-hidden />
</span>
)}
</span>
<span className="os-item">
<span className="os-item-name">{item.name}</span>
{item.detail && <span className="os-item-detail">{item.detail}</span>}
</span>
<span className="os-value">{item.value}</span>
</li>
))}
</ul>
</>
)}
{order.regularPrice && (
<div className="os-totalv">
<span>{copy.totalValue}</span>
<span className="os-totalv-right">
{saving && <span className="os-save">{formatCopy(copy.savings, { amount: saving })}</span>}
<s className="os-strike" aria-label={formatCopy(copy.totalValueLabel, { value: order.regularPrice })}>
{order.regularPrice}
</s>
</span>
</div>
)}
<div className="os-today">
<span className="os-today-copy">
<span className="os-today-label">{order.todayLabel ?? copy.today}</span>
{order.note && <span className="os-today-note">{order.note}</span>}
</span>
<span className="os-price">{order.price}</span>
</div>
{order.guarantee ? (
<div className="os-foot">
<GuaranteeSeal />
<span>
<span className="os-foot-title">{order.guarantee}</span>
{order.guaranteeNote && <span className="os-foot-sub">{order.guaranteeNote}</span>}
</span>
</div>
) : (
<div style={{ height: "1.5rem" }} />
)}
</aside>
)
}
export default OrderForm
const ORDER_COPY = {
summary: 'Order summary', count: '{count} {items}', itemSingular: 'item', itemPlural: 'items', item: 'Item', value: 'Value', totalValue: 'Total value', savings: 'Save {amount}', totalValueLabel: 'Total value {value}', today: 'Your price today',
firstName: 'First name', lastName: 'Last name', email: 'Email', card: 'Card number', expiry: 'Expiry', cvc: 'CVC', steps: 'Order steps', contact: '1. Contact', payment: '2. Payment', emailHelp: 'Your receipt and access details go here.', firstNamePlaceholder: 'Jane', lastNamePlaceholder: 'Smith', emailPlaceholder: 'you@example.com', cardPlaceholder: '1234 1234 1234 1234', expiryPlaceholder: 'MM / YY', cvcPlaceholder: '123',
}
type OrderFormCopy = typeof ORDER_COPY
function formatCopy(template: string, values: Record<string, string>) {
return template.replace(/\{(\w+)\}/g, (match, key: string) => values[key] ?? match)
}
function cn(...values: Array<string | false | null | undefined>) { return values.filter(Boolean).join(' ') }
pieces/checkout/order-form/specimen.tsx 77 lines
"use client"
import * as React from "react"
import { Lock } from "lucide-react"
import { OrderForm } from "../order-form"
import { slot } from "../../slots"
import defaults from "../../studio-defaults.json"
const sample = defaults.sample
/** Stands in for the payment provider's secure fields, so the preview never collects card details. */
function PaymentPreview() {
return (
<div style={{ display: "grid", gap: "0.75rem" }}>
<div
style={{
display: "grid",
gridTemplateColumns: "20px 1fr",
gap: "0.75rem",
alignItems: "start",
padding: "1rem 1.125rem",
borderRadius: "calc(var(--radius, 16px) * 0.6)",
border: "2px dashed var(--card-border,color-mix(in oklch,var(--ink) 25%,transparent))",
color: "var(--ink, #18181b)",
}}
>
<Lock aria-hidden size={20} style={{ marginTop: 2 }} />
<span>
<span style={{ display: "block", fontSize: "16px", fontWeight: 700, lineHeight: 1.35 }}>
Secure card payment
</span>
<span
style={{
display: "block",
marginTop: "0.375rem",
fontSize: "14px",
lineHeight: 1.5,
color: "var(--muted, #52525b)",
}}
>
{sample.sublabel}
</span>
</span>
</div>
</div>
)
}
export default function OrderFormSpecimen(_props: { state?: string }) {
return (
<>
<OrderForm
eyebrow={sample.eyebrow}
title={`Get ${sample.name}`}
highlight={sample.name}
subtitle={sample.lead}
ctaLabel={sample.label}
ctaSublabel={sample.sublabel}
ctaNote={sample.guarantee}
order={{
name: sample.name,
note: sample.note,
items: sample.items.map(({image,imageAlt,...item},i)=>({...item,itemImage:slot(`item-${i+1}`,image),itemImageAlt:imageAlt})),
regularPrice: sample.regularPrice,
price: sample.price,
todayLabel: sample.todayLabel,
guarantee: sample.guarantee,
guaranteeNote: sample.reason,
}}
paymentFields={<PaymentPreview />}
/>
</>
)
}
export const states = ["default"]
| Name | Type | Details |
|---|---|---|
copy OptionalOrderForm |
Partial<OrderFormCopy> |
|
trustBadges OptionalOrderForm |
React.ComponentProps<typeof TrustBadges1>['items'] |
|
buttonCopy OptionalOrderForm |
Pick<React.ComponentProps<typeof BelcherButton>, 'loadingLabel' | 'secureLabel' | 'paymentsLabel' | 'paymentLabels'> |
|
title OptionalOrderForm |
string |
Default "Complete Your Order"
|
highlight OptionalOrderForm |
string |
|
eyebrow OptionalOrderForm |
string |
|
subtitle OptionalOrderForm |
string |
|
ctaLabel OptionalOrderForm |
string |
Default "Complete My Order"
|
ctaSublabel OptionalOrderForm |
string |
|
ctaNote OptionalOrderForm |
string |
|
summary OptionalOrderForm |
React.ReactNode |
|
order OptionalOrderForm |
OrderSummaryData |
|
bump OptionalOrderForm |
React.ReactNode |
|
paymentFields OptionalOrderForm |
React.ReactNode |
|
twoStep OptionalOrderForm |
boolean |
Default true
|
stepLabels OptionalOrderForm |
[string, string] |
Default ["Your Info", "Billing"]
|
nextLabel OptionalOrderForm |
string |
Default "Go To Step #2"
|
backLabel OptionalOrderForm |
string |
Default "Back to your info"
|
variant OptionalOrderForm |
BelcherVariant |
Default "mono"
|
showPaymentMarks OptionalOrderForm |
boolean |
Default true
|
onContactSubmit OptionalOrderForm |
(values: Record<string, string>) => void |
|
onSubmit OptionalOrderForm |
(values: Record<string, string>) => void | Promise<void> |
|
className OptionalOrderForm |
string |
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-bg--button-2-border--button-2-ink- Secondary button.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field--field-border--field-focus--field-ink--field-radius- Form inputs: background, ink, border, radius and focus colour.
--marker- The highlighter colour behind key phrases.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
item-*- One image per offer item (item-1, item-2…), shown in stacks and lists.
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB