Product Buy Box 3
A three-stop gift path (pick a scent, who it’s for, add to cart) that walks the shopper down one rail to the button, turning “it’s a gift” into a note, optional wrap and a live total.
Use it in a prompt
Use offer/product-buy-box-3 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-3.tsx. - Import it and pass your copy and images (Props tab):
import { ProductBuyBox3 } from "@/components/funneldna/offer/product-buy-box-3"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/product-buy-box-3/component.tsx 719 lines
// layout: path-to-action
// A three-stop gift path (pick a scent, who it’s for, add to cart) that walks the shopper down one rail to the button, turning “it’s a gift” into a note, optional wrap and a live total.
"use client"
import * as React from "react"
import { AlertCircle, Check, Gift, ShieldCheck, ShoppingBag, Sparkles, Truck, User } from "lucide-react"
import { FX_HOST, Texture } from "../fx/fx"
import linen from "../fx/textures/linen"
export type ScentOption = {
value: string
/** Chip text (defaults to value). */
label?: string
/** One line on how it smells, shown under the chips once chosen. */
note?: string
/** Shown struck and not selectable. */
disabled?: boolean
}
export type Recipient = "self" | "gift"
export type GiftWrapOffer = {
/** Supplied wrap price, added to the live total when ticked. */
price: string
label?: string
detail?: string
defaultChecked?: boolean
}
export type ProductBuyBox3Order = {
scent: string | null
recipient: Recipient
giftNote: string
giftWrap: boolean
total: string
}
export type ProductBuyBox3State = "default" | "hover" | "active" | "disabled" | "error"
export type ProductBuyBox3Copy = {
stepScent: string
stepFor: string
stepCart: string
stepDone: string
scentPrompt: string
forSelf: string
forGift: string
paceSelf: string
paceGift: string
noteLabel: string
noteOptional: string
notePlaceholder: string
/** {count} and {limit} */
noteCount: string
/** {over} and {limit} */
noteOver: string
wrapLabel: string
/** {price} */
wrapAdd: string
noScentYet: string
giftLine: string
totalLabel: string
todayLabel: string
regularLabel: string
nowLabel: string
pickHint: string
unavailable: string
}
export type ProductBuyBox3Props = {
/** Product name, shown under the photo and in the cart line. */
name: string
headline?: string
/** The one phrase inside the headline that gets the marker stroke. */
headlineMark?: string
lead?: string
/** Product photo (product slot). */
productImage?: string
productImageAlt?: string
/** One short line under the product name. */
benefit?: string
price: string
/** Regular price, struck on the hang tag. Shown only when supplied and higher than the price. */
compareAt?: string
scents?: ScentOption[]
defaultScent?: string
defaultRecipient?: Recipient
/** Future-pacing line under the toggle, one per choice. */
futurePace?: { self?: string; gift?: string }
/** Gift note character limit. */
noteLimit?: number
defaultNote?: string
/** Quiet line under the note while it fits. */
noteHint?: string
/** Optional gift wrap at its supplied price. Hidden when not given. */
giftWrap?: GiftWrapOffer
deliveryNote?: string
/** Supplied guarantee or reassurance line under the button. */
reassurance?: string
/** Plain instruction right above the button. */
instruction?: string
label?: string
/** The product is unavailable: every control is off. */
disabled?: boolean
state?: ProductBuyBox3State
copy?: Partial<ProductBuyBox3Copy>
/** Called with the validated order. */
onSubmit?: (order: ProductBuyBox3Order) => 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: ProductBuyBox3Copy = {
stepScent: "Pick your scent",
stepFor: "Who’s it for?",
stepCart: "Add it to your cart",
stepDone: "(done)",
scentPrompt: "Tap a scent to see how it smells.",
forSelf: "For me",
forGift: "It’s a gift",
paceSelf: "Picture the first evening it’s yours.",
paceGift: "Picture their face the moment it’s opened.",
noteLabel: "Gift note",
noteOptional: "(optional)",
notePlaceholder: "Happy birthday, Sam. Light this one tonight.",
noteCount: "{count} / {limit}",
noteOver: "Trim {over} characters so your note fits.",
wrapLabel: "Add gift wrap",
wrapAdd: "+{price}",
noScentYet: "Scent not picked yet",
giftLine: "Sent as a gift",
totalLabel: "Total today",
todayLabel: "Today",
regularLabel: "Regular price",
nowLabel: "Today’s price",
pickHint: "Pick a scent above to unlock your cart.",
unavailable: "This product isn’t available right now.",
}
type Status = "idle" | "current" | "done"
export function ProductBuyBox3({
name,
headline = "Keep it, or make it a gift",
headlineMark = "make it a gift",
lead,
productImage,
productImageAlt = "",
benefit,
price,
compareAt,
scents = [],
defaultScent,
defaultRecipient = "self",
futurePace,
noteLimit = 150,
defaultNote = "",
noteHint,
giftWrap,
deliveryNote,
reassurance,
instruction = "Click the button below to add it to your cart.",
label = "Add to cart",
disabled = false,
state = "default",
copy,
onSubmit,
onAction,
href,
className = "",
}: ProductBuyBox3Props) {
const t = { ...DEFAULT_COPY, ...copy }
const uid = React.useId().replace(/[^a-zA-Z0-9_-]/g, "")
const noteRef = React.useRef<HTMLTextAreaElement>(null)
const pickStart = () =>
state === "disabled" ? null : scents.find((s) => s.value === defaultScent && !s.disabled)?.value ?? null
const recipientStart = (): Recipient => (state === "error" ? "gift" : defaultRecipient)
const [scent, setScent] = React.useState<string | null>(pickStart)
const [recipient, setRecipient] = React.useState<Recipient>(recipientStart)
const [note, setNote] = React.useState(defaultNote)
const [wrap, setWrap] = React.useState(Boolean(giftWrap?.defaultChecked))
React.useEffect(() => {
setScent(pickStart())
setRecipient(recipientStart())
setNote(defaultNote)
setWrap(Boolean(giftWrap?.defaultChecked))
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [state])
const off = disabled
const hasScents = scents.length > 0
const gift = recipient === "gift"
const count = Array.from(note).length
const over = gift ? Math.max(0, count - noteLimit) : 0
const chosen = scents.find((s) => s.value === scent)
const unit = parseMoney(price)
const was = parseMoney(compareAt)
const showWas = Boolean(compareAt) && (was == null || unit == null || was > unit)
const wrapAmount = giftWrap ? parseMoney(giftWrap.price) : null
const wrapOn = gift && Boolean(giftWrap) && wrap
const total = unit != null ? fmtLike(unit + (wrapOn && wrapAmount != null ? wrapAmount : 0), price) : price
const scentDone = !hasScents || Boolean(chosen)
const forDone = scentDone && over === 0
const canBuy = !off && scentDone
const statusScent: Status = off ? "idle" : scentDone ? "done" : "current"
const statusFor: Status = off ? "idle" : forDone ? "done" : scentDone ? "current" : "idle"
const statusCart: Status = off ? "idle" : forDone ? "current" : "idle"
const pace = gift ? futurePace?.gift ?? t.paceGift : futurePace?.self ?? t.paceSelf
const meter = Math.min(100, (count / Math.max(1, noteLimit)) * 100)
const hintId = `${uid}-hint`
const forced = state === "hover" ? " is-hover" : state === "active" ? " is-active" : ""
const lineSub = [
hasScents ? (chosen ? chosen.label ?? chosen.value : t.noScentYet) : null,
gift ? t.giftLine : null,
]
.filter(Boolean)
.join(" · ")
function submit(e: React.FormEvent<HTMLFormElement>) {
e.preventDefault()
if (!canBuy) return
if (over > 0) {
noteRef.current?.focus()
return
}
const order: ProductBuyBox3Order = {
scent: chosen?.value ?? null,
recipient,
giftNote: gift ? note.trim() : "",
giftWrap: wrapOn,
total,
}
if (onSubmit) onSubmit(order)
else if (onAction) onAction()
else if (href) window.location.assign(href)
}
const button = (extra: string) => (
<button
type="submit"
className={`cf-pbb3__btn${extra}${forced}`}
disabled={!canBuy}
aria-describedby={canBuy ? undefined : hintId}
>
<ShoppingBag size={20} strokeWidth={2.5} aria-hidden="true" />
<span>{label}</span>
</button>
)
return (
<section className={`cf-pbb3${off ? " is-off" : ""}${className ? ` ${className}` : ""}`}>
<style>{CSS}</style>
<div className="cf-pbb3__bg" aria-hidden="true" style={{ ...FX_HOST, position: "absolute", inset: 0 }}>
<Texture src={linen} tone="ink" />
</div>
<div className="cf-pbb3__wrap">
<div className="cf-pbb3__show">
<figure className="cf-pbb3__figure">
{productImage ? (
<img
className="cf-pbb3__photo"
src={productImage}
alt={productImageAlt}
width={800}
height={1000}
decoding="async"
/>
) : (
<div className="cf-pbb3__photo is-empty" aria-hidden="true">
<Gift size={48} strokeWidth={2.5} />
</div>
)}
<div className="cf-pbb3__tag">
<span className="cf-pbb3__string" aria-hidden="true" />
<p className="cf-pbb3__tagCard">
<span className="cf-pbb3__tagLabel">{t.todayLabel}</span>
{showWas ? (
<s className="cf-pbb3__was">
<span className="cf-pbb3__sr">{t.regularLabel} </span>
{compareAt}
</s>
) : null}
<span className="cf-pbb3__now">
<span className="cf-pbb3__sr">{t.nowLabel} </span>
{price}
</span>
</p>
</div>
</figure>
<p className="cf-pbb3__name">{name}</p>
{benefit ? <p className="cf-pbb3__benefit">{benefit}</p> : null}
</div>
<form className="cf-pbb3__card" onSubmit={submit} noValidate aria-labelledby={`${uid}-h`}>
<h2 id={`${uid}-h`} className="cf-pbb3__h">
{withMark(headline, headlineMark)}
</h2>
{lead ? <p className="cf-pbb3__lead">{lead}</p> : null}
<ol className="cf-pbb3__path">
{hasScents ? (
<li className={`cf-pbb3__stop is-${statusScent}`} style={stagger(0)}>
<Node status={statusScent} />
<h3 id={`${uid}-s1`} className="cf-pbb3__stopTitle">
<span className="cf-pbb3__num">1</span>
<span>{t.stepScent}</span>
{statusScent === "done" ? <span className="cf-pbb3__sr"> {t.stepDone}</span> : null}
</h3>
<fieldset className="cf-pbb3__chips" aria-labelledby={`${uid}-s1`} disabled={off}>
{scents.map((o) => {
const on = scent === o.value
return (
<label key={o.value} className={`cf-pbb3__chip${o.disabled ? " is-out" : ""}`}>
<input
type="radio"
name={`${uid}-scent`}
value={o.value}
checked={on}
disabled={o.disabled}
onChange={() => setScent(o.value)}
/>
<span className="cf-pbb3__chipFace">
{on ? (
<Check className="cf-pbb3__chipTick" size={18} strokeWidth={2.5} aria-hidden="true" />
) : null}
{o.label ?? o.value}
</span>
</label>
)
})}
</fieldset>
<p className="cf-pbb3__scentNote" aria-live="polite">
{chosen ? (
chosen.note ? (
<>
<strong>{chosen.label ?? chosen.value}:</strong> {chosen.note}
</>
) : null
) : (
t.scentPrompt
)}
</p>
</li>
) : null}
<li className={`cf-pbb3__stop is-${statusFor}`} style={stagger(1)}>
<Node status={statusFor} />
<h3 id={`${uid}-s2`} className="cf-pbb3__stopTitle">
<span className="cf-pbb3__num">{hasScents ? 2 : 1}</span>
<span>{t.stepFor}</span>
{statusFor === "done" ? <span className="cf-pbb3__sr"> {t.stepDone}</span> : null}
</h3>
<fieldset className="cf-pbb3__seg" aria-labelledby={`${uid}-s2`} disabled={off}>
{(["self", "gift"] as const).map((v) => (
<label key={v} className="cf-pbb3__segOpt">
<input
type="radio"
name={`${uid}-for`}
value={v}
checked={recipient === v}
onChange={() => setRecipient(v)}
/>
<span className="cf-pbb3__segFace">
{v === "gift" ? (
<Gift size={20} strokeWidth={2.5} aria-hidden="true" />
) : (
<User size={20} strokeWidth={2.5} aria-hidden="true" />
)}
{v === "gift" ? t.forGift : t.forSelf}
</span>
</label>
))}
</fieldset>
{pace ? (
<p className="cf-pbb3__pace" aria-live="polite">
<span key={recipient} className="cf-pbb3__paceText">
<Sparkles className="cf-pbb3__inl cf-pbb3__spark" size={18} strokeWidth={2.5} aria-hidden="true" />
{pace}
</span>
</p>
) : null}
{gift ? (
<div className="cf-pbb3__gift">
<div>
<label htmlFor={`${uid}-note`} className="cf-pbb3__label">
{t.noteLabel} <span className="cf-pbb3__opt">{t.noteOptional}</span>
</label>
<textarea
id={`${uid}-note`}
ref={noteRef}
className={`cf-pbb3__input${over ? " is-error" : ""}`}
value={note}
rows={3}
placeholder={t.notePlaceholder}
disabled={off}
aria-invalid={over > 0 ? true : undefined}
aria-describedby={`${uid}-count ${uid}-msg`}
onChange={(e) => setNote(e.target.value)}
/>
<div
className={`cf-pbb3__meter${over ? " is-over" : meter >= 90 ? " is-near" : ""}`}
aria-hidden="true"
>
<span style={{ width: `${meter}%` }} />
</div>
<div className="cf-pbb3__noteFoot">
<p id={`${uid}-msg`} className={over ? "cf-pbb3__err" : "cf-pbb3__noteHint"} aria-live="polite">
{over ? (
<>
<AlertCircle className="cf-pbb3__inl" size={16} strokeWidth={2.5} aria-hidden="true" />
{fill(t.noteOver, { over, limit: noteLimit })}
</>
) : (
noteHint ?? ""
)}
</p>
<span id={`${uid}-count`} className={`cf-pbb3__count${over ? " is-over" : ""}`}>
{fill(t.noteCount, { count, limit: noteLimit })}
</span>
</div>
</div>
{giftWrap ? (
<label className={`cf-pbb3__wrapRow${wrapOn ? " is-on" : ""}`}>
<input type="checkbox" checked={wrap} disabled={off} onChange={(e) => setWrap(e.target.checked)} />
<span className="cf-pbb3__box" aria-hidden="true">
<Check size={16} strokeWidth={3} />
</span>
<span className="cf-pbb3__wrapText">
<span className="cf-pbb3__wrapTitle">{giftWrap.label ?? t.wrapLabel}</span>
{giftWrap.detail ? <span className="cf-pbb3__wrapDetail">{giftWrap.detail}</span> : null}
</span>
<span className="cf-pbb3__wrapPrice">{fill(t.wrapAdd, { price: giftWrap.price })}</span>
</label>
) : null}
</div>
) : null}
</li>
<li className={`cf-pbb3__stop is-${statusCart}`} style={stagger(2)}>
<Node status={statusCart} />
<h3 className="cf-pbb3__stopTitle">
<span className="cf-pbb3__num">{hasScents ? 3 : 2}</span>
<span>{t.stepCart}</span>
</h3>
<div className="cf-pbb3__ledger">
<div className="cf-pbb3__line">
<span className="cf-pbb3__lineName">
{name}
{lineSub ? <span className="cf-pbb3__lineSub">{lineSub}</span> : null}
</span>
<span className="cf-pbb3__amt">{price}</span>
</div>
{wrapOn && giftWrap ? (
<div className="cf-pbb3__line is-new">
<span className="cf-pbb3__lineName">{giftWrap.label ?? t.wrapLabel}</span>
<span className="cf-pbb3__amt">{fill(t.wrapAdd, { price: giftWrap.price })}</span>
</div>
) : null}
<div className="cf-pbb3__total" aria-live="polite">
<span className="cf-pbb3__totalLabel">{t.totalLabel}</span>
<span key={total} className="cf-pbb3__totalAmt">
{total}
</span>
</div>
</div>
{instruction ? <p className="cf-pbb3__instr">{instruction}</p> : null}
<div className="cf-pbb3__act">{button("")}</div>
{!canBuy ? (
<p id={hintId} className="cf-pbb3__hint">
{off ? t.unavailable : t.pickHint}
</p>
) : null}
{reassurance || deliveryNote ? (
<ul className="cf-pbb3__assure">
{reassurance ? (
<li>
<ShieldCheck className="cf-pbb3__inl cf-pbb3__ok" size={16} strokeWidth={2.5} aria-hidden="true" />
{reassurance}
</li>
) : null}
{deliveryNote ? (
<li>
<Truck className="cf-pbb3__inl" size={16} strokeWidth={2.5} aria-hidden="true" />
{deliveryNote}
</li>
) : null}
</ul>
) : null}
</li>
</ol>
</form>
</div>
</section>
)
}
export default ProductBuyBox3
function Node({ status }: { status: Status }) {
return (
<span className={`cf-pbb3__node is-${status}`} aria-hidden="true">
{status === "done" ? <Check size={16} strokeWidth={3} /> : null}
</span>
)
}
function stagger(i: number): React.CSSProperties {
return { animationDelay: `${Math.min(i * 0.07, 0.28)}s` }
}
function withMark(text: string, mark?: string) {
if (!mark) return text
const i = text.indexOf(mark)
if (i < 0) return text
return (
<>
{text.slice(0, i)}
<span className="cf-pbb3__mark">{mark}</span>
{text.slice(i + mark.length)}
</>
)
}
function fill(template: string, vars: Record<string, string | number>) {
return template.replace(/[{]([a-zA-Z]+)[}]/g, (m, k: string) => (k in vars ? String(vars[k]) : m))
}
function parseMoney(v?: string): number | null {
if (!v) return null
const m = v.replace(/,/g, "").match(/-?[0-9]+(?:[.][0-9]+)?/)
return m ? Number(m[0]) : null
}
function fmtLike(n: number, sample: string) {
const m = sample.match(/-?[0-9,]+(?:[.][0-9]+)?/)
if (!m || m.index === undefined) return String(n)
const decimals = m[0].includes(".") ? m[0].split(".")[1]?.length ?? 2 : Number.isInteger(n) ? 0 : 2
const num = n.toLocaleString("en-US", { minimumFractionDigits: decimals, maximumFractionDigits: decimals })
return sample.slice(0, m.index) + num + sample.slice(m.index + m[0].length)
}
const CSS = `
.cf-pbb3{
--pb-ink:var(--ink,#1c2333);
--pb-muted:var(--muted,#4b5563);
--pb-card:var(--card,#ffffff);
--pb-accent:var(--accent,#2a5bd7);
--pb-fill:var(--accent-fill,var(--accent,#2a5bd7));
--pb-fill-ink:var(--accent-fill-ink,var(--card,#ffffff));
--pb-shadow:var(--shadow,#1a2233);
--pb-focus:var(--field-focus,var(--accent,#2a5bd7));
--pb-marker:var(--marker,#fae37c);
--pb-danger:var(--danger,#b42318);
--pb-success:var(--success,#1e7a46);
--pb-hair:oklch(from var(--pb-ink) l c h / .14);
--pb-well:color-mix(in oklch,var(--pb-ink) 4%,var(--pb-card));
position:relative;isolation:isolate;overflow-x:clip;
background:var(--surface,#ffffff);color:var(--pb-ink);
font-family:var(--font-body,system-ui,sans-serif);
padding:clamp(56px,8vw,112px) clamp(16px,5vw,48px) clamp(64px,8.5vw,120px);
}
.cf-pbb3 *,.cf-pbb3 *::before,.cf-pbb3 *::after{box-sizing:border-box}
.cf-pbb3__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-pbb3__bg{position:absolute;inset:0;z-index:0;overflow:hidden;pointer-events:none}
.cf-pbb3__wrap{position:relative;z-index:1;max-width:1120px;margin:0 auto;display:grid;grid-template-columns:minmax(0,1fr);gap:32px}
@media (min-width:900px){
.cf-pbb3__wrap{grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);gap:clamp(32px,5vw,72px);align-items:start}
.cf-pbb3__show{position:sticky;top:32px}
}
/* product photo + hang tag */
.cf-pbb3__figure{position:relative;margin:0}
.cf-pbb3__photo{display:block;width:100%;aspect-ratio:4/5;object-fit:cover;object-position:50% 62%;border-radius:12px;background:color-mix(in oklch,var(--pb-ink) 6%,var(--surface,#ffffff))}
.cf-pbb3__photo.is-empty{display:grid;place-items:center;color:var(--pb-muted)}
@media (max-width:899px){.cf-pbb3__photo{aspect-ratio:4/3}}
.cf-pbb3__tag{position:absolute;top:0;right:clamp(16px,4vw,32px);z-index:1;transform:rotate(4deg);transform-origin:50% 0}
.cf-pbb3__string{position:absolute;z-index:2;top:-2px;left:50%;width:2px;height:48px;margin-left:-1px;border-radius:2px;background:oklch(from var(--pb-ink) l c h / .55)}
.cf-pbb3__tagCard{position:relative;z-index:1;margin:32px 0 0;min-width:116px;padding:30px 16px 16px;display:grid;justify-items:center;gap:8px;text-align:center;background:var(--pb-card);color:var(--pb-ink);border:1px solid var(--pb-hair);border-radius:10px;box-shadow:var(--shadow-md,0 1px 2px oklch(from var(--pb-shadow) l c h / .22),0 4px 10px -2px oklch(from var(--pb-shadow) l c h / .2))}
.cf-pbb3__tagCard::before{content:"";position:absolute;top:10px;left:50%;width:10px;height:10px;margin-left:-5px;border-radius:50%;background:color-mix(in oklch,var(--pb-ink) 20%,var(--pb-card));box-shadow:inset 0 1px 2px oklch(from var(--pb-shadow) l c h / .5)}
.cf-pbb3__tagLabel{font-size:.875rem;line-height:1.2;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--pb-muted)}
.cf-pbb3__was{position:relative;display:inline-block;padding:0 4px;font-family:var(--font-display,inherit);font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.2;font-weight:700;color:var(--pb-muted);text-decoration:none;font-variant-numeric:tabular-nums}
.cf-pbb3__was::after{content:"";position:absolute;left:-2px;right:-2px;top:50%;height:3px;margin-top:-1px;border-radius:3px;background:var(--pb-danger);transform:rotate(-12deg)}
.cf-pbb3__now{margin-top:6px;font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1;letter-spacing:-.03em;font-variant-numeric:tabular-nums;color:var(--pb-ink)}
.cf-pbb3__name{margin:16px 0 0;font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-.01em;text-wrap:balance}
.cf-pbb3__benefit{margin:8px 0 0;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--pb-ink);text-wrap:pretty}
/* the card that holds the path */
.cf-pbb3__card{--pb-pad:clamp(20px,3vw,32px);position:relative;margin:0;min-width:0;padding:var(--pb-pad);background:var(--pb-card);color:var(--pb-ink);border:1px solid var(--card-border,var(--pb-hair));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(from var(--pb-shadow) l c h / .22),0 12px 24px -8px oklch(from var(--pb-shadow) l c h / .32)))}
.cf-pbb3__h{margin:0 0 14px;font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);letter-spacing:var(--display-tracking,-.025em);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;text-wrap:balance;color:var(--pb-ink)}
.cf-pbb3__mark{--pb-mk:color-mix(in oklch,var(--pb-marker) 80%,var(--pb-card));color:inherit;background-image:linear-gradient(to bottom,transparent 20%,var(--pb-mk) 20%,var(--pb-mk) 94%,transparent 94%);padding:0 .1em;margin:0 -.04em;border-radius:.18em .5em .3em .55em;-webkit-box-decoration-break:clone;box-decoration-break:clone}
.cf-pbb3__lead{margin:0 0 32px;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--pb-muted);text-wrap:pretty}
/* the path */
.cf-pbb3__path{list-style:none;margin:0;padding:0}
.cf-pbb3__stop{position:relative;min-width:0;padding:0 0 32px 44px;animation:cf-pbb3-rise .45s cubic-bezier(.2,.7,.2,1) both}
.cf-pbb3__stop:last-child{padding-bottom:0}
.cf-pbb3__stop:not(:last-child)::before,.cf-pbb3__stop:not(:last-child)::after{content:"";position:absolute;left:13px;top:36px;bottom:6px;width:2px;border-radius:2px}
.cf-pbb3__stop::before{background:var(--pb-hair)}
.cf-pbb3__stop::after{background:var(--pb-fill);transform:scaleY(0);transform-origin:top;transition:transform .45s cubic-bezier(.2,.7,.2,1)}
.cf-pbb3__stop.is-done::after{transform:scaleY(1)}
.cf-pbb3__node{position:absolute;left:0;top:0;width:28px;height:28px;border-radius:50%;display:grid;place-items:center;background:var(--pb-card);border:2px solid oklch(from var(--pb-ink) l c h / .28);transition:background .16s ease,border-color .16s ease}
.cf-pbb3__node.is-current{border-color:var(--pb-fill);background:var(--pb-fill);box-shadow:inset 0 0 0 5px var(--pb-card)}
.cf-pbb3__node.is-done{border-color:var(--pb-success);background:var(--pb-success);color:var(--status-glyph,#ffffff);animation:cf-pbb3-pop .3s ease both}
.cf-pbb3__stopTitle{display:flex;align-items:center;gap:10px;min-height:28px;margin:0;font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-.01em;text-wrap:balance;color:var(--pb-ink)}
.cf-pbb3__num{color:var(--pb-accent);font-variant-numeric:tabular-nums}
/* stop 1: scent chips */
.cf-pbb3__chips{display:flex;flex-wrap:wrap;gap:8px;margin:16px 0 0;padding:0;border:0;min-width:0}
.cf-pbb3__chip{position:relative;display:inline-flex;max-width:100%}
.cf-pbb3__chip input,.cf-pbb3__segOpt input,.cf-pbb3__wrapRow input{position:absolute;top:0;left:0;width:1px;height:1px;margin:0;opacity:0;pointer-events:none}
.cf-pbb3__chipFace{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:0 20px;border-radius:999px;border:1px solid oklch(from var(--pb-ink) l c h / .2);background:var(--pb-well);color:var(--pb-ink);font-size:1.0625rem;font-weight:700;line-height:1.2;cursor:pointer;user-select:none;transition:background .16s ease,border-color .16s ease,box-shadow .16s ease,transform .16s ease}
.cf-pbb3__chip:hover .cf-pbb3__chipFace{border-color:oklch(from var(--pb-ink) l c h / .45);background:color-mix(in oklch,var(--pb-ink) 7%,var(--pb-card))}
.cf-pbb3__chip:active .cf-pbb3__chipFace{transform:scale(.98)}
.cf-pbb3__chip input:checked + .cf-pbb3__chipFace{background:color-mix(in oklch,var(--pb-accent) 12%,var(--pb-card));border-color:var(--pb-accent);box-shadow:inset 0 0 0 1px var(--pb-accent),var(--shadow-sm,0 1px 2px oklch(from var(--pb-shadow) l c h / .2))}
.cf-pbb3__chip input:focus-visible + .cf-pbb3__chipFace{outline:2px solid var(--pb-focus);outline-offset:3px}
.cf-pbb3__chip.is-out .cf-pbb3__chipFace{cursor:not-allowed;opacity:.55;text-decoration:line-through}
.cf-pbb3__chipTick{color:var(--pb-accent);margin-left:-4px;flex:none}
.cf-pbb3__scentNote{margin:12px 0 0;min-height:1.4em;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--pb-muted);text-wrap:pretty}
.cf-pbb3__scentNote strong{color:var(--pb-ink);font-weight:700}
/* stop 2: who it's for */
.cf-pbb3__seg{display:grid;grid-template-columns:1fr 1fr;gap:4px;margin:16px 0 0;padding:4px;border:0;min-width:0;border-radius:calc(var(--radius,12px) + 4px);background:color-mix(in oklch,var(--pb-ink) 6%,var(--pb-card))}
.cf-pbb3__segOpt{position:relative;display:flex;min-width:0}
.cf-pbb3__segFace{flex:1;display:flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:0 12px;border-radius:var(--radius,12px);color:var(--pb-ink);font-size:1.0625rem;font-weight:600;line-height:1.2;text-align:center;cursor:pointer;user-select:none;transition:background .16s ease,box-shadow .16s ease,color .16s ease}
.cf-pbb3__segFace svg{flex:none;color:var(--pb-muted);transition:color .16s ease}
.cf-pbb3__segOpt:hover .cf-pbb3__segFace{background:oklch(from var(--pb-card) l c h / .6)}
.cf-pbb3__segOpt input:checked + .cf-pbb3__segFace{background:var(--pb-card);font-weight:800;box-shadow:inset 0 0 0 1px oklch(from var(--pb-accent) l c h / .55),var(--shadow-sm,0 1px 2px oklch(from var(--pb-shadow) l c h / .2))}
.cf-pbb3__segOpt input:checked + .cf-pbb3__segFace svg{color:var(--pb-accent)}
.cf-pbb3__segOpt input:focus-visible + .cf-pbb3__segFace{outline:2px solid var(--pb-focus);outline-offset:2px}
.cf-pbb3__pace{margin:12px 0 0;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;font-weight:500;color:var(--pb-ink);text-wrap:pretty}
.cf-pbb3__paceText{display:inline;animation:cf-pbb3-fade .45s cubic-bezier(.2,.7,.2,1) both}
.cf-pbb3__inl{display:inline-block;vertical-align:-.15em;margin-inline-end:.4em;flex:none}
.cf-pbb3__spark{color:var(--pb-accent)}
/* gift reveal */
.cf-pbb3__gift{display:grid;gap:16px;margin-top:20px;animation:cf-pbb3-rise .45s cubic-bezier(.2,.7,.2,1) both}
.cf-pbb3__label{display:block;margin:0 0 8px;font-size:1.0625rem;line-height:1.3;font-weight:700;color:var(--label-ink,var(--pb-ink))}
.cf-pbb3__opt{font-weight:500;color:var(--pb-muted)}
.cf-pbb3__input{display:block;width:100%;min-height:112px;resize:vertical;margin:0;padding:14px 16px;font-family:var(--font-body,inherit);font-size:1.0625rem;line-height:1.5;color:var(--field-ink,#1c2333);background:var(--field,#ffffff);border:1px solid var(--field-border,color-mix(in oklch,var(--pb-ink) 22%,transparent));border-radius:var(--field-radius,var(--radius,12px));transition:border-color .16s ease,box-shadow .16s ease}
.cf-pbb3__input::placeholder{color:color-mix(in oklch,var(--field-ink,#1c2333) 65%,var(--field,#ffffff));opacity:1}
.cf-pbb3__input:hover:not(:disabled){border-color:color-mix(in oklch,var(--pb-ink) 40%,transparent)}
.cf-pbb3__input:focus{outline:none;border-color:var(--pb-focus);box-shadow:0 0 0 3px oklch(from var(--pb-focus) l c h / .35)}
.cf-pbb3__input.is-error,.cf-pbb3__input.is-error:hover{border-color:var(--pb-danger)}
.cf-pbb3__input.is-error:focus{border-color:var(--pb-danger);box-shadow:0 0 0 3px oklch(from var(--pb-danger) l c h / .3)}
.cf-pbb3__input:disabled{cursor:not-allowed;opacity:.6}
.cf-pbb3__meter{height:4px;margin-top:8px;border-radius:4px;overflow:hidden;background:color-mix(in oklch,var(--pb-ink) 10%,var(--pb-card))}
.cf-pbb3__meter span{display:block;height:100%;border-radius:inherit;background:var(--pb-fill);transition:width .16s ease,background .16s ease}
.cf-pbb3__meter.is-near span{background:var(--warning,#a16207)}
.cf-pbb3__meter.is-over span{background:var(--pb-danger)}
.cf-pbb3__noteFoot{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-top:8px}
.cf-pbb3__noteHint,.cf-pbb3__err{margin:0;min-width:0;font-size:.9375rem;line-height:1.4;text-wrap:pretty}
.cf-pbb3__noteHint{font-weight:500;color:var(--pb-muted)}
.cf-pbb3__err{font-weight:600;color:var(--pb-danger)}
.cf-pbb3__count{flex:none;font-size:.9375rem;line-height:1.4;font-weight:700;font-variant-numeric:tabular-nums;color:var(--pb-muted);white-space:nowrap}
.cf-pbb3__count.is-over{color:var(--pb-danger)}
.cf-pbb3__wrapRow{position:relative;display:grid;grid-template-columns:24px minmax(0,1fr) auto;align-items:start;gap:12px;padding:16px;border-radius:12px;background:var(--pb-well);border:1px solid transparent;cursor:pointer;transition:background .16s ease,border-color .16s ease}
.cf-pbb3__wrapRow:hover{border-color:oklch(from var(--pb-ink) l c h / .22)}
.cf-pbb3__wrapRow.is-on{background:color-mix(in oklch,var(--pb-accent) 10%,var(--pb-card));border-color:var(--pb-accent)}
.cf-pbb3__box{width:24px;height:24px;margin-top:1px;border-radius:6px;border:2px solid oklch(from var(--pb-ink) l c h / .4);background:var(--field,#ffffff);display:grid;place-items:center;color:transparent;transition:background .16s ease,border-color .16s ease,color .16s ease}
.cf-pbb3__wrapRow input:checked + .cf-pbb3__box{background:var(--pb-fill);border-color:var(--pb-fill);color:var(--pb-fill-ink)}
.cf-pbb3__wrapRow input:focus-visible + .cf-pbb3__box{outline:2px solid var(--pb-focus);outline-offset:3px}
.cf-pbb3__wrapTitle{display:block;font-size:1.0625rem;line-height:1.3;font-weight:700;color:var(--pb-ink)}
.cf-pbb3__wrapDetail{display:block;margin-top:4px;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--pb-muted);text-wrap:pretty}
.cf-pbb3__wrapRow.is-on .cf-pbb3__wrapDetail{color:var(--pb-ink)}
.cf-pbb3__wrapPrice{font-family:var(--font-display,inherit);font-size:1.0625rem;line-height:1.3;font-weight:800;font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--pb-ink)}
/* stop 3: the live total and the button */
.cf-pbb3__ledger{display:grid;gap:12px;margin-top:16px;padding:16px 20px;border-radius:12px;background:var(--pb-well)}
.cf-pbb3__line{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.4}
.cf-pbb3__line.is-new{animation:cf-pbb3-rise .45s cubic-bezier(.2,.7,.2,1) both}
.cf-pbb3__lineName{min-width:0;font-weight:600}
.cf-pbb3__lineSub{display:block;font-size:.9375rem;font-weight:500;color:var(--pb-muted)}
.cf-pbb3__amt{font-weight:700;font-variant-numeric:tabular-nums;white-space:nowrap}
.cf-pbb3__total{display:flex;justify-content:space-between;align-items:baseline;flex-wrap:wrap;gap:8px 16px;margin-top:8px}
.cf-pbb3__totalLabel{font-size:.875rem;line-height:1.2;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:var(--pb-ink)}
.cf-pbb3__totalAmt{display:inline-block;font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1;letter-spacing:-.03em;font-variant-numeric:tabular-nums;color:var(--pb-ink);animation:cf-pbb3-pop .3s ease both}
.cf-pbb3__act{display:flex;justify-content:center}
.cf-pbb3__instr{margin:24px 0 16px;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;font-weight:600;color:var(--pb-ink);text-wrap:pretty}
.cf-pbb3__btn{--pb-b:var(--button-bg,var(--cta,#d6402e));--pb-b2:var(--button-bg-2,var(--cta-2,#b8321f));position:relative;display:inline-flex;align-items:center;justify-content:center;gap:10px;width:100%;max-width:none;min-height:64px;margin:0;padding:0 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(oklch(from var(--pb-b) calc(l + .04) c h),oklch(from var(--pb-b2) calc(l - .02) c h));color:var(--button-ink,var(--cta-ink,#ffffff));font-family:var(--button-font,var(--font-display,inherit));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;white-space:nowrap;text-shadow:var(--button-text-shadow,none);box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--pb-b) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--pb-b) calc(l - .16) c h),0 1px 2px oklch(from var(--pb-shadow) l c h / .3),0 8px 16px -6px oklch(from var(--pb-shadow) l c h / .38));cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
.cf-pbb3__btn svg{flex:none}
.cf-pbb3__btn:not(:disabled):hover,.cf-pbb3__btn.is-hover:not(:disabled){background:linear-gradient(oklch(from var(--pb-b) calc(l - .01) c h),oklch(from var(--pb-b2) calc(l - .07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--pb-b) calc(l + .1) c h / .7),inset 0 -3px 0 oklch(from var(--pb-b) calc(l - .2) c h),0 1px 2px oklch(from var(--pb-shadow) l c h / .32),0 10px 18px -6px oklch(from var(--pb-shadow) l c h / .45))}
.cf-pbb3__btn:not(:disabled):active,.cf-pbb3__btn.is-active:not(:disabled){transform:translateY(1px);background:linear-gradient(oklch(from var(--pb-b) calc(l - .04) c h),oklch(from var(--pb-b2) calc(l - .08) c h));box-shadow:inset 0 2px 4px oklch(from var(--pb-b) calc(l - .24) c h / .55),inset 0 -2px 0 oklch(from var(--pb-b) calc(l - .16) c h),0 1px 1px oklch(from var(--pb-shadow) l c h / .25)}
.cf-pbb3__btn:focus-visible{outline:3px solid var(--pb-focus);outline-offset:3px}
.cf-pbb3__btn:disabled{cursor:not-allowed;background:var(--button-2-bg,var(--secondary,#e6e9ef));color:var(--button-2-ink,var(--secondary-ink,#1c2333));text-shadow:none;box-shadow:none}
.cf-pbb3__hint{margin:12px 0 0;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--pb-muted);text-wrap:pretty}
.cf-pbb3__assure{list-style:none;margin:16px 0 0;padding:0;display:grid;gap:8px;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--pb-muted);text-wrap:pretty}
.cf-pbb3__ok{color:var(--pb-success)}
.cf-pbb3.is-off .cf-pbb3__chips,.cf-pbb3.is-off .cf-pbb3__seg,.cf-pbb3.is-off .cf-pbb3__wrapRow{opacity:.6}
/* phone: the path stays one column, the total and full-width button stay in the flow */
@media (max-width:719px){
.cf-pbb3__stop{padding-left:40px}
.cf-pbb3__segFace{gap:6px;padding:0 8px;font-size:1rem;white-space:nowrap}
.cf-pbb3__ledger{padding:16px}
.cf-pbb3__totalAmt{font-size:2.5rem}
.cf-pbb3__btn{padding:0 20px}
}
@keyframes cf-pbb3-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes cf-pbb3-fade{from{opacity:.82}to{opacity:1}}
@keyframes cf-pbb3-pop{from{transform:scale(.9)}to{transform:scale(1)}}
@media (prefers-reduced-motion:reduce){
.cf-pbb3 *,.cf-pbb3 *::before,.cf-pbb3 *::after{animation:none!important;transition:none!important}
}
`
pieces/offer/product-buy-box-3/specimen.tsx 60 lines
import __studioImage3fff2dee from "../assets/39a25c07cf739985.webp";
// Specimen: the Hearth & Wick gift path, a fictional candle walked from scent to cart.
import * as React from "react"
import defaults from "../../studio-defaults.json"
import { slot } from "../../slots"
import { ProductBuyBox3 } from "../product-buy-box-3"
export const states = ["default", "hover", "active", "disabled", "error"]
type SpecimenState = "default" | "hover" | "active" | "disabled" | "error"
const NOTE = "Happy first winter in the new place, Sam. Light this one and stay in. Love, M."
const LONG_NOTE =
"Happy first winter in the new place, Sam. Light this the night the last box is finally unpacked, put the kettle on and stay in. You earned the quiet. See you at New Year. Love, M."
export default function ProductBuyBox3Specimen({ state = "default" }: { state?: SpecimenState }) {
return (
<ProductBuyBox3
key={state}
state={state}
name="Hearth & Wick soy candle"
headline="The candle they’ll light the night it arrives"
headlineMark="the night it arrives"
lead="Hand-poured soy in a stoneware jar. Pick a scent, say who it’s for, and it’s ready to go."
productImage={slot(
"product",
__studioImage3fff2dee
)}
productImageAlt="Charcoal stoneware soy candle beside a kraft-wrapped gift box tied with linen ribbon"
benefit="Hand-poured soy wax, cotton wick, charcoal stoneware jar"
price="$34"
compareAt="$42"
scents={[
{ value: "cedar", label: "Cedar & Smoke", note: "Woodsmoke, amber and a crackle of pine." },
{ value: "fig", label: "Fig Leaf", note: "Green fig, soft cream and a little sun." },
{ value: "clove", label: "Orange Clove", note: "Candied peel and warm winter spice." },
]}
defaultScent={state === "disabled" ? undefined : "cedar"}
defaultRecipient="gift"
futurePace={{
self: "Tonight: kettle on, lamp low, cedar filling the room before the first page turns.",
gift: "Picture it: the ribbon comes off, the lid lifts, and their whole room smells like a cabin in the snow.",
}}
noteLimit={150}
defaultNote={state === "error" ? LONG_NOTE : NOTE}
noteHint="Printed on a card tucked under the ribbon."
giftWrap={{
price: "$6",
label: "Add gift wrap",
detail: "Kraft box, linen ribbon and a hand-tied bow.",
defaultChecked: true,
}}
instruction="Click the button below to add your candle to the cart."
label="Add to cart"
reassurance={defaults.sample.guarantee}
deliveryNote="Shipping options and delivery dates are shown at checkout."
/>
)
}
| Name | Type | Details |
|---|---|---|
name RequiredProductBuyBox3 |
string |
|
headline OptionalProductBuyBox3 |
string |
Default "Keep it, or make it a gift"
|
headlineMark OptionalProductBuyBox3 |
string |
Default "make it a gift"
|
lead OptionalProductBuyBox3 |
string |
|
productImage OptionalProductBuyBox3 |
string |
|
productImageAlt OptionalProductBuyBox3 |
string |
Default ""
|
benefit OptionalProductBuyBox3 |
string |
|
price RequiredProductBuyBox3 |
string |
|
compareAt OptionalProductBuyBox3 |
string |
|
scents OptionalProductBuyBox3 |
ScentOption[] |
Default []
|
defaultScent OptionalProductBuyBox3 |
string |
|
defaultRecipient OptionalProductBuyBox3 |
Recipient |
Default "self"
|
futurePace OptionalProductBuyBox3 |
{ self?: string; gift?: string } |
|
noteLimit OptionalProductBuyBox3 |
number |
Default 150
|
defaultNote OptionalProductBuyBox3 |
string |
Default ""
|
noteHint OptionalProductBuyBox3 |
string |
|
giftWrap OptionalProductBuyBox3 |
GiftWrapOffer |
|
deliveryNote OptionalProductBuyBox3 |
string |
|
reassurance OptionalProductBuyBox3 |
string |
|
instruction OptionalProductBuyBox3 |
string |
Default "Click the button below to add it to your cart."
|
label OptionalProductBuyBox3 |
string |
Default "Add to cart"
|
disabled OptionalProductBuyBox3 |
boolean |
Default false
|
state OptionalProductBuyBox3 |
ProductBuyBox3State |
Default "default"
|
copy OptionalProductBuyBox3 |
Partial<ProductBuyBox3Copy> |
|
onSubmit OptionalProductBuyBox3 |
(order: ProductBuyBox3Order) => void |
|
onAction OptionalProductBuyBox3 |
() => void |
|
href OptionalProductBuyBox3 |
string |
|
className OptionalProductBuyBox3 |
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- 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.
product- The main product shot or cover (ebook, kit, bottle).
-
2c539f422023a290.webp
image/webp · 115 KB
-
39a25c07cf739985.webp
image/webp · 39.9 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB