Product Buy Box 6
Walks the shopper down an oversized numbered rail (choose, quantity, price) so Add To Cart is the obvious last step beside the product viewer.
Use it in a prompt
Use offer/product-buy-box-6 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/offer/product-buy-box-6.tsx. - Import it and pass your copy and images (Props tab):
import { ProductBuyBox6 } from "@/components/funneldna/offer/product-buy-box-6"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/product-buy-box-6/component.tsx 743 lines
// layout: number-rail
// Walks the shopper down an oversized numbered rail (choose, quantity, price) so Add To Cart is the obvious last step beside the product viewer.
"use client"
import * as React from "react"
import {
AlertCircle,
Check,
ChevronDown,
Download,
Lock,
Minus,
Plus,
RotateCcw,
ShieldCheck,
ShoppingCart,
Truck,
} from "lucide-react"
export type BuyBoxOption = {
value: string
/** Visible chip text (defaults to value). */
label?: string
/** Optional colour sample for colour variants (the product's real colour, not a theme colour). */
swatch?: string
/** Shown struck and not selectable. */
disabled?: boolean
}
export type BuyBoxVariantGroup = {
name: string
label: string
options: BuyBoxOption[]
defaultValue?: string
}
export type BuyBoxAssurance = {
icon?: "shipping" | "download" | "returns" | "guarantee" | "secure"
title: string
detail?: string
}
export type BuyBoxDetailItem = { name: string; detail?: string; image?: string; imageAlt?: string }
export type BuyBoxDetail = {
id: string
title: string
/** Free text or rich content. */
body?: React.ReactNode
/** Ticked list (e.g. how to use). */
points?: string[]
/** Thumbnail list (e.g. what is included). Images fill the item-1 … item-n slots. */
items?: BuyBoxDetailItem[]
defaultOpen?: boolean
}
export type ProductBuyBox6State = "default" | "hover" | "active" | "disabled" | "error"
export type ProductBuyBox6Copy = {
/** {label} is the variant group label. */
missingOption: string
/** {saving} */
couponOff: string
/** {percent} and {compareAt} */
couponDetail: string
/** {compareAt}, used only when the compare-at price cannot be read as a number. */
regular: string
/** {quantity}, {price} and {total} */
subtotal: string
/** {count} (a word from countWords) and {price} */
reasonsTitle: string
/** {price} */
reasonsTitleOne: string
countWords: string[]
quantityLabel: string
decrease: string
increase: string
done: string
unavailable: string
disabledNote: string
errorText: string
}
export type ProductBuyBox6Props = {
/** Product name, the headline of the buy box. */
name: string
/** One short benefit line under the name. */
benefit?: string
price: string
/** Compare-at price. The coupon with the saving shows only when this is supplied and higher than the price. */
compareAt?: string
todayLabel?: string
priceNote?: string
variants?: BuyBoxVariantGroup[]
quantity?: { min?: number; max?: number; initial?: number; hint?: string }
showQuantity?: boolean
/** Rail step headings. The price step defaults to the reasons headline when reasons are given. */
stepTitles?: { choose?: string; quantity?: string; buy?: string }
/** Short numbered reasons that justify today's price (supplied facts only). */
reasons?: string[]
label?: string
sublabel?: string
assurances?: BuyBoxAssurance[]
details?: BuyBoxDetail[]
/** Guarantee seal image (seal-guarantee slot, transparent background). */
sealGuaranteeImage?: string
sealAlt?: string
disabled?: boolean
state?: ProductBuyBox6State
copy?: Partial<ProductBuyBox6Copy>
/** Called with the validated order. */
onSubmit?: (order: { quantity: number; options: Record<string, string> }) => void
/** Called on a valid submit when there is no onSubmit. */
onAction?: () => void
/** Where a valid submit goes when there is no onSubmit or onAction. */
href?: string
className?: string
}
const DEFAULT_COPY: ProductBuyBox6Copy = {
missingOption: "Choose your {label} to continue.",
couponOff: "{saving} off",
couponDetail: "That’s {percent}% off the regular {compareAt} price.",
regular: "Regular price {compareAt}",
subtotal: "{quantity} × {price} = {total}",
reasonsTitle: "{count} reasons this is {price} today",
reasonsTitleOne: "Why this is {price} today",
countWords: ["One", "Two", "Three", "Four", "Five", "Six", "Seven"],
quantityLabel: "Quantity",
decrease: "Decrease quantity",
increase: "Increase quantity",
done: "Done",
unavailable: "Unavailable",
disabledNote: "This product isn’t available right now.",
errorText: "We couldn’t add this to your cart. Please try again.",
}
const DEFAULT_STEPS = { choose: "Choose your option", quantity: "Choose your quantity", buy: "Add it to your cart" }
const ASSURANCE_ICONS = { shipping: Truck, download: Download, returns: RotateCcw, guarantee: ShieldCheck, secure: Lock }
type StepKey = "choose" | "quantity" | "buy"
export function ProductBuyBox6({
name,
benefit,
price,
compareAt,
todayLabel = "Today’s price",
priceNote,
variants = [],
quantity,
showQuantity = true,
stepTitles,
reasons = [],
label = "Add To Cart",
sublabel,
assurances = [],
details = [],
sealGuaranteeImage,
sealAlt = "",
disabled = false,
state = "default",
copy,
onSubmit,
onAction,
href,
className = "",
}: ProductBuyBox6Props) {
const text = { ...DEFAULT_COPY, ...copy }
const titles = { ...DEFAULT_STEPS, ...stepTitles }
const uid = React.useId().replace(/[^a-zA-Z0-9_-]/g, "")
const formRef = React.useRef<HTMLFormElement>(null)
const min = Math.max(1, quantity?.min ?? 1)
const max = Math.max(min, quantity?.max ?? 99)
const startQty = clampNum(quantity?.initial ?? min, min, max)
const initialSelection = (forceMissing: boolean) => {
const sel: Record<string, string | null> = {}
variants.forEach((g, i) => {
sel[g.name] = forceMissing && i === variants.length - 1 ? null : g.defaultValue ?? null
})
return sel
}
const missingMessage = (sel: Record<string, string | null>) => {
const g = variants.find((v) => !sel[v.name])
return g ? fill(text.missingOption, { label: g.label.toLowerCase() }) : null
}
const [selection, setSelection] = React.useState<Record<string, string | null>>(() => initialSelection(state === "error"))
const [qty, setQty] = React.useState(startQty)
const [qtyDraft, setQtyDraft] = React.useState(String(startQty))
const [error, setError] = React.useState<string | null>(() =>
state === "error" ? missingMessage(initialSelection(true)) ?? text.errorText : null
)
const [open, setOpen] = React.useState<string[]>(() =>
details.filter((d, i) => d.defaultOpen ?? i === 0).map((d) => d.id)
)
React.useEffect(() => {
const sel = initialSelection(state === "error")
setSelection(sel)
setQty(startQty)
setQtyDraft(String(startQty))
setError(state === "error" ? missingMessage(sel) ?? text.errorText : null)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [state])
const isDisabled = disabled || state === "disabled"
const forced = state === "hover" || state === "active" ? state : undefined
const missingGroup = variants.find((g) => !selection[g.name])
const allChosen = !missingGroup
const keys: StepKey[] = [
...(variants.length ? (["choose"] as StepKey[]) : []),
...(showQuantity ? (["quantity"] as StepKey[]) : []),
"buy",
]
const done: Record<StepKey, boolean> = { choose: allChosen, quantity: allChosen, buy: false }
const firstPending = keys.findIndex((k) => !done[k])
const unit = parseMoney(price)
const was = parseMoney(compareAt)
const hasSaving = unit != null && was != null && was > unit
const saving = hasSaving ? fmtLike((was as number) - (unit as number), price) : ""
const percent = hasSaving ? Math.round((((was as number) - (unit as number)) / (was as number)) * 100) : 0
const total = unit != null ? fmtLike(unit * qty, price) : price
const showRegular = !!compareAt && (unit == null || was == null)
const countWord = text.countWords[reasons.length - 1] ?? String(reasons.length)
const buyTitle =
stepTitles?.buy ??
(reasons.length > 1
? fill(text.reasonsTitle, { count: countWord, price })
: reasons.length === 1
? fill(text.reasonsTitleOne, { price })
: titles.buy)
function setQuantity(n: number) {
const v = clampNum(n, min, max)
setQty(v)
setQtyDraft(String(v))
}
function commitDraft(): number {
const n = parseInt(qtyDraft, 10)
const v = Number.isFinite(n) ? clampNum(n, min, max) : qty
setQty(v)
setQtyDraft(String(v))
return v
}
function choose(group: string, value: string) {
const next = { ...selection, [group]: value }
setSelection(next)
if (error) setError(missingMessage(next))
}
function toggle(id: string) {
setOpen((cur) => (cur.includes(id) ? cur.filter((x) => x !== id) : [...cur, id]))
}
function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
e.preventDefault()
if (isDisabled) return
const q = commitDraft()
if (missingGroup) {
setError(missingMessage(selection))
formRef.current
?.querySelector<HTMLInputElement>(`input[data-group="${missingGroup.name}"]:not(:disabled)`)
?.focus()
return
}
setError(null)
const order = { quantity: q, options: selection as Record<string, string> }
if (onSubmit) onSubmit(order)
else if (onAction) onAction()
else if (href) window.location.assign(href)
}
const chooseBlock = variants.map((g) => {
const val = selection[g.name]
const invalid = !!error && missingGroup?.name === g.name
const errId = `${uid}-${g.name}-error`
const current = g.options.find((o) => o.value === val)
return (
<fieldset
key={g.name}
className="pbb-group"
data-invalid={invalid ? "" : undefined}
aria-describedby={invalid ? errId : undefined}
disabled={isDisabled}
>
<legend className="pbb-legend">
{g.label}
{current ? <span className="pbb-legend-value">: {current.label ?? current.value}</span> : null}
</legend>
<div className="pbb-chips">
{g.options.map((o) => {
const id = `${uid}-${g.name}-${o.value}`.replace(/[^a-zA-Z0-9_-]/g, "")
const checked = val === o.value
return (
<label key={o.value} className="pbb-chip" htmlFor={id}>
<input
id={id}
type="radio"
name={`${uid}-${g.name}`}
value={o.value}
checked={checked}
disabled={o.disabled}
data-group={g.name}
onChange={() => choose(g.name, o.value)}
/>
<span className="pbb-chip-face">
{o.swatch ? <span className="pbb-swatch" style={{ background: o.swatch }} aria-hidden="true" /> : null}
{o.label ?? o.value}
{o.disabled ? <span className="pbb-sr"> ({text.unavailable})</span> : null}
{checked ? (
<span className="pbb-chip-badge" aria-hidden="true">
<Check size={12} strokeWidth={3} />
</span>
) : null}
</span>
</label>
)
})}
</div>
{invalid ? (
<p className="pbb-error" id={errId} role="alert">
<AlertCircle size={16} strokeWidth={2.5} className="pbb-inline-icon" aria-hidden="true" />
{error}
</p>
) : null}
</fieldset>
)
})
const qtyTitleId = `${uid}-step-quantity`
const quantityBlock = (
<div className="pbb-qty-row">
<div className="pbb-qty" role="group" aria-labelledby={qtyTitleId}>
<button
type="button"
aria-label={text.decrease}
onClick={() => setQuantity(qty - 1)}
disabled={isDisabled || qty <= min}
>
<Minus size={18} strokeWidth={2.5} aria-hidden="true" />
</button>
<input
id={`${uid}-qty`}
aria-label={text.quantityLabel}
inputMode="numeric"
pattern="[0-9]*"
placeholder={String(min)}
value={qtyDraft}
disabled={isDisabled}
onChange={(e) => {
const v = e.target.value.replace(/[^0-9]/g, "").slice(0, 3)
setQtyDraft(v)
const n = parseInt(v, 10)
if (Number.isFinite(n) && n >= min && n <= max) setQty(n)
}}
onBlur={commitDraft}
/>
<button
type="button"
aria-label={text.increase}
onClick={() => setQuantity(qty + 1)}
disabled={isDisabled || qty >= max}
>
<Plus size={18} strokeWidth={2.5} aria-hidden="true" />
</button>
</div>
{quantity?.hint ? <p className="pbb-hint">{quantity.hint}</p> : null}
</div>
)
const subText = isDisabled ? text.disabledNote : sublabel
const SubIcon = isDisabled ? AlertCircle : Lock
const buyBlock = (
<>
{reasons.length ? (
<ol className="pbb-reasons">
{reasons.map((r, i) => (
<li key={i}>
<span className="pbb-reason-n" aria-hidden="true">
{i + 1}
</span>
<span className="pbb-reason-t">{r}</span>
</li>
))}
</ol>
) : null}
<div className="pbb-today">
<div className="pbb-today-text">
{todayLabel ? <p className="pbb-today-label">{todayLabel}</p> : null}
<p className="pbb-price-row">
<span className="pbb-price">{price}</span>
{hasSaving ? (
<span className="pbb-strike">
<span className="pbb-sr">{fill(text.regular, { compareAt: compareAt ?? "" })}</span>
<s aria-hidden="true">{compareAt}</s>
</span>
) : null}
</p>
{hasSaving ? (
<p className="pbb-save">
<span className="pbb-off">{fill(text.couponOff, { saving })}</span>
<span className="pbb-was">{fill(text.couponDetail, { percent, compareAt: compareAt ?? "" })}</span>
</p>
) : null}
{showRegular ? <p className="pbb-note">{fill(text.regular, { compareAt: compareAt ?? "" })}</p> : null}
{priceNote ? <p className="pbb-note">{priceNote}</p> : null}
<p className="pbb-note pbb-subtotal" aria-live="polite">
{qty > 1 && unit != null ? fill(text.subtotal, { quantity: qty, price, total }) : ""}
</p>
</div>
{sealGuaranteeImage ? (
<img
className="pbb-seal"
src={sealGuaranteeImage}
alt={sealAlt}
width={96}
height={96}
loading="lazy"
decoding="async"
/>
) : null}
</div>
<button type="submit" className="pbb-cta" data-force={forced} disabled={isDisabled}>
<ShoppingCart size={20} strokeWidth={2.5} aria-hidden="true" />
<span className="pbb-cta-label">{label}</span>
<span className="pbb-cta-sep" aria-hidden="true" />
<span className="pbb-cta-total">{total}</span>
</button>
{subText ? (
<p className="pbb-sub">
<SubIcon size={16} strokeWidth={2.5} className="pbb-inline-icon" aria-hidden="true" />
{subText}
</p>
) : null}
{error && !missingGroup ? (
<p className="pbb-error pbb-error-center" role="alert">
<AlertCircle size={16} strokeWidth={2.5} className="pbb-inline-icon" aria-hidden="true" />
{error}
</p>
) : null}
</>
)
return (
<div className={`cf-pbb6 ${className}`.trim()}>
<style>{CSS}</style>
<header className="pbb-head">
<h2 className="pbb-name" id={`${uid}-name`}>
{name}
</h2>
{benefit ? <p className="pbb-benefit">{benefit}</p> : null}
</header>
<form ref={formRef} className="pbb-form" aria-labelledby={`${uid}-name`} onSubmit={handleSubmit} noValidate>
<ol className="pbb-steps">
{keys.map((key, i) => {
const isDone = done[key]
const reached = firstPending === -1 || i <= firstPending
return (
<li
key={key}
className="pbb-step"
data-done={isDone ? "" : undefined}
data-reached={reached ? "" : undefined}
style={{ animationDelay: `${Math.min(i * 0.07, 0.28)}s` }}
>
<div className="pbb-mark" aria-hidden="true">
<span className="pbb-num">{i + 1}</span>
{i < keys.length - 1 ? <span className="pbb-line" /> : null}
</div>
<div className="pbb-body">
<h3 className="pbb-step-title" id={`${uid}-step-${key}`}>
{key === "buy" ? buyTitle : titles[key]}
{isDone ? (
<span className="pbb-tick">
<Check size={14} strokeWidth={3} aria-hidden="true" />
<span className="pbb-sr">{text.done}</span>
</span>
) : null}
</h3>
{key === "choose" ? chooseBlock : null}
{key === "quantity" ? quantityBlock : null}
{key === "buy" ? buyBlock : null}
</div>
</li>
)
})}
</ol>
</form>
{assurances.length ? (
<ul className="pbb-assure">
{assurances.map((a, i) => {
const Icon = ASSURANCE_ICONS[a.icon ?? "guarantee"]
return (
<li key={i}>
<Icon size={20} strokeWidth={2.5} className="pbb-assure-icon" aria-hidden="true" />
<p>
<strong>{a.title}</strong>
{a.detail ? <span className="pbb-assure-detail">{a.detail}</span> : null}
</p>
</li>
)
})}
</ul>
) : null}
{details.length ? (
<div className="pbb-details">
{details.map((d) => {
const isOpen = open.includes(d.id)
const safe = d.id.replace(/[^a-zA-Z0-9_-]/g, "")
const pid = `${uid}-panel-${safe}`
const bid = `${uid}-btn-${safe}`
return (
<div key={d.id} className="pbb-detail" data-open={isOpen ? "" : undefined}>
<h3 className="pbb-detail-h">
<button
type="button"
id={bid}
className="pbb-detail-btn"
aria-expanded={isOpen}
aria-controls={pid}
onClick={() => toggle(d.id)}
>
<span>{d.title}</span>
<span className="pbb-chev" aria-hidden="true">
<ChevronDown size={18} strokeWidth={2.5} />
</span>
</button>
</h3>
<div className="pbb-panel" id={pid} role="region" aria-labelledby={bid}>
<div className="pbb-panel-inner">
<div className="pbb-panel-pad">
{d.items?.length ? (
<ul className="pbb-items">
{d.items.map((it, i) => (
<li key={i} data-noimg={it.image ? undefined : ""}>
{it.image ? (
<img
className="pbb-thumb"
src={it.image}
alt={it.imageAlt ?? it.name}
width={56}
height={56}
loading="lazy"
decoding="async"
/>
) : null}
<p>
<strong>{it.name}</strong>
{it.detail ? <span>{it.detail}</span> : null}
</p>
</li>
))}
</ul>
) : null}
{d.points?.length ? (
<ul className="pbb-points">
{d.points.map((p, i) => (
<li key={i}>
<Check size={18} strokeWidth={2.5} aria-hidden="true" />
<span>{p}</span>
</li>
))}
</ul>
) : null}
{d.body ? <div className="pbb-prose">{d.body}</div> : null}
</div>
</div>
</div>
</div>
)
})}
</div>
) : null}
</div>
)
}
export default ProductBuyBox6
function fill(template: string, values: Record<string, string | number>) {
return Object.keys(values).reduce((s, k) => s.split("{" + k + "}").join(String(values[k])), template)
}
function clampNum(n: number, lo: number, hi: number) {
return Math.min(hi, Math.max(lo, Math.round(n)))
}
function parseMoney(v?: string): number | null {
if (!v || !/[0-9]/.test(v)) return null
const n = Number(v.replace(/[^0-9.]/g, ""))
return Number.isFinite(n) ? n : null
}
function fmtLike(n: number, sample: string) {
const m = sample.match(/^([^0-9]*)[0-9.,]+(.*)$/)
const pre = m?.[1] ?? ""
const post = m?.[2] ?? ""
const dec = /[.][0-9]{2}/.test(sample) ? 2 : Number.isInteger(n) ? 0 : 2
return pre + n.toLocaleString("en-US", { minimumFractionDigits: dec, maximumFractionDigits: dec }) + post
}
const CSS = `
.cf-pbb6{--pbb-rail:clamp(44px,6vw,80px);--pbb-gap:clamp(12px,2vw,24px);--pbb-hair:oklch(from var(--ink) l c h / .14);--pbb-ring:oklch(from var(--field-focus,var(--accent)) l c h / .45);width:100%;max-width:38rem;min-width:0;color:var(--ink);font-family:var(--font-body);font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5}
.cf-pbb6 *,.cf-pbb6 *::before,.cf-pbb6 *::after{box-sizing:border-box}
.cf-pbb6 p,.cf-pbb6 h2,.cf-pbb6 h3,.cf-pbb6 ol,.cf-pbb6 ul{margin:0}
.cf-pbb6 .pbb-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.cf-pbb6 .pbb-inline-icon{display:inline-block;vertical-align:-0.15em;margin-inline-end:.4em}
.cf-pbb6 .pbb-name{font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;color:var(--ink);text-wrap:balance;overflow-wrap:anywhere}
.cf-pbb6 .pbb-benefit{margin-top:16px;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
.cf-pbb6 .pbb-form{margin-top:clamp(28px,3.5vw,40px)}
.cf-pbb6 .pbb-steps{list-style:none;padding:0}
.cf-pbb6 .pbb-step{display:grid;grid-template-columns:var(--pbb-rail) minmax(0,1fr);column-gap:var(--pbb-gap);animation:pbb-rise .45s cubic-bezier(.2,.7,.2,1) both}
@keyframes pbb-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
.cf-pbb6 .pbb-mark{display:flex;flex-direction:column;align-items:center;min-width:0}
.cf-pbb6 .pbb-num{display:block;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(2.5rem,4.2vw,3.75rem);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums;color:var(--muted);transition:color .3s ease}
.cf-pbb6 .pbb-step[data-reached] .pbb-num{color:var(--ink)}
.cf-pbb6 .pbb-step[data-done] .pbb-num{color:var(--accent)}
.cf-pbb6 .pbb-line{position:relative;flex:1 1 auto;width:3px;min-height:24px;margin:12px 0;border-radius:999px;background:var(--pbb-hair);overflow:hidden}
.cf-pbb6 .pbb-line::after{content:"";position:absolute;inset:0;border-radius:inherit;background:var(--accent-fill,var(--accent));transform:scaleY(0);transform-origin:top;transition:transform .45s cubic-bezier(.2,.7,.2,1)}
.cf-pbb6 .pbb-step[data-done] .pbb-line::after{transform:scaleY(1)}
.cf-pbb6 .pbb-body{min-width:0;padding:clamp(4px,.6vw,8px) 0 clamp(32px,4vw,48px)}
.cf-pbb6 .pbb-step:last-child .pbb-body{padding-bottom:0}
.cf-pbb6 .pbb-step-title{font-family:var(--font-display);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-0.01em;color:var(--ink);text-wrap:balance}
.cf-pbb6 .pbb-tick{display:inline-grid;place-items:center;width:24px;height:24px;margin-left:10px;vertical-align:-4px;border-radius:50%;background:var(--success);color:var(--success-ink,#fff);animation:pbb-pop .3s cubic-bezier(.2,.7,.2,1) both}
@keyframes pbb-pop{from{transform:scale(.9)}to{transform:none}}
.cf-pbb6 .pbb-group{border:0;margin:16px 0 0;padding:0;min-width:0}
.cf-pbb6 .pbb-group+.pbb-group{margin-top:24px}
.cf-pbb6 .pbb-legend{padding:0;margin-bottom:12px;font-weight:700;line-height:1.3;color:var(--ink)}
.cf-pbb6 .pbb-legend-value{font-weight:500;color:var(--muted)}
.cf-pbb6 .pbb-chips{display:flex;flex-wrap:wrap;gap:12px}
.cf-pbb6 .pbb-chip{position:relative;display:inline-flex;max-width:100%}
.cf-pbb6 .pbb-chip input{position:absolute;width:1px;height:1px;margin:0;opacity:0;pointer-events:none}
.cf-pbb6 .pbb-chip-face{position:relative;display:inline-flex;align-items:center;gap:8px;min-height:48px;max-width:100%;padding:8px 20px;border-radius:999px;background:var(--card);border:1.5px solid oklch(from var(--ink) l c h / .22);color:var(--ink);font-weight:700;line-height:1.2;cursor:pointer;box-shadow:var(--shadow-sm);transition:border-color .16s ease,background .16s ease,transform .16s ease,box-shadow .16s ease}
.cf-pbb6 .pbb-chip:hover .pbb-chip-face{border-color:oklch(from var(--ink) l c h / .5);transform:translateY(-1px);box-shadow:var(--shadow-md)}
.cf-pbb6 .pbb-group[data-invalid] .pbb-chip-face{border-color:var(--danger)}
.cf-pbb6 .pbb-chip input:checked+.pbb-chip-face{background:color-mix(in oklch,var(--accent) 10%,var(--card));border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}
.cf-pbb6 .pbb-chip input:focus-visible+.pbb-chip-face{outline:3px solid var(--pbb-ring);outline-offset:3px}
.cf-pbb6 .pbb-chip input:disabled+.pbb-chip-face{cursor:not-allowed;color:var(--muted);background:color-mix(in oklch,var(--ink) 4%,var(--card));border-color:oklch(from var(--ink) l c h / .12);box-shadow:none;transform:none;text-decoration:line-through}
.cf-pbb6 .pbb-chip-badge{position:absolute;top:-7px;right:-7px;display:grid;place-items:center;width:20px;height:20px;border-radius:50%;background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card));box-shadow:var(--shadow-sm);text-decoration:none;animation:pbb-pop .3s cubic-bezier(.2,.7,.2,1) both}
.cf-pbb6 .pbb-swatch{flex:none;width:20px;height:20px;border-radius:50%;box-shadow:inset 0 0 0 1px oklch(from var(--ink) l c h / .22)}
.cf-pbb6 .pbb-error{margin-top:12px;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--danger);text-wrap:pretty}
.cf-pbb6 .pbb-error-center{text-align:center}
.cf-pbb6 .pbb-qty-row{display:flex;flex-wrap:wrap;align-items:center;gap:12px 16px;margin-top:16px}
.cf-pbb6 .pbb-qty{display:inline-grid;grid-template-columns:52px 64px 52px;height:56px;flex:none;border-radius:var(--field-radius,var(--radius,12px));border:1px solid var(--field-border,color-mix(in oklch,var(--ink) 22%,transparent));background:var(--field);overflow:hidden;box-shadow:var(--shadow-sm)}
.cf-pbb6 .pbb-qty button{display:grid;place-items:center;padding:0;border:0;background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));cursor:pointer;transition:background .16s ease}
.cf-pbb6 .pbb-qty button:hover:not(:disabled){background:oklch(from var(--button-2-bg,var(--secondary)) calc(l - .04) c h)}
.cf-pbb6 .pbb-qty button:active:not(:disabled){background:oklch(from var(--button-2-bg,var(--secondary)) calc(l - .08) c h)}
.cf-pbb6 .pbb-qty button:disabled{cursor:not-allowed;color:oklch(from var(--button-2-ink,var(--secondary-ink)) l c h / .4)}
.cf-pbb6 .pbb-qty button:focus-visible,.cf-pbb6 .pbb-qty input:focus-visible{outline:3px solid var(--pbb-ring);outline-offset:-3px}
.cf-pbb6 .pbb-qty input{width:100%;min-width:0;padding:0;border:0;border-inline:1px solid var(--field-border,color-mix(in oklch,var(--ink) 22%,transparent));background:var(--field);color:var(--field-ink);font-family:var(--font-body);font-size:1.0625rem;font-weight:800;text-align:center;font-variant-numeric:tabular-nums}
.cf-pbb6 .pbb-qty input::placeholder{color:color-mix(in oklch,var(--field-ink) 65%,var(--field));opacity:1}
.cf-pbb6 .pbb-qty input:disabled{cursor:not-allowed}
.cf-pbb6 .pbb-hint{flex:1 1 12rem;font-size:.9375rem;font-weight:500;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-pbb6 .pbb-reasons{list-style:none;padding:0;margin-top:16px;display:grid;gap:12px;color:var(--ink)}
.cf-pbb6 .pbb-reasons li{display:grid;grid-template-columns:1.25em minmax(0,1fr);gap:12px;align-items:baseline}
.cf-pbb6 .pbb-reason-n{font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1;color:var(--accent);font-variant-numeric:tabular-nums;text-align:center}
.cf-pbb6 .pbb-reason-t{text-wrap:pretty;hyphens:manual}
.cf-pbb6 .pbb-today{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:clamp(28px,3.5vw,36px);padding-top:4px}
.cf-pbb6 .pbb-today-text{min-width:0}
.cf-pbb6 .pbb-today-label{font-weight:700;line-height:1.3;color:var(--ink)}
.cf-pbb6 .pbb-price-row{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 14px}
.cf-pbb6 .pbb-today-label+.pbb-price-row{margin-top:12px}
.cf-pbb6 .pbb-price{display:block;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(2.5rem,4.2vw,3.75rem);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums;color:var(--ink)}
.cf-pbb6 .pbb-strike s{font-family:var(--font-display);font-weight:700;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-0.01em;font-variant-numeric:tabular-nums;color:var(--muted);text-decoration:line-through;text-decoration-color:var(--danger);text-decoration-thickness:2px}
.cf-pbb6 .pbb-save{margin-top:12px;font-size:.9375rem;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-pbb6 .pbb-off{font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:1.0625rem;color:var(--success);font-variant-numeric:tabular-nums;white-space:nowrap;margin-inline-end:.5em}
.cf-pbb6 .pbb-was{font-weight:600}
.cf-pbb6 .pbb-note{margin-top:12px;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-pbb6 .pbb-note+.pbb-note,.cf-pbb6 .pbb-save+.pbb-note{margin-top:4px}
.cf-pbb6 .pbb-subtotal{color:var(--ink);font-variant-numeric:tabular-nums}
.cf-pbb6 .pbb-subtotal:empty{display:none}
.cf-pbb6 .pbb-seal{flex:none;width:clamp(72px,8vw,96px);height:auto;aspect-ratio:1;object-fit:contain;border-radius:0;filter:drop-shadow(0 2px 3px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .3)) drop-shadow(0 10px 12px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .18))}
.cf-pbb6 .pbb-cta{--pbb-bg:var(--button-bg,var(--cta));--pbb-bg2:var(--button-bg-2,var(--cta-2));--pbb-sh:var(--shadow,oklch(0.22 0.03 260));display:flex;align-items:center;justify-content:center;gap:12px;width:100%;min-height:72px;margin-top:24px;padding:12px 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:clamp(1.125rem,1.55vw,1.375rem);line-height:1.15;color:var(--button-ink,var(--cta-ink));text-shadow:var(--button-text-shadow,none);background:linear-gradient(oklch(from var(--pbb-bg) calc(l + .04) c h),oklch(from var(--pbb-bg2) calc(l - .02) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--pbb-bg) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--pbb-bg) calc(l - .16) c h),0 1px 2px oklch(from var(--pbb-sh) l c h / .3),0 8px 16px -6px oklch(from var(--pbb-sh) l c h / .42));cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease;-webkit-tap-highlight-color:transparent}
.cf-pbb6 .pbb-cta:not(:disabled):hover,.cf-pbb6 .pbb-cta[data-force="hover"]{background:linear-gradient(oklch(from var(--pbb-bg) calc(l - .01) c h),oklch(from var(--pbb-bg2) calc(l - .07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--pbb-bg) calc(l + .12) c h / .7),inset 0 -3px 0 oklch(from var(--pbb-bg) calc(l - .18) c h),0 1px 2px oklch(from var(--pbb-sh) l c h / .34),0 12px 20px -6px oklch(from var(--pbb-sh) l c h / .48));transform:translateY(-1px)}
.cf-pbb6 .pbb-cta:not(:disabled):active,.cf-pbb6 .pbb-cta[data-force="active"]{background:linear-gradient(oklch(from var(--pbb-bg) calc(l - .05) c h),oklch(from var(--pbb-bg2) calc(l - .08) c h));box-shadow:inset 0 2px 4px oklch(from var(--pbb-bg) calc(l - .22) c h / .55),inset 0 -2px 0 oklch(from var(--pbb-bg) calc(l - .16) c h),0 1px 2px oklch(from var(--pbb-sh) l c h / .3);transform:translateY(1px)}
.cf-pbb6 .pbb-cta:focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:3px}
.cf-pbb6 .pbb-cta:disabled{cursor:not-allowed;background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));text-shadow:none;box-shadow:var(--button-2-shadow,var(--shadow-sm));transform:none}
.cf-pbb6 .pbb-cta svg{flex:none}
.cf-pbb6 .pbb-cta-label,.cf-pbb6 .pbb-cta-total{white-space:nowrap}
.cf-pbb6 .pbb-cta-total{font-variant-numeric:tabular-nums}
.cf-pbb6 .pbb-cta-sep{flex:none;width:1px;height:1.2em;background:oklch(from var(--button-ink,var(--cta-ink)) l c h / .45)}
.cf-pbb6 .pbb-cta:disabled .pbb-cta-sep{background:oklch(from var(--button-2-ink,var(--secondary-ink)) l c h / .35)}
.cf-pbb6 .pbb-sub{margin-top:12px;text-align:center;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-pbb6 .pbb-assure{list-style:none;margin-top:clamp(32px,4vw,48px);padding:4px clamp(16px,2.5vw,24px);border-radius:var(--radius,12px);background:color-mix(in oklch,var(--ink) 4%,var(--surface))}
.cf-pbb6 .pbb-assure li{display:grid;grid-template-columns:20px minmax(0,1fr);gap:12px;align-items:start;padding:16px 0}
.cf-pbb6 .pbb-assure li+li{border-top:1px solid var(--pbb-hair)}
.cf-pbb6 .pbb-assure-icon{margin-top:2px;color:var(--accent)}
.cf-pbb6 .pbb-assure strong{display:block;font-weight:700;line-height:1.3;color:var(--ink)}
.cf-pbb6 .pbb-assure-detail{display:block;margin-top:4px;font-size:.9375rem;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-pbb6 .pbb-details{margin-top:clamp(16px,2vw,24px)}
.cf-pbb6 .pbb-detail{border-bottom:1px solid var(--pbb-hair)}
.cf-pbb6 .pbb-detail-h{margin:0;font:inherit}
.cf-pbb6 .pbb-detail-btn{display:flex;align-items:center;justify-content:space-between;gap:16px;width:100%;min-height:64px;padding:12px 0;border:0;background:none;color:var(--ink);font-family:var(--font-display);font-weight:800;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.3;text-align:left;cursor:pointer;transition:color .16s ease}
.cf-pbb6 .pbb-detail-btn:hover{color:var(--accent)}
.cf-pbb6 .pbb-detail-btn:focus-visible{outline:3px solid var(--pbb-ring);outline-offset:2px;border-radius:6px}
.cf-pbb6 .pbb-chev{flex:none;display:grid;place-items:center;width:36px;height:36px;border-radius:50%;background:color-mix(in oklch,var(--ink) 6%,var(--surface));color:var(--ink);transition:transform .3s cubic-bezier(.2,.7,.2,1)}
.cf-pbb6 .pbb-detail[data-open] .pbb-chev{transform:rotate(180deg)}
.cf-pbb6 .pbb-panel{display:grid;grid-template-rows:0fr;visibility:hidden;transition:grid-template-rows .3s cubic-bezier(.2,.7,.2,1),visibility 0s linear .3s}
.cf-pbb6 .pbb-detail[data-open] .pbb-panel{grid-template-rows:1fr;visibility:visible;transition:grid-template-rows .3s cubic-bezier(.2,.7,.2,1),visibility 0s linear 0s}
.cf-pbb6 .pbb-panel-inner{min-height:0;overflow:hidden}
.cf-pbb6 .pbb-panel-pad{padding:0 0 20px}
.cf-pbb6 .pbb-items,.cf-pbb6 .pbb-points{list-style:none;padding:0;display:grid;gap:16px}
.cf-pbb6 .pbb-items li{display:grid;grid-template-columns:56px minmax(0,1fr);gap:16px;align-items:start}
.cf-pbb6 .pbb-items li[data-noimg]{grid-template-columns:minmax(0,1fr)}
.cf-pbb6 .pbb-thumb{display:block;width:56px;height:56px;border-radius:8px;object-fit:cover;object-position:center}
.cf-pbb6 .pbb-items strong{display:block;font-weight:700;line-height:1.3;color:var(--ink)}
.cf-pbb6 .pbb-items span{display:block;margin-top:4px;font-size:.9375rem;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-pbb6 .pbb-points li{display:grid;grid-template-columns:18px minmax(0,1fr);gap:12px;align-items:start;color:var(--ink);text-wrap:pretty}
.cf-pbb6 .pbb-points svg{margin-top:4px;color:var(--success)}
.cf-pbb6 .pbb-prose{color:var(--ink);text-wrap:pretty}
.cf-pbb6 .pbb-prose p+p{margin-top:12px}
@media (prefers-reduced-motion:reduce){
.cf-pbb6 *,.cf-pbb6 *::before,.cf-pbb6 *::after{animation:none!important;transition:none!important}
.cf-pbb6 .pbb-cta,.cf-pbb6 .pbb-chip-face{transform:none!important}
}
`
pieces/offer/product-buy-box-6/specimen.tsx 99 lines
import __studioImage18c290a9 from "../assets/d9af0a33e9ea0bf9.webp";
import * as React from "react"
import { ProductBuyBox6, type ProductBuyBox6State } from "../product-buy-box-6"
import defaults from "../../studio-defaults.json"
import { slot } from "../../slots"
export const states = ["default", "hover", "active", "disabled", "error"]
export default function ProductBuyBox6Specimen({ state = "default" }: { state?: ProductBuyBox6State }) {
const s = defaults.sample
return (
<ProductBuyBox6
state={state}
name={s.name}
benefit={s.lead}
price={s.price}
compareAt={s.regularPrice}
todayLabel={s.todayLabel}
priceNote={s.note}
stepTitles={{ choose: "Pick how you’ll work through it", quantity: "How many kits do you need?" }}
variants={[
{
name: "format",
label: "Workbook format",
defaultValue: "fillable",
options: [
{ value: "fillable", label: "Fillable PDF" },
{ value: "print", label: "Print-ready PDF" },
],
},
{
name: "paper",
label: "Paper size",
defaultValue: "letter",
options: [
{ value: "letter", label: "US Letter" },
{ value: "a4", label: "A4" },
],
},
]}
quantity={{ min: 1, max: 10, initial: 1, hint: "Buying for a team? Add one kit per person." }}
reasons={[
"The guide, workbook and checklist come in one download.",
"One payment, and the kit is yours to keep.",
"Every order is backed by a 30-day money-back guarantee.",
]}
label="Add To Cart"
sublabel={s.sublabel}
sealGuaranteeImage={slot(
"seal-guarantee",
__studioImage18c290a9
)}
assurances={[
{
icon: "download",
title: "Instant digital delivery",
detail: "Your download link is ready the moment checkout completes.",
},
{
icon: "returns",
title: "Nothing to send back",
detail: "It’s a digital kit, so there’s no parcel to return.",
},
{
icon: "guarantee",
title: "30-day money-back guarantee",
detail: "Use the kit on your next funnel. If it isn’t a fit, ask for a refund within 30 days.",
},
]}
details={[
{
id: "included",
title: "What’s inside your kit",
defaultOpen: true,
items: s.items.map((it, i) => ({
name: it.name,
detail: it.detail,
image: slot(`item-${i + 1}`, it.image),
imageAlt: it.imageAlt,
})),
},
{
id: "how",
title: "How to use it",
points: [
"Read the Funnel Planning Guide and map the pages your offer needs.",
"Draft your headline, offer and call to action in the Page Copy Workbook.",
"Run the Launch Checklist before you share your link.",
],
},
{
id: "access",
title: "Delivery and access",
body: "Your download is ready as soon as checkout completes. One payment gives you lifetime access to all three pieces.",
},
]}
/>
)
}
| Name | Type | Details |
|---|---|---|
name RequiredProductBuyBox6 |
string |
|
benefit OptionalProductBuyBox6 |
string |
|
price RequiredProductBuyBox6 |
string |
|
compareAt OptionalProductBuyBox6 |
string |
|
todayLabel OptionalProductBuyBox6 |
string |
Default "Today’s price"
|
priceNote OptionalProductBuyBox6 |
string |
|
variants OptionalProductBuyBox6 |
BuyBoxVariantGroup[] |
Default []
|
quantity OptionalProductBuyBox6 |
{ min?: number; max?: number; initial?: number; hint?: string } |
|
showQuantity OptionalProductBuyBox6 |
boolean |
Default true
|
stepTitles OptionalProductBuyBox6 |
{ choose?: string; quantity?: string; buy?: string } |
|
reasons OptionalProductBuyBox6 |
string[] |
Default []
|
label OptionalProductBuyBox6 |
string |
Default "Add To Cart"
|
sublabel OptionalProductBuyBox6 |
string |
|
assurances OptionalProductBuyBox6 |
BuyBoxAssurance[] |
Default []
|
details OptionalProductBuyBox6 |
BuyBoxDetail[] |
Default []
|
sealGuaranteeImage OptionalProductBuyBox6 |
string |
|
sealAlt OptionalProductBuyBox6 |
string |
Default ""
|
disabled OptionalProductBuyBox6 |
boolean |
Default false
|
state OptionalProductBuyBox6 |
ProductBuyBox6State |
Default "default"
|
copy OptionalProductBuyBox6 |
Partial<ProductBuyBox6Copy> |
|
onSubmit OptionalProductBuyBox6 |
(order: { quantity: number; options: Record<string, string> }) => void |
|
onAction OptionalProductBuyBox6 |
() => void |
|
href OptionalProductBuyBox6 |
string |
|
className OptionalProductBuyBox6 |
string |
Default ""
|
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-ink--button-2-shadow- Secondary button.
--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.
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.
seal-guarantee- The money-back guarantee seal, on a transparent background.
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
d9af0a33e9ea0bf9.webp
image/webp · 279 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB