Quantity Breaks 4
Quantity breaks that unlock free gifts: each size is a comparison column with its price and the gifts it includes, a fill meter names the next gift, and one Add To Cart closes.
Use it in a prompt
Use offer/quantity-breaks-4 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/quantity-breaks-4.tsx. - Import it and pass your copy and images (Props tab):
import { QuantityBreaks4 } from "@/components/funneldna/offer/quantity-breaks-4"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/quantity-breaks-4/component.tsx 633 lines
// layout: comparison-columns
// Quantity breaks that unlock free gifts: each size is a comparison column with its price and the gifts it includes, a fill meter names the next gift, and one Add To Cart closes.
import * as React from "react"
import { AlertCircle, Check, Gift, Loader2, Lock, ShieldCheck, ShoppingCart } from "lucide-react"
import { FX_HOST, Pattern, Spot } from "../fx/fx"
import giftSpot from "../fx/spots/gift"
export type QuantityBreaks4Tier = {
id: string
/** Units in this tier; gift thresholds compare against it. */
quantity: number
/** Supplied price, shown exactly as written. */
price: string
/** Defaults to "{quantity} {unit}". */
label?: string
/** One short supplied line under the price, e.g. a per-unit price. */
note?: string
/** Optional flag such as "Best value"; shown only when supplied. */
tag?: string
}
export type QuantityBreaks4Gift = {
id: string
name: string
/** Smallest tier quantity that includes this gift. */
unlockAt: number
/** Supplied value, e.g. "$14". */
value?: string
/** An imported fx spot asset; defaults to the gift spot. */
spot?: string
/** A real gift photo on a transparent background; replaces the spot. */
image?: string
}
export type QuantityBreaks4Selection = { tier: QuantityBreaks4Tier; gifts: QuantityBreaks4Gift[] }
export type QuantityBreaks4State = "default" | "hover" | "active" | "disabled" | "error"
export type QuantityBreaks4Copy = typeof DEFAULT_COPY
export type QuantityBreaks4Props = {
/** Section headline; a string headline can mark one phrase with `highlight`. */
headline?: React.ReactNode
/** Phrase inside a string headline that gets the marker stroke. */
highlight?: string
/** One-sentence lines under the headline; a one-word line is set large. */
punch?: string[]
productName?: string
/** Transparent product cut-out (slot "product"), stacked to show each quantity. */
productImage?: string
/** Singular unit word, e.g. "Pouch". */
unit?: string
unitPlural?: string
tiers?: QuantityBreaks4Tier[]
/** Free gifts with their unlock thresholds. Empty makes a plain tier picker. */
gifts?: QuantityBreaks4Gift[]
defaultTierId?: string
/** One reassurance line under the button. */
reassurance?: string
/** Generated and accessible text; templates keep their {placeholders}. */
copy?: Partial<QuantityBreaks4Copy>
state?: QuantityBreaks4State
/** Receives the chosen tier and the gifts it unlocks. The builder wires what happens next. */
onSubmit?: (selection: QuantityBreaks4Selection) => void | Promise<void>
className?: string
style?: React.CSSProperties
}
export function QuantityBreaks4({
headline = "Stock up and unlock every free gift",
highlight = "unlock every free gift",
punch = DEFAULT_PUNCH,
productName = "Oakroot Greens Powder",
productImage,
unit = "Pouch",
unitPlural,
tiers = DEFAULT_TIERS,
gifts = DEFAULT_GIFTS,
defaultTierId,
reassurance = "30-day money-back guarantee",
copy,
state = "default",
onSubmit,
className,
style,
}: QuantityBreaks4Props) {
const text = { ...DEFAULT_COPY, ...copy }
const plural = unitPlural ?? unit + "s"
const uid = "qb4" + React.useId().split(":").join("")
const sorted = React.useMemo(
() => tiers.filter((t) => t.quantity > 0).sort((a, b) => a.quantity - b.quantity),
[tiers],
)
const initialId = defaultTierId ?? sorted[Math.min(1, sorted.length - 1)]?.id ?? ""
const [selectedId, setSelectedId] = React.useState(initialId)
const current = React.useRef(initialId)
const [fresh, setFresh] = React.useState<Fresh>({ gifts: [], tiers: [], key: 0 })
const [status, setStatus] = React.useState<"idle" | "loading" | "error">("idle")
const mounted = React.useRef(true)
React.useEffect(() => {
mounted.current = true
return () => {
mounted.current = false
}
}, [])
if (!sorted.length) return null
const disabled = state === "disabled"
const shown = state === "error" ? "error" : status
const loading = shown === "loading"
const force = state === "hover" || state === "active" ? state : undefined
const selected = sorted.find((t) => t.id === selectedId) ?? sorted[0]
const selIndex = sorted.indexOf(selected)
const n = sorted.length
const hasGifts = gifts.length > 0
const headingId = uid + "-h"
const unitsFor = (q: number) => (q === 1 ? unit : plural).toLowerCase()
const labelOf = (t: QuantityBreaks4Tier) =>
t.label ?? fill(text.tierLabel, { quantity: t.quantity, units: t.quantity === 1 ? unit : plural })
const unlocked = gifts.filter((g) => g.unlockAt <= selected.quantity)
const pending = gifts.filter((g) => g.unlockAt > selected.quantity)
const nextTier = sorted.find((t) => t.quantity > selected.quantity && pending.some((g) => g.unlockAt <= t.quantity))
const nextGifts = nextTier ? pending.filter((g) => g.unlockAt <= nextTier.quantity) : []
const more = nextTier ? nextTier.quantity - selected.quantity : 0
const message = !nextTier
? text.meterAll
: nextGifts.length > 1
? fill(text.meterNextMany, { more, units: unitsFor(more), count: nextGifts.length })
: fill(text.meterNext, { more, units: unitsFor(more), gift: nextGifts[0]?.name ?? "" })
const summary = unlocked.length
? fill(text.summaryGifts, { label: labelOf(selected), product: productName, gifts: joinNames(unlocked.map((g) => g.name), text.and) })
: fill(text.summary, { label: labelOf(selected), product: productName })
const hoverId = force === "hover" ? sorted.find((t) => t.id !== selected.id)?.id : undefined
function choose(id: string) {
if (disabled || id === current.current) return
const from = sorted.find((t) => t.id === current.current)
const to = sorted.find((t) => t.id === id)
if (!to) return
const fromQty = from ? from.quantity : 0
current.current = id
setSelectedId(id)
setStatus("idle")
setFresh((f) => ({
gifts: gifts.filter((g) => g.unlockAt <= to.quantity && g.unlockAt > fromQty).map((g) => g.id),
tiers: sorted.filter((t) => t.quantity <= to.quantity && t.quantity > fromQty).map((t) => t.id),
key: f.key + 1,
}))
}
async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault()
if (disabled || loading || !onSubmit) return
setStatus("loading")
try {
await onSubmit({ tier: selected, gifts: unlocked })
if (mounted.current) setStatus("idle")
} catch {
if (mounted.current) setStatus("error")
}
}
return (
<section
className={"cf-quantity-breaks-4" + (className ? " " + className : "")}
style={style}
data-force={force}
data-disabled={disabled || undefined}
aria-labelledby={headingId}
>
<style>{CSS}</style>
<div
className="qb4-fx"
aria-hidden="true"
style={{ ...FX_HOST, position: "absolute", inset: 0, overflow: "hidden", pointerEvents: "none", zIndex: 0 }}
>
<Pattern name="rings" fade="corner" />
</div>
<form className="qb4-wrap" onSubmit={handleSubmit} noValidate aria-busy={loading || undefined}>
<input type="hidden" name="tier" value={selected.id} />
<input type="hidden" name="quantity" value={selected.quantity} />
<header className="qb4-header">
<h2 id={headingId} className="qb4-title">
{renderHeadline(headline, highlight)}
</h2>
{punch.length ? (
<div className="qb4-punch">
{punch.map((line, i) => (
<p key={i} className={isOneWord(line) ? "qb4-word" : undefined}>
{line}
</p>
))}
</div>
) : null}
</header>
<fieldset className="qb4-set" disabled={disabled}>
<legend className="qb4-sr">{text.groupLabel}</legend>
<div className="qb4-cols" style={{ "--qb4-n": n } as React.CSSProperties}>
{sorted.map((t, i) => {
const on = t.id === selected.id
const inputId = uid + "-t" + i
const label = labelOf(t)
return (
<div
key={t.id}
className="qb4-col"
data-selected={on || undefined}
data-hover={hoverId === t.id || undefined}
style={{ "--i": i } as React.CSSProperties}
onClick={() => choose(t.id)}
>
<input
className="qb4-sr qb4-radio"
type="radio"
id={inputId}
name={uid + "-tier"}
value={t.id}
checked={on}
onChange={() => choose(t.id)}
aria-describedby={inputId + "-d"}
/>
<div className="qb4-head">
<span className="qb4-pick" aria-hidden="true">
{on ? <Check size={16} strokeWidth={3} /> : null}
</span>
{t.tag ? <span className="qb4-flag">{t.tag}</span> : null}
{productImage ? (
<ProductStack
src={productImage}
alt={fill(text.stackAlt, { label, product: productName })}
quantity={t.quantity}
/>
) : (
<span className="qb4-num" aria-hidden="true">
×{t.quantity}
</span>
)}
{productImage && t.quantity > 3 ? (
<span className="qb4-qty" aria-hidden="true">
×{t.quantity}
</span>
) : null}
</div>
<div className="qb4-body">
<h3 className="qb4-name">
<label htmlFor={inputId}>{label}</label>
</h3>
<div id={inputId + "-d"} className="qb4-desc">
<p className="qb4-price">{t.price}</p>
{t.note ? <p className="qb4-note">{t.note}</p> : null}
{hasGifts ? (
<ul className="qb4-gifts">
{gifts.map((g) => {
const got = g.unlockAt <= t.quantity
return (
<li key={g.id} className="qb4-gift" data-locked={got ? undefined : ""}>
<span className="qb4-gift-art">
<GiftArt gift={g} size={40} />
</span>
<span className="qb4-gift-text">
<span className="qb4-gift-name">{g.name}</span>
<span className="qb4-gift-sub">
{got
? g.value
? fill(text.giftIncluded, { value: g.value })
: text.giftIncludedPlain
: fill(text.giftLocked, { quantity: g.unlockAt, units: unitsFor(g.unlockAt) })}
</span>
</span>
{got ? (
<span className="qb4-badge">
<Check size={16} strokeWidth={3} aria-hidden="true" />
<span className="qb4-sr">{text.includedSr}</span>
</span>
) : (
<span className="qb4-lock">
<Lock size={18} strokeWidth={2.5} aria-hidden="true" />
<span className="qb4-sr">{text.lockedSr}</span>
</span>
)}
</li>
)
})}
</ul>
) : null}
</div>
</div>
</div>
)
})}
</div>
</fieldset>
<div className="qb4-rail" data-plain={hasGifts ? undefined : ""}>
{hasGifts ? (
<div className="qb4-meter">
<p className="qb4-msg" aria-live="polite">
<Gift className="qb4-inline" size={20} strokeWidth={2.5} aria-hidden="true" />
{message}
{nextTier ? (
<button type="button" className="qb4-up" onClick={() => choose(nextTier.id)} disabled={disabled}>
{fill(text.upgrade, { label: labelOf(nextTier) })}
</button>
) : null}
</p>
<div className="qb4-track" aria-hidden="true">
<div className="qb4-line">
<span className="qb4-fill" style={{ width: ((selIndex + 1) / n) * 100 + "%" }} />
{sorted.map((t, i) => {
const reached = i <= selIndex
const isFresh = fresh.tiers.includes(t.id)
const prevQty = i > 0 ? sorted[i - 1].quantity : 0
const markGift = gifts.find((g) => g.unlockAt <= t.quantity && g.unlockAt > prevQty)
return (
<span
key={isFresh ? t.id + "-" + fresh.key : t.id}
className="qb4-mark"
data-reached={reached || undefined}
data-fresh={isFresh || undefined}
style={{ left: ((i + 1) / n) * 100 + "%" }}
>
{markGift ? (
<span className="qb4-mark-art">
<span className="qb4-pop">
<GiftArt gift={markGift} size={32} onBand />
</span>
</span>
) : null}
<span className="qb4-dot">{reached ? <Check size={16} strokeWidth={3} /> : null}</span>
<span className="qb4-mark-num">{t.quantity}</span>
</span>
)
})}
</div>
</div>
<div className="qb4-strip">
<p className="qb4-strip-label">{unlocked.length ? text.stripLabel : text.stripEmpty}</p>
{unlocked.length ? (
<ul className="qb4-chips">
{unlocked.map((g) => {
const isFresh = fresh.gifts.includes(g.id)
return (
<li key={isFresh ? g.id + "-" + fresh.key : g.id} className="qb4-chip" data-fresh={isFresh || undefined}>
<span className="qb4-chip-art">
<GiftArt gift={g} size={28} onBand />
</span>
{g.name}
</li>
)
})}
</ul>
) : null}
</div>
</div>
) : null}
<div className="qb4-buy">
<p className="qb4-invest">
{summary}{" "}
<span className="qb4-total">
<span className="qb4-sc">{text.investment}</span> <strong>{selected.price}</strong>
</span>
</p>
<button type="submit" className="qb4-btn" disabled={disabled} data-loading={loading || undefined}>
{loading ? (
<Loader2 className="qb4-spin" size={20} strokeWidth={2.5} aria-hidden="true" />
) : (
<ShoppingCart size={20} strokeWidth={2.5} aria-hidden="true" />
)}
<span>{loading ? text.loading : text.cart}</span>
{loading ? null : <span className="qb4-btn-price">{selected.price}</span>}
</button>
{shown === "error" ? (
<p className="qb4-error" role="alert">
<AlertCircle className="qb4-inline" size={18} strokeWidth={2.5} aria-hidden="true" />
{text.error}
</p>
) : null}
{reassurance ? (
<p className="qb4-assure">
<ShieldCheck className="qb4-inline" size={18} strokeWidth={2.5} aria-hidden="true" />
{reassurance}
</p>
) : null}
</div>
</div>
</form>
</section>
)
}
export default QuantityBreaks4
type Fresh = { gifts: string[]; tiers: string[]; key: number }
function GiftArt({ gift, size, onBand }: { gift: QuantityBreaks4Gift; size: number; onBand?: boolean }) {
if (gift.image) {
return <img className="qb4-art-img" src={gift.image} alt="" width={size} height={size} loading="lazy" />
}
return onBand ? (
<Spot src={gift.spot ?? giftSpot} size={size} shade="band" light="band-ink" />
) : (
<Spot src={gift.spot ?? giftSpot} size={size} />
)
}
function ProductStack({ src, alt, quantity }: { src: string; alt: string; quantity: number }) {
const count = Math.max(1, Math.min(3, Math.floor(quantity)))
const order = count === 3 ? [0, 2, 1] : count === 2 ? [0, 1] : [0]
return (
<span className="qb4-stack">
{order.map((k, j) => {
const front = j === order.length - 1
return (
<img
key={k}
className={front ? undefined : "is-back"}
src={src}
alt={front ? alt : ""}
width={104}
height={136}
loading="lazy"
style={{ "--o": k - (count - 1) / 2 } as React.CSSProperties}
/>
)
})}
</span>
)
}
function renderHeadline(headline: React.ReactNode, highlight?: string) {
if (typeof headline !== "string" || !highlight) return headline
const at = headline.indexOf(highlight)
if (at < 0) return headline
return (
<>
{headline.slice(0, at)}
<span className="qb4-hl">{highlight}</span>
{headline.slice(at + highlight.length)}
</>
)
}
function isOneWord(line: string) {
return line.trim().split(" ").filter(Boolean).length === 1
}
function fill(template: string, values: Record<string, string | number>) {
let out = template
for (const key of Object.keys(values)) out = out.split("{" + key + "}").join(String(values[key]))
return out
}
function joinNames(names: string[], and: string) {
if (names.length <= 1) return names[0] ?? ""
return names.slice(0, -1).join(", ") + " " + and + " " + names[names.length - 1]
}
const DEFAULT_COPY = {
groupLabel: "Choose how many you want",
/** {quantity} {units} */
tierLabel: "{quantity} {units}",
/** {label} {product} */
stackAlt: "{label} of {product}",
/** {value} */
giftIncluded: "Free · {value} value",
giftIncludedPlain: "Free with this size",
/** {quantity} {units} */
giftLocked: "Unlocks at {quantity} {units}",
includedSr: "Included",
lockedSr: "Not included yet",
/** {more} {units} {gift} */
meterNext: "Add {more} more {units} to unlock the {gift}.",
/** {more} {units} {count} */
meterNextMany: "Add {more} more {units} to unlock {count} more gifts.",
meterAll: "Every free gift is unlocked.",
/** {label} */
upgrade: "Move up to {label}",
stripLabel: "Free in your box:",
stripEmpty: "Move up a size to unlock your first gift.",
/** {label} {product} */
summary: "{label} of {product}.",
/** {label} {product} {gifts} */
summaryGifts: "{label} of {product}, plus the {gifts}, free.",
investment: "Your investment:",
cart: "Add To Cart",
loading: "Adding to cart…",
error: "We couldn’t add that to your cart. Please try again.",
and: "and",
}
const DEFAULT_PUNCH = [
"Pick how many you want below.",
"Each size up adds another free gift to the same box.",
"Automatically.",
]
const DEFAULT_TIERS: QuantityBreaks4Tier[] = [
{ id: "one", quantity: 1, price: "$39" },
{ id: "three", quantity: 3, price: "$99", note: "$33 a pouch" },
{ id: "six", quantity: 6, price: "$179", note: "$29.83 a pouch", tag: "Best value" },
]
const DEFAULT_GIFTS: QuantityBreaks4Gift[] = [
{ id: "shaker", name: "Steel Shaker Bottle", unlockAt: 3, value: "$14" },
{ id: "recipes", name: "Morning Recipe Cards", unlockAt: 6, value: "$12" },
{ id: "planner", name: "30-Day Habit Planner", unlockAt: 6, value: "$9" },
]
const CSS = `
.cf-quantity-breaks-4{--qb4-shadow:var(--shadow,oklch(0.22 0.03 260));--qb4-gutter:clamp(16px,5vw,48px);--qb4-hair:oklch(from var(--ink,#1a2233) l c h / 0.12);position:relative;isolation:isolate;overflow-x:clip;padding:clamp(56px,8vw,112px) var(--qb4-gutter) clamp(64px,8.5vw,120px);background:var(--surface,#ffffff);color:var(--ink,#1a2233);font-family:var(--font-body,system-ui,sans-serif)}
.cf-quantity-breaks-4 *,.cf-quantity-breaks-4 *::before,.cf-quantity-breaks-4 *::after{box-sizing:border-box}
.cf-quantity-breaks-4 .qb4-wrap{position:relative;z-index:1;max-width:1120px;margin-inline:auto}
.cf-quantity-breaks-4 .qb4-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.cf-quantity-breaks-4 .qb4-header{max-width:46rem;margin-inline:auto;text-align:center}
.cf-quantity-breaks-4 .qb4-title{margin:0;color:var(--ink,#1a2233);font-family:var(--font-display,inherit);font-size:clamp(2rem,3.6vw,3.25rem);font-weight:var(--display-weight,800);line-height:1.06;letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);text-wrap:balance}
.cf-quantity-breaks-4 .qb4-hl{padding-inline:.06em;background:linear-gradient(transparent 56%,var(--marker,#fae37c) 56%,var(--marker,#fae37c) 93%,transparent 93%);-webkit-box-decoration-break:clone;box-decoration-break:clone}
.cf-quantity-breaks-4 .qb4-punch{display:grid;gap:8px;margin-top:16px}
.cf-quantity-breaks-4 .qb4-punch p{margin:0;color:var(--muted,#4a5568);font-size:clamp(1.125rem,1.5vw,1.375rem);font-weight:500;line-height:1.4;text-wrap:pretty}
.cf-quantity-breaks-4 .qb4-punch p.qb4-word{margin-top:4px;color:var(--ink,#1a2233);font-family:var(--font-display,inherit);font-size:clamp(1.3125rem,1.8vw,1.625rem);font-weight:var(--display-weight,800);line-height:1.15;letter-spacing:-0.01em}
.cf-quantity-breaks-4 .qb4-set{min-width:0;margin:clamp(32px,4vw,48px) 0 0;padding:0;border:0}
.cf-quantity-breaks-4 .qb4-cols{display:grid;grid-template-columns:repeat(var(--qb4-n,3),minmax(0,1fr));align-items:stretch;gap:clamp(16px,2vw,24px)}
.cf-quantity-breaks-4 .qb4-col{position:relative;display:flex;flex-direction:column;min-width:0;overflow:hidden;background:var(--card,#ffffff);color:var(--ink,#1a2233);border:1px solid var(--card-border,oklch(from var(--ink,#1a2233) l c h / 0.12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-md,0 1px 2px oklch(from var(--qb4-shadow) l c h / 0.22),0 4px 10px -2px oklch(from var(--qb4-shadow) l c h / 0.2)));cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease;animation:qb4-rise .45s cubic-bezier(.2,.7,.2,1) backwards;animation-delay:min(calc(var(--i,0) * .07s),.28s)}
.cf-quantity-breaks-4 .qb4-col:hover,.cf-quantity-breaks-4 .qb4-col[data-hover]{transform:translateY(-2px);box-shadow:var(--shadow-lg,0 2px 4px oklch(from var(--qb4-shadow) l c h / 0.22),0 12px 24px -8px oklch(from var(--qb4-shadow) l c h / 0.32))}
.cf-quantity-breaks-4 .qb4-col[data-selected]{border-color:var(--accent,#2563eb);box-shadow:0 0 0 1px var(--accent,#2563eb),var(--shadow-lg,0 2px 4px oklch(from var(--qb4-shadow) l c h / 0.22),0 12px 24px -8px oklch(from var(--qb4-shadow) l c h / 0.32))}
.cf-quantity-breaks-4 .qb4-col:has(.qb4-radio:focus-visible){outline:3px solid var(--field-focus,var(--accent,#2563eb));outline-offset:4px}
.cf-quantity-breaks-4[data-disabled] .qb4-col{cursor:not-allowed;transform:none}
.cf-quantity-breaks-4 .qb4-head{position:relative;display:grid;place-items:end center;min-height:196px;padding:56px 20px 20px;background:color-mix(in oklch,var(--ink,#1a2233) 5%,var(--card,#ffffff));color:var(--ink,#1a2233);transition:background-color .2s ease,color .2s ease}
.cf-quantity-breaks-4 .qb4-col[data-selected] .qb4-head{background:var(--band,#16233d);color:var(--band-ink,#ffffff)}
.cf-quantity-breaks-4 .qb4-pick{position:absolute;top:16px;left:16px;display:grid;place-items:center;width:28px;height:28px;border:2px solid oklch(from var(--ink,#1a2233) l c h / 0.3);border-radius:999px;background:var(--card,#ffffff);color:var(--accent-fill-ink,#ffffff);transition:background-color .16s ease,border-color .16s ease}
.cf-quantity-breaks-4 .qb4-col[data-selected] .qb4-pick{border-color:var(--accent-fill,var(--accent,#2563eb));background:var(--accent-fill,var(--accent,#2563eb))}
.cf-quantity-breaks-4 .qb4-col[data-selected] .qb4-pick svg{animation:qb4-pop .3s cubic-bezier(.2,.7,.2,1) backwards}
.cf-quantity-breaks-4 .qb4-flag{position:absolute;top:14px;right:14px;display:inline-flex;align-items:center;min-height:30px;padding:4px 12px;border-radius:999px;background:var(--accent-fill,var(--accent,#2563eb));color:var(--accent-fill-ink,#ffffff);font-size:.875rem;font-weight:800;line-height:1.2;white-space:nowrap}
.cf-quantity-breaks-4 .qb4-stack{position:relative;display:block;width:100%;height:140px}
.cf-quantity-breaks-4 .qb4-stack img{position:absolute;bottom:0;left:50%;width:104px;height:136px;object-fit:contain;object-position:center bottom;transform:translateX(calc(-50% + var(--o,0) * 50px));transform-origin:center bottom;filter:drop-shadow(0 2px 3px oklch(from var(--qb4-shadow) l c h / 0.35)) drop-shadow(0 10px 12px oklch(from var(--qb4-shadow) l c h / 0.22))}
.cf-quantity-breaks-4 .qb4-stack img.is-back{transform:translateX(calc(-50% + var(--o,0) * 50px)) scale(.88)}
.cf-quantity-breaks-4 .qb4-num{display:block;font-family:var(--font-display,inherit);font-size:clamp(2.5rem,4.2vw,3.75rem);font-weight:var(--display-weight,800);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums}
.cf-quantity-breaks-4 .qb4-qty{position:absolute;right:14px;bottom:14px;display:inline-flex;align-items:center;min-height:30px;padding:4px 12px;border-radius:999px;background:var(--card,#ffffff);color:var(--ink,#1a2233);font-size:.875rem;font-weight:800;line-height:1.2;font-variant-numeric:tabular-nums}
.cf-quantity-breaks-4 .qb4-col[data-selected] .qb4-qty{background:oklch(from var(--band-ink,#ffffff) l c h / 0.14);color:var(--band-ink,#ffffff)}
.cf-quantity-breaks-4 .qb4-body{display:flex;flex:1;flex-direction:column;padding:clamp(20px,3vw,32px)}
.cf-quantity-breaks-4 .qb4-name{margin:0;font-family:var(--font-display,inherit);font-size:clamp(1.3125rem,1.8vw,1.625rem);font-weight:var(--display-weight,800);line-height:1.15;letter-spacing:-0.01em;text-wrap:balance}
.cf-quantity-breaks-4 .qb4-name label{cursor:inherit}
.cf-quantity-breaks-4 .qb4-price{margin:12px 0 0;color:var(--ink,#1a2233);font-family:var(--font-display,inherit);font-size:clamp(2.5rem,4.2vw,3.75rem);font-weight:var(--display-weight,800);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums}
.cf-quantity-breaks-4 .qb4-col[data-selected] .qb4-price{color:var(--accent,#2563eb)}
.cf-quantity-breaks-4 .qb4-note{margin:12px 0 0;color:var(--muted,#4a5568);font-size:.9375rem;font-weight:500;line-height:1.4}
.cf-quantity-breaks-4 .qb4-gifts{margin:24px 0 0;padding:0;list-style:none;border-top:1px solid var(--qb4-hair)}
.cf-quantity-breaks-4 .qb4-gift{display:grid;grid-template-columns:40px minmax(0,1fr) 28px;align-items:center;gap:12px;padding-block:12px;border-bottom:1px solid var(--qb4-hair)}
.cf-quantity-breaks-4 .qb4-gift:last-child{padding-bottom:0;border-bottom:0}
.cf-quantity-breaks-4 .qb4-gift-art{display:grid;place-items:center;width:40px;height:40px}
.cf-quantity-breaks-4 .qb4-gift[data-locked] .qb4-gift-art{filter:grayscale(1);opacity:.45}
.cf-quantity-breaks-4 .qb4-gift-text{min-width:0}
.cf-quantity-breaks-4 .qb4-gift-name{display:block;font-size:1.0625rem;font-weight:700;line-height:1.3;text-wrap:pretty}
.cf-quantity-breaks-4 .qb4-gift-sub{display:block;margin-top:2px;color:var(--success,#1f7a3e);font-size:.9375rem;font-weight:600;line-height:1.4}
.cf-quantity-breaks-4 .qb4-gift[data-locked] .qb4-gift-name,.cf-quantity-breaks-4 .qb4-gift[data-locked] .qb4-gift-sub{color:var(--muted,#4a5568)}
.cf-quantity-breaks-4 .qb4-gift[data-locked] .qb4-gift-sub{font-weight:500}
.cf-quantity-breaks-4 .qb4-badge{display:grid;place-items:center;width:28px;height:28px;border-radius:999px;background:var(--success,#1f7a3e);color:var(--qb4-glyph,#ffffff)}
.cf-quantity-breaks-4 .qb4-lock{display:grid;place-items:center;width:28px;height:28px;color:var(--muted,#4a5568)}
.cf-quantity-breaks-4 .qb4-art-img{display:block;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 2px 3px oklch(from var(--qb4-shadow) l c h / 0.3))}
.cf-quantity-breaks-4 .qb4-rail{position:relative;z-index:2;display:grid;grid-template-columns:minmax(0,1.2fr) minmax(0,.8fr);align-items:start;gap:clamp(24px,4vw,48px);margin-top:clamp(32px,4vw,48px);padding:clamp(20px,3vw,32px);border-radius:var(--card-radius,var(--radius,14px));background:var(--band,#16233d);color:var(--band-ink,#ffffff);box-shadow:var(--shadow-lg,0 2px 4px oklch(from var(--qb4-shadow) l c h / 0.22),0 12px 24px -8px oklch(from var(--qb4-shadow) l c h / 0.32))}
.cf-quantity-breaks-4 .qb4-rail[data-plain]{grid-template-columns:minmax(0,1fr)}
.cf-quantity-breaks-4 .qb4-rail[data-plain] .qb4-buy{width:100%;max-width:560px;margin-inline:auto;text-align:center}
.cf-quantity-breaks-4 .qb4-meter{min-width:0}
.cf-quantity-breaks-4 .qb4-msg{margin:0;font-size:clamp(1.0625rem,1.25vw,1.125rem);font-weight:700;line-height:1.45;text-wrap:pretty}
.cf-quantity-breaks-4 .qb4-inline{display:inline-block;vertical-align:-0.18em;margin-inline-end:.4em}
.cf-quantity-breaks-4 .qb4-up{margin-inline-start:.35em;padding:2px 0;border:0;background:none;color:var(--band-ink,#ffffff);font:inherit;text-decoration:underline;text-decoration-color:oklch(from var(--band-ink,#ffffff) l c h / 0.5);text-decoration-thickness:2px;text-underline-offset:.2em;white-space:nowrap;cursor:pointer}
.cf-quantity-breaks-4 .qb4-up:hover{text-decoration-color:var(--band-ink,#ffffff)}
.cf-quantity-breaks-4 .qb4-up:focus-visible{outline:3px solid var(--band-ink,#ffffff);outline-offset:3px;border-radius:4px}
.cf-quantity-breaks-4 .qb4-up:disabled{cursor:not-allowed}
.cf-quantity-breaks-4 .qb4-track{padding:44px 16px 30px}
.cf-quantity-breaks-4 .qb4-line{position:relative;height:10px;border-radius:999px;background:oklch(from var(--band-ink,#ffffff) l c h / 0.16)}
.cf-quantity-breaks-4 .qb4-fill{position:absolute;top:0;bottom:0;left:0;border-radius:inherit;background:linear-gradient(90deg,oklch(from var(--accent-fill,var(--accent,#2563eb)) calc(l - 0.04) c h),oklch(from var(--accent-fill,var(--accent,#2563eb)) calc(l + 0.06) c h));transition:width .55s cubic-bezier(.2,.7,.2,1)}
.cf-quantity-breaks-4 .qb4-mark{position:absolute;top:50%;width:26px;height:26px;transform:translate(-50%,-50%)}
.cf-quantity-breaks-4 .qb4-dot{display:grid;place-items:center;width:26px;height:26px;border:2px solid oklch(from var(--band-ink,#ffffff) l c h / 0.45);border-radius:999px;background:var(--band,#16233d);color:var(--accent-fill-ink,#ffffff);transition:background-color .2s ease,border-color .2s ease}
.cf-quantity-breaks-4 .qb4-mark[data-reached] .qb4-dot{border-color:var(--accent-fill,var(--accent,#2563eb));background:var(--accent-fill,var(--accent,#2563eb))}
.cf-quantity-breaks-4 .qb4-mark-art{position:absolute;bottom:calc(100% + 6px);left:50%;display:grid;place-items:center;width:32px;height:32px;transform:translateX(-50%)}
.cf-quantity-breaks-4 .qb4-mark:not([data-reached]) .qb4-mark-art{filter:grayscale(1);opacity:.5}
.cf-quantity-breaks-4 .qb4-pop{display:grid;place-items:center}
.cf-quantity-breaks-4 .qb4-mark[data-fresh] .qb4-pop,.cf-quantity-breaks-4 .qb4-chip[data-fresh]{animation:qb4-pop .3s cubic-bezier(.2,.7,.2,1) backwards}
.cf-quantity-breaks-4 .qb4-mark-num{position:absolute;top:calc(100% + 6px);left:50%;font-size:.9375rem;font-weight:700;line-height:1.2;font-variant-numeric:tabular-nums;white-space:nowrap;transform:translateX(-50%)}
.cf-quantity-breaks-4 .qb4-strip{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px}
.cf-quantity-breaks-4 .qb4-strip-label{margin:0;font-size:.9375rem;font-weight:600;line-height:1.4}
.cf-quantity-breaks-4 .qb4-chips{display:flex;flex-wrap:wrap;gap:8px;margin:0;padding:0;list-style:none}
.cf-quantity-breaks-4 .qb4-chip{display:inline-flex;align-items:center;gap:8px;min-height:32px;padding:2px 12px 2px 4px;border-radius:999px;background:oklch(from var(--band-ink,#ffffff) l c h / 0.12);font-size:.875rem;font-weight:800;line-height:1.2}
.cf-quantity-breaks-4 .qb4-chip-art{display:grid;place-items:center;width:28px;height:28px}
.cf-quantity-breaks-4 .qb4-buy{display:grid;gap:16px;min-width:0}
.cf-quantity-breaks-4 .qb4-invest{margin:0;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;text-wrap:pretty}
.cf-quantity-breaks-4 .qb4-total{white-space:nowrap}
.cf-quantity-breaks-4 .qb4-sc{font-variant-caps:all-small-caps;font-weight:800;letter-spacing:.06em}
.cf-quantity-breaks-4 .qb4-invest strong{font-weight:800;font-variant-numeric:tabular-nums}
.cf-quantity-breaks-4 .qb4-btn{--qb4-b:var(--button-bg,var(--cta,#d9342b));--qb4-b2:var(--button-bg-2,var(--cta-2,#b8241c));display:inline-flex;align-items:center;justify-content:center;gap:12px;width:100%;min-height:72px;padding:0 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(oklch(from var(--qb4-b) calc(l + 0.04) c h),oklch(from var(--qb4-b2) calc(l - 0.02) c h));color:var(--button-ink,var(--cta-ink,#ffffff));font-family:var(--button-font,var(--font-display,inherit));font-size:clamp(1.125rem,1.55vw,1.375rem);font-weight:var(--button-weight,800);line-height:1.15;text-transform:var(--button-case,none);text-shadow:var(--button-text-shadow,none);white-space:nowrap;cursor:pointer;box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--qb4-b) calc(l + 0.14) c h / 0.7),inset 0 -3px 0 oklch(from var(--qb4-b) calc(l - 0.16) c h),0 1px 2px oklch(from var(--qb4-shadow) l c h / 0.35),0 8px 16px -6px oklch(from var(--qb4-shadow) l c h / 0.5));transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
.cf-quantity-breaks-4 .qb4-btn:hover:not(:disabled),.cf-quantity-breaks-4[data-force=hover] .qb4-btn{background:linear-gradient(oklch(from var(--qb4-b) calc(l - 0.01) c h),oklch(from var(--qb4-b2) calc(l - 0.07) c h));box-shadow:inset 0 1px 0 oklch(from var(--qb4-b) calc(l + 0.1) c h / 0.7),inset 0 -3px 0 oklch(from var(--qb4-b) calc(l - 0.2) c h),0 1px 2px oklch(from var(--qb4-shadow) l c h / 0.4),0 10px 18px -6px oklch(from var(--qb4-shadow) l c h / 0.6)}
.cf-quantity-breaks-4 .qb4-btn:active:not(:disabled),.cf-quantity-breaks-4[data-force=active] .qb4-btn{transform:translateY(1px);background:linear-gradient(oklch(from var(--qb4-b) calc(l - 0.04) c h),oklch(from var(--qb4-b2) calc(l - 0.08) c h));box-shadow:inset 0 2px 4px oklch(from var(--qb4-b) calc(l - 0.22) c h / 0.55),inset 0 -2px 0 oklch(from var(--qb4-b) calc(l - 0.16) c h),0 1px 2px oklch(from var(--qb4-shadow) l c h / 0.35)}
.cf-quantity-breaks-4 .qb4-btn:focus-visible{outline:3px solid var(--band-ink,#ffffff);outline-offset:3px}
.cf-quantity-breaks-4 .qb4-btn[data-loading]{cursor:progress}
.cf-quantity-breaks-4 .qb4-btn:disabled{background:var(--button-2-bg,var(--secondary,oklch(0.93 0.015 263)));color:var(--button-2-ink,var(--secondary-ink,#1a2233));box-shadow:var(--button-2-shadow,var(--shadow-sm,0 1px 1px oklch(from var(--qb4-shadow) l c h / 0.18),0 1px 3px oklch(from var(--qb4-shadow) l c h / 0.14)));text-shadow:none;cursor:not-allowed}
.cf-quantity-breaks-4 .qb4-btn-price{display:inline-flex;align-items:center;min-height:36px;padding:4px 14px;border-radius:999px;background:oklch(from var(--qb4-b2) calc(l - 0.07) c h);box-shadow:inset 0 1px 2px oklch(from var(--qb4-b2) calc(l - 0.2) c h / 0.45),inset 0 -1px 0 oklch(from var(--qb4-b) calc(l + 0.1) c h / 0.35);font-variant-numeric:tabular-nums}
.cf-quantity-breaks-4 .qb4-btn:disabled .qb4-btn-price{background:oklch(from var(--secondary,oklch(0.93 0.015 263)) calc(l - 0.06) c h);box-shadow:none}
.cf-quantity-breaks-4 .qb4-spin{animation:qb4-spin .8s linear infinite}
.cf-quantity-breaks-4 .qb4-error{margin:0;padding:8px 12px;border-radius:10px;background:var(--danger-soft,oklch(0.93 0.024 27));color:var(--danger,oklch(0.5 0.17 27));font-size:.9375rem;font-weight:600;line-height:1.4;text-wrap:pretty}
.cf-quantity-breaks-4 .qb4-assure{margin:0;font-size:.9375rem;font-weight:500;line-height:1.4;text-align:center;text-wrap:pretty}
@keyframes qb4-rise{from{opacity:.82;transform:translateY(8px)}}
@keyframes qb4-pop{from{opacity:.6;transform:scale(.9)}}
@keyframes qb4-spin{to{transform:rotate(360deg)}}
@media (max-width:760px){
.cf-quantity-breaks-4 .qb4-cols{grid-template-columns:minmax(0,1fr)}
.cf-quantity-breaks-4 .qb4-head{min-height:164px;padding-top:52px}
.cf-quantity-breaks-4 .qb4-rail{grid-template-columns:minmax(0,1fr);gap:24px;padding:24px 20px}
.cf-quantity-breaks-4 .qb4-track{padding:44px 14px 30px}
.cf-quantity-breaks-4 .qb4-buy{gap:12px}
.cf-quantity-breaks-4 .qb4-btn{min-height:64px;gap:10px;padding:0 18px}
.cf-quantity-breaks-4 .qb4-btn-price{min-height:32px;padding:4px 12px}
}
@media (prefers-reduced-motion:reduce){
.cf-quantity-breaks-4 *,.cf-quantity-breaks-4 *::before,.cf-quantity-breaks-4 *::after{animation:none !important;transition:none !important}
.cf-quantity-breaks-4 .qb4-col:hover,.cf-quantity-breaks-4 .qb4-col[data-hover]{transform:none}
}
`
pieces/offer/quantity-breaks-4/specimen.tsx 45 lines
import __studioImagedd7ba8d2 from "../assets/592b880101f6444b.webp";
import * as React from "react"
import { QuantityBreaks4, type QuantityBreaks4State } from "../quantity-breaks-4"
import defaults from "../../studio-defaults.json"
import { slot } from "../../slots"
import book from "../../fx/spots/book"
import calendar from "../../fx/spots/calendar"
import gift from "../../fx/spots/gift"
export const states = ["default", "hover", "active", "disabled", "error"]
export default function QuantityBreaks4Specimen({ state = "default" }: { state?: QuantityBreaks4State }) {
return (
<QuantityBreaks4
state={state}
headline="More Oakroot, more free gifts"
highlight="more free gifts"
punch={[
"One scoop in cold water makes your morning greens.",
"Order more pouches and the free gifts stack up in the same box.",
"Free.",
]}
productName="Oakroot Greens Powder"
productImage={slot(
"product",
__studioImagedd7ba8d2,
)}
unit="Pouch"
unitPlural="Pouches"
tiers={[
{ id: "one", quantity: 1, price: "$39", note: "30 morning scoops" },
{ id: "three", quantity: 3, price: "$99", note: "$33 a pouch" },
{ id: "six", quantity: 6, price: "$179", note: "$29.83 a pouch", tag: "Best value" },
]}
gifts={[
{ id: "shaker", name: "Steel Shaker Bottle", unlockAt: 3, value: "$14", spot: gift },
{ id: "recipes", name: "Morning Recipe Cards", unlockAt: 6, value: "$12", spot: book },
{ id: "planner", name: "30-Day Habit Planner", unlockAt: 6, value: "$9", spot: calendar },
]}
defaultTierId="three"
reassurance={defaults.sample.guarantee}
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalQuantityBreaks4 |
React.ReactNode |
Default "Stock up and unlock every free gift"
|
highlight OptionalQuantityBreaks4 |
string |
Default "unlock every free gift"
|
punch OptionalQuantityBreaks4 |
string[] |
Default DEFAULT_PUNCH
|
productName OptionalQuantityBreaks4 |
string |
Default "Oakroot Greens Powder"
|
productImage OptionalQuantityBreaks4 |
string |
|
unit OptionalQuantityBreaks4 |
string |
Default "Pouch"
|
unitPlural OptionalQuantityBreaks4 |
string |
|
tiers OptionalQuantityBreaks4 |
QuantityBreaks4Tier[] |
Default DEFAULT_TIERS
|
gifts OptionalQuantityBreaks4 |
QuantityBreaks4Gift[] |
Default DEFAULT_GIFTS
|
defaultTierId OptionalQuantityBreaks4 |
string |
|
reassurance OptionalQuantityBreaks4 |
string |
Default "30-day money-back guarantee"
|
copy OptionalQuantityBreaks4 |
Partial<QuantityBreaks4Copy> |
|
state OptionalQuantityBreaks4 |
QuantityBreaks4State |
Default "default"
|
onSubmit OptionalQuantityBreaks4 |
(selection: QuantityBreaks4Selection) => void | Promise<void> |
|
className OptionalQuantityBreaks4 |
string |
|
style OptionalQuantityBreaks4 |
React.CSSProperties |
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.
--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-focus- 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).
-
321240b3188e2da4.webp
image/webp · 18.7 KB
-
592b880101f6444b.webp
image/webp · 18.7 KB
-
63571cb07acc4626.webp
image/webp · 17.3 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
bc3d360c88eeac0e.webp
image/webp · 23.9 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB