Quantity Breaks 3
Quantity breaks on a number rail: each pack names the life it fits, its price is supplied, the per-unit price and saving are computed, and the button names the chosen pack.
Use it in a prompt
Use offer/quantity-breaks-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/quantity-breaks-3.tsx. - Import it and pass your copy and images (Props tab):
import { QuantityBreaks3 } from "@/components/funneldna/offer/quantity-breaks-3"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/quantity-breaks-3/component.tsx 720 lines
// layout: number-rail
// Quantity breaks on a number rail: each pack names the life it fits, its price is supplied, the per-unit price and saving are computed, and the button names the chosen pack.
import * as React from "react"
import { AlertCircle, Check, Loader2, ShieldCheck } from "lucide-react"
export type QuantityBreaks3Tier = {
id: string
/** Units in the pack; drives the rail numeral and the computed per-unit price. */
quantity: number
/** Names the life this pack fits, e.g. "The desk bottle". */
title: string
/** One future-pacing line about the day it fits. */
life?: string
/** Short pack name the button uses, e.g. "gym-bag pair". Falls back to the title. */
pack?: string
/** Supplied total price, e.g. "$58". */
price: string
/** Lifestyle photo of this use (slot item-n). */
image?: string
imageAlt?: string
/** Flag such as "Best value"; shown only when supplied. */
tag?: string
}
export type QuantityBreaks3Copy = {
/** Word set before every price. */
just: string
/** Per-unit line; {unitPrice} and {unit}. */
perUnit: string
/** Saving line; {saving}, {quantity} and {units}. */
saving: string
/** Button label; {pack}. */
cta: string
/** Button sub-line; {price} and {quantity}. */
ctaSub: string
loading: string
error: string
psLabel: string
}
export type QuantityBreaks3State = "default" | "hover" | "active" | "disabled" | "error"
export type QuantityBreaks3Props = {
heading?: string
/** Phrase inside the heading that gets the marker stroke. */
headingMark?: string
lead?: string
/** Singular unit word, e.g. "bottle". */
unit?: string
unitPlural?: string
tiers?: QuantityBreaks3Tier[]
defaultTierId?: string
copy?: Partial<QuantityBreaks3Copy>
/** One reassurance line under the button; hidden when empty. */
reassurance?: string
/** P.S. restating the guarantee or main benefit; hidden when empty. */
ps?: string
/** Radio group name. */
name?: string
state?: QuantityBreaks3State
/** Receives the chosen tier. The builder wires what happens next. */
onSubmit?: (tier: QuantityBreaks3Tier) => void | Promise<void>
className?: string
}
const DEFAULT_COPY: QuantityBreaks3Copy = {
just: "Just",
perUnit: "{unitPrice} per {unit}",
saving: "Save {saving} vs. buying {quantity} separately",
cta: "Send me the {pack}",
ctaSub: "{price} today",
loading: "Adding your pack…",
error: "We couldn’t add that pack. Please try again.",
psLabel: "P.S.",
}
const DEFAULT_TIERS: QuantityBreaks3Tier[] = [
{
id: "solo",
quantity: 1,
title: "The desk bottle",
life: "Cold water within reach from the first meeting to the last email.",
pack: "desk bottle",
price: "$34",
},
{
id: "pair",
quantity: 2,
title: "The gym-bag pair",
life: "One rides in your bag, one goes to the friend who trains with you.",
pack: "gym-bag pair",
price: "$58",
},
{
id: "family",
quantity: 4,
title: "The family table",
life: "A bottle at every seat for school runs, weekend hikes and dinner.",
pack: "family four",
price: "$104",
},
]
export function QuantityBreaks3({
heading = "One for you, two to share, four for the table",
headingMark = "two to share",
lead = "Pick the pack that fits your days. The more of your life it covers, the less each one costs.",
unit = "bottle",
unitPlural,
tiers = DEFAULT_TIERS,
defaultTierId,
copy,
reassurance = "",
ps = "",
name,
state = "default",
onSubmit,
className,
}: QuantityBreaks3Props) {
const text = { ...DEFAULT_COPY, ...copy }
const plural = unitPlural ?? unit + "s"
const uid = React.useId()
const group = name ?? "qb3" + uid
const headingId = uid + "-heading"
const rows = React.useMemo(() => computeRows(tiers), [tiers])
const [selectedId, setSelectedId] = React.useState(defaultTierId ?? (tiers[0] ? tiers[0].id : ""))
const [status, setStatus] = React.useState<"idle" | "loading" | "error">("idle")
const mounted = React.useRef(true)
React.useEffect(() => {
mounted.current = true
return () => {
mounted.current = false
}
}, [])
if (!rows.length) return null
const selected = rows.find((r) => r.tier.id === selectedId) ?? rows[0]
const disabled = state === "disabled"
const shown = state === "error" ? "error" : status
const force = state === "hover" || state === "active" ? state : undefined
const pack = selected.tier.pack ?? selected.tier.title
async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault()
if (disabled || status === "loading" || !onSubmit) return
setStatus("loading")
try {
await onSubmit(selected.tier)
if (mounted.current) setStatus("idle")
} catch {
if (mounted.current) setStatus("error")
}
}
return (
<section
className={"cf-quantity-breaks-3" + (className ? " " + className : "")}
data-force={force}
data-disabled={disabled || undefined}
aria-labelledby={headingId}
>
<style>{CSS}</style>
<div className="qb3-wrap">
<header className="qb3-head">
<h2 id={headingId} className="qb3-h2">
{withMark(heading, headingMark)}
</h2>
{lead ? <p className="qb3-lead">{lead}</p> : null}
</header>
<form className="qb3-form" onSubmit={handleSubmit} noValidate aria-busy={shown === "loading" || undefined}>
<fieldset className="qb3-list" aria-labelledby={headingId} disabled={disabled}>
{rows.map((row, i) => {
const t = row.tier
const id = uid + "-" + i
const units = t.quantity === 1 ? unit : plural
const described = [t.life ? id + "-life" : "", id + "-price"].filter(Boolean).join(" ")
return (
<label
key={t.id}
className="qb3-row"
data-img={t.image ? "" : undefined}
style={{ ["--i" as string]: i } as React.CSSProperties}
>
<input
className="qb3-input"
type="radio"
name={group}
value={t.id}
checked={selected.tier.id === t.id}
onChange={() => {
setSelectedId(t.id)
setStatus("idle")
}}
aria-labelledby={id + "-title"}
aria-describedby={described}
/>
<span className="qb3-num" aria-hidden="true">
{t.quantity}
</span>
<span className="qb3-card">
{t.image ? (
<img
className="qb3-photo"
src={t.image}
alt={t.imageAlt ?? ""}
width={640}
height={480}
loading="lazy"
decoding="async"
/>
) : null}
<span className="qb3-titleline">
<span className="qb3-dot" aria-hidden="true">
<Check size={16} strokeWidth={3} />
</span>
<span className="qb3-num-inline" aria-hidden="true">
{t.quantity}
</span>
<span className="qb3-title" id={id + "-title"}>
{t.title}
</span>
{t.tag ? <span className="qb3-tag">{t.tag}</span> : null}
</span>
{t.life ? (
<span className="qb3-life" id={id + "-life"}>
{t.life}
</span>
) : null}
<span className="qb3-pricing" id={id + "-price"}>
<span className="qb3-price">
<span className="qb3-just">{text.just}</span> {t.price}
</span>
{row.unitPrice ? (
<span className="qb3-unit">{fill(text.perUnit, { unitPrice: row.unitPrice, unit })}</span>
) : null}
{row.saving ? (
<span className="qb3-save">
{fill(text.saving, { saving: row.saving, quantity: t.quantity, units })}
</span>
) : null}
</span>
</span>
</label>
)
})}
</fieldset>
<div className="qb3-close">
<button type="submit" className="qb3-cta" disabled={disabled}>
<span className="qb3-cta-label">
{shown === "loading" ? (
<>
<Loader2 className="qb3-spin" size={20} strokeWidth={2.5} aria-hidden="true" />
{text.loading}
</>
) : (
fill(text.cta, { pack })
)}
</span>
<span className="qb3-cta-sub">
{fill(text.ctaSub, { price: selected.tier.price, quantity: selected.tier.quantity })}
</span>
</button>
{shown === "error" ? (
<p className="qb3-error" role="alert">
<AlertCircle className="qb3-icon" size={18} strokeWidth={2.5} aria-hidden="true" />
{text.error}
</p>
) : null}
{reassurance ? (
<p className="qb3-assure">
<ShieldCheck className="qb3-icon qb3-icon-ok" size={18} strokeWidth={2.5} aria-hidden="true" />
{reassurance}
</p>
) : null}
{ps ? (
<p className="qb3-ps">
<strong>{text.psLabel}</strong> {ps}
</p>
) : null}
</div>
</form>
</div>
</section>
)
}
export default QuantityBreaks3
type Money = { prefix: string; suffix: string; n: number; decimals: boolean }
type Row = { tier: QuantityBreaks3Tier; unitPrice: string | null; saving: string | null }
function isDigit(c: string) {
return c >= "0" && c <= "9"
}
function parseMoney(raw: string): Money | null {
const s = raw.trim()
let i = 0
while (i < s.length && !isDigit(s[i])) i++
let j = i
while (j < s.length && (isDigit(s[j]) || s[j] === "," || s[j] === ".")) j++
if (i === j) return null
const numText = s.slice(i, j).split(",").join("")
const n = Number(numText)
if (!Number.isFinite(n)) return null
return { prefix: s.slice(0, i), suffix: s.slice(j), n, decimals: numText.includes(".") }
}
function formatMoney(n: number, ref: Money) {
const whole = Math.abs(n - Math.round(n)) < 0.005
const digits = whole && !ref.decimals ? 0 : 2
return ref.prefix + n.toLocaleString("en-US", { minimumFractionDigits: digits, maximumFractionDigits: digits }) + ref.suffix
}
function computeRows(tiers: QuantityBreaks3Tier[]): Row[] {
const parsed = tiers.map((tier) => ({ tier, money: tier.quantity > 0 ? parseMoney(tier.price) : null }))
const base = parsed.filter((p) => p.money).sort((a, b) => a.tier.quantity - b.tier.quantity)[0]
const baseMoney = base ? base.money : null
return parsed.map(({ tier, money }) => {
if (!money || tier.quantity <= 1) return { tier, unitPrice: null, saving: null }
const unitPrice = formatMoney(money.n / tier.quantity, money)
let saving: string | null = null
if (base && baseMoney && base.tier !== tier && baseMoney.prefix === money.prefix && baseMoney.suffix === money.suffix) {
const diff = (baseMoney.n / base.tier.quantity) * tier.quantity - money.n
if (diff >= 0.01) saving = formatMoney(diff, money)
}
return { tier, unitPrice, saving }
})
}
function fill(template: string, vars: Record<string, string | number>) {
let out = template
for (const key of Object.keys(vars)) out = out.split("{" + key + "}").join(String(vars[key]))
return out
}
function withMark(heading: string, mark?: string): React.ReactNode {
if (!mark) return heading
const at = heading.indexOf(mark)
if (at < 0) return heading
return (
<>
{heading.slice(0, at)}
<span className="qb3-mark">{mark}</span>
{heading.slice(at + mark.length)}
</>
)
}
const CSS = `
.cf-quantity-breaks-3 {
--qb3-shadow: var(--shadow, oklch(0.22 0.03 260));
--qb3-rail: clamp(5.5rem, 10vw, 9rem);
--qb3-gap: clamp(16px, 3vw, 40px);
box-sizing: border-box;
color: var(--ink, #1f2937);
font-family: var(--font-body);
padding: clamp(24px, 4vw, 48px) clamp(16px, 5vw, 48px);
overflow-x: clip;
}
.cf-quantity-breaks-3 *, .cf-quantity-breaks-3 *::before, .cf-quantity-breaks-3 *::after { box-sizing: border-box; }
.cf-quantity-breaks-3 .qb3-wrap { max-width: 1120px; margin: 0 auto; }
.cf-quantity-breaks-3 .qb3-head { margin: 0 0 clamp(32px, 4vw, 48px); }
.cf-quantity-breaks-3 .qb3-h2 {
margin: 0 0 16px;
font-family: var(--font-display);
font-weight: var(--display-weight, 800);
font-size: clamp(2rem, 3.6vw, 3.25rem);
line-height: 1.06;
letter-spacing: var(--display-tracking, -0.025em);
text-transform: var(--display-case, none);
text-wrap: balance;
color: var(--ink);
}
.cf-quantity-breaks-3 .qb3-mark {
background: linear-gradient(to bottom, transparent 55%, var(--marker, #fae37c) 55%, var(--marker, #fae37c) 92%, transparent 92%);
-webkit-box-decoration-break: clone;
box-decoration-break: clone;
padding: 0 0.06em;
border-radius: 2px 6px 3px 5px;
}
.cf-quantity-breaks-3 .qb3-lead {
margin: 0;
max-width: 60ch;
font-size: clamp(1.125rem, 1.5vw, 1.375rem);
line-height: 1.4;
font-weight: 500;
color: var(--muted);
text-wrap: pretty;
}
.cf-quantity-breaks-3 .qb3-form { margin: 0; }
.cf-quantity-breaks-3 .qb3-list { margin: 0; padding: 0; border: 0; min-inline-size: 0; display: grid; gap: 16px; }
.cf-quantity-breaks-3 .qb3-row {
position: relative;
display: grid;
grid-template-columns: var(--qb3-rail) minmax(0, 1fr);
column-gap: var(--qb3-gap);
align-items: center;
cursor: pointer;
animation: qb3-rise 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
animation-delay: min(calc(var(--i, 0) * 0.07s), 0.28s);
}
.cf-quantity-breaks-3 .qb3-input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.cf-quantity-breaks-3 .qb3-num,
.cf-quantity-breaks-3 .qb3-num-inline {
font-family: var(--font-display);
font-weight: var(--display-weight, 800);
font-variant-numeric: tabular-nums;
letter-spacing: -0.04em;
color: transparent;
-webkit-text-stroke: 2px var(--muted);
paint-order: stroke fill;
user-select: none;
transition: color 0.16s ease, -webkit-text-stroke-color 0.16s ease, transform 0.16s ease;
}
.cf-quantity-breaks-3 .qb3-num {
display: block;
text-align: center;
font-size: clamp(5rem, 9.5vw, 8.5rem);
line-height: 0.82;
transform-origin: center;
}
.cf-quantity-breaks-3 .qb3-num-inline {
display: none;
font-size: 2.5rem;
line-height: 0.9;
-webkit-text-stroke-width: 1.5px;
}
@supports not (-webkit-text-stroke: 1px var(--muted)) {
.cf-quantity-breaks-3 .qb3-num, .cf-quantity-breaks-3 .qb3-num-inline { color: var(--muted); }
}
.cf-quantity-breaks-3:not([data-disabled]) .qb3-row:hover .qb3-input:not(:checked) ~ .qb3-num,
.cf-quantity-breaks-3:not([data-disabled]) .qb3-row:hover .qb3-input:not(:checked) ~ .qb3-card .qb3-num-inline {
-webkit-text-stroke-color: var(--ink);
}
.cf-quantity-breaks-3 .qb3-input:checked ~ .qb3-num,
.cf-quantity-breaks-3 .qb3-input:checked ~ .qb3-card .qb3-num-inline {
color: var(--cta);
-webkit-text-stroke-color: oklch(from var(--cta) calc(l - 0.14) c h);
}
.cf-quantity-breaks-3 .qb3-input:checked ~ .qb3-num { transform: scale(1.04); }
.cf-quantity-breaks-3 .qb3-card {
position: relative;
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
grid-template-areas: "head pricing" "life pricing";
column-gap: clamp(16px, 2.5vw, 32px);
row-gap: 8px;
align-items: center;
min-width: 0;
padding: clamp(16px, 2vw, 20px) clamp(20px, 3vw, 32px);
background: var(--card, #ffffff);
color: var(--ink);
border: 1px solid var(--card-border, oklch(from var(--ink) 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(--qb3-shadow) l c h / 0.22), 0 4px 10px -2px oklch(from var(--qb3-shadow) l c h / 0.2)));
transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}
.cf-quantity-breaks-3 .qb3-row[data-img] .qb3-card {
grid-template-columns: clamp(140px, 20vw, 240px) minmax(0, 1fr) auto;
grid-template-areas: "photo head pricing" "photo life pricing";
padding-left: clamp(12px, 1.4vw, 16px);
}
.cf-quantity-breaks-3 .qb3-photo {
grid-area: photo;
display: block;
width: 100%;
height: auto;
aspect-ratio: 4 / 3;
object-fit: cover;
object-position: center;
border-radius: 10px;
}
.cf-quantity-breaks-3 .qb3-titleline {
grid-area: head;
align-self: end;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px 12px;
min-width: 0;
}
.cf-quantity-breaks-3 .qb3-dot {
flex: none;
display: inline-grid;
place-items: center;
width: 26px;
height: 26px;
border-radius: 999px;
background: var(--card, #ffffff);
border: 2px solid oklch(from var(--ink) l c h / 0.3);
color: var(--accent-fill-ink, var(--card));
transition: background-color 0.16s ease, border-color 0.16s ease;
}
.cf-quantity-breaks-3 .qb3-dot svg { opacity: 0; transform: scale(0.6); transition: opacity 0.16s ease, transform 0.16s ease; }
.cf-quantity-breaks-3 .qb3-input:checked ~ .qb3-card .qb3-dot {
background: var(--accent-fill, var(--accent));
border-color: var(--accent-fill, var(--accent));
}
.cf-quantity-breaks-3 .qb3-input:checked ~ .qb3-card .qb3-dot svg { opacity: 1; transform: none; }
.cf-quantity-breaks-3 .qb3-title {
min-width: 0;
font-family: var(--font-display);
font-weight: 800;
font-size: clamp(1.3125rem, 1.8vw, 1.625rem);
line-height: 1.15;
letter-spacing: -0.01em;
text-wrap: balance;
}
.cf-quantity-breaks-3 .qb3-tag {
display: inline-flex;
align-items: center;
min-height: 28px;
padding: 4px 12px;
border-radius: 999px;
background: var(--accent-fill, var(--accent));
color: var(--accent-fill-ink, var(--card));
font-size: 0.875rem;
font-weight: 800;
line-height: 1.2;
white-space: nowrap;
animation: qb3-pop 0.3s ease both;
}
.cf-quantity-breaks-3 .qb3-life {
grid-area: life;
align-self: start;
max-width: 52ch;
font-size: clamp(1.0625rem, 1.25vw, 1.125rem);
line-height: 1.5;
color: var(--muted);
text-wrap: pretty;
}
.cf-quantity-breaks-3 .qb3-pricing {
grid-area: pricing;
display: grid;
justify-items: end;
text-align: right;
gap: 4px;
}
.cf-quantity-breaks-3 .qb3-price {
margin-bottom: 8px;
font-family: var(--font-display);
font-weight: 800;
font-size: clamp(1.75rem, 2.6vw, 2.375rem);
line-height: 1;
letter-spacing: -0.03em;
font-variant-numeric: tabular-nums;
white-space: nowrap;
color: var(--ink);
}
.cf-quantity-breaks-3 .qb3-just { font-size: 0.55em; letter-spacing: 0; }
.cf-quantity-breaks-3 .qb3-unit { font-size: 0.9375rem; font-weight: 600; line-height: 1.4; color: var(--muted); font-variant-numeric: tabular-nums; }
.cf-quantity-breaks-3 .qb3-save { font-size: 0.9375rem; font-weight: 700; line-height: 1.4; color: var(--success); font-variant-numeric: tabular-nums; }
.cf-quantity-breaks-3:not([data-disabled]) .qb3-row:hover .qb3-card {
transform: translateY(-2px);
box-shadow: var(--shadow-lg, 0 2px 4px oklch(from var(--qb3-shadow) l c h / 0.22), 0 12px 24px -8px oklch(from var(--qb3-shadow) l c h / 0.32));
}
.cf-quantity-breaks-3 .qb3-input:checked ~ .qb3-card,
.cf-quantity-breaks-3:not([data-disabled]) .qb3-row:hover .qb3-input:checked ~ .qb3-card {
border-color: var(--accent);
background: color-mix(in oklch, var(--accent) 6%, var(--card));
box-shadow: 0 0 0 1px var(--accent), var(--shadow-lg, 0 2px 4px oklch(from var(--qb3-shadow) l c h / 0.22), 0 12px 24px -8px oklch(from var(--qb3-shadow) l c h / 0.32));
}
.cf-quantity-breaks-3 .qb3-input:focus-visible ~ .qb3-card {
outline: 3px solid var(--field-focus, var(--accent));
outline-offset: 3px;
}
.cf-quantity-breaks-3[data-disabled] .qb3-row { cursor: not-allowed; }
.cf-quantity-breaks-3[data-disabled] .qb3-card { box-shadow: var(--shadow-sm, 0 1px 2px oklch(from var(--qb3-shadow) l c h / 0.18)); }
.cf-quantity-breaks-3 .qb3-close {
margin: clamp(40px, 5vw, 56px) 0 0 calc(var(--qb3-rail) + var(--qb3-gap));
display: grid;
justify-items: center;
text-align: center;
gap: 16px;
}
.cf-quantity-breaks-3 .qb3-cta {
appearance: none;
border: 0;
cursor: pointer;
display: inline-flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 4px;
min-height: 72px;
width: min(100%, 440px);
max-width: 100%;
margin-inline: auto;
padding: 12px 28px;
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);
text-align: center;
color: var(--button-ink, var(--cta-ink, #ffffff));
text-shadow: var(--button-text-shadow, none);
background: linear-gradient(oklch(from var(--button-bg, var(--cta)) calc(l + 0.04) c h), oklch(from var(--button-bg-2, var(--cta-2)) calc(l - 0.02) c h));
box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l + 0.14) c h / 0.7), inset 0 -3px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--qb3-shadow) l c h / 0.3), 0 8px 16px -6px oklch(from var(--qb3-shadow) l c h / 0.45));
transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.cf-quantity-breaks-3 .qb3-cta:hover:not(:disabled),
.cf-quantity-breaks-3[data-force="hover"] .qb3-cta:not(:disabled) {
background: linear-gradient(oklch(from var(--button-bg, var(--cta)) calc(l - 0.01) c h), oklch(from var(--button-bg-2, var(--cta-2)) calc(l - 0.07) c h));
box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l + 0.1) c h / 0.6), inset 0 -3px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.2) c h), 0 1px 2px oklch(from var(--qb3-shadow) l c h / 0.32), 0 10px 20px -6px oklch(from var(--qb3-shadow) l c h / 0.52));
}
.cf-quantity-breaks-3 .qb3-cta:active:not(:disabled),
.cf-quantity-breaks-3[data-force="active"] .qb3-cta:not(:disabled) {
transform: translateY(1px);
background: linear-gradient(oklch(from var(--button-bg, var(--cta)) calc(l - 0.05) c h), oklch(from var(--button-bg-2, var(--cta-2)) calc(l - 0.08) c h));
box-shadow: inset 0 2px 4px oklch(from var(--button-bg, var(--cta)) calc(l - 0.22) c h / 0.6), inset 0 -2px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--qb3-shadow) l c h / 0.3);
}
.cf-quantity-breaks-3 .qb3-cta:focus-visible { outline: 3px solid var(--field-focus, var(--accent)); outline-offset: 3px; }
.cf-quantity-breaks-3 .qb3-cta:disabled {
cursor: not-allowed;
background: var(--button-2-bg, var(--secondary));
color: var(--button-2-ink, var(--secondary-ink));
box-shadow: var(--button-2-shadow, var(--shadow-sm));
text-shadow: none;
transform: none;
}
.cf-quantity-breaks-3 .qb3-cta-label {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
font-size: clamp(1.125rem, 1.55vw, 1.375rem);
line-height: 1.15;
}
.cf-quantity-breaks-3 .qb3-cta-sub {
font-family: var(--font-body);
font-size: 0.9375rem;
font-weight: 600;
line-height: 1.3;
text-transform: none;
text-wrap: pretty;
}
.cf-quantity-breaks-3 .qb3-spin { flex: none; animation: qb3-spin 0.8s linear infinite; }
.cf-quantity-breaks-3 .qb3-icon { display: inline-block; vertical-align: -0.2em; margin-inline-end: 0.4em; }
.cf-quantity-breaks-3 .qb3-icon-ok { color: var(--success); }
.cf-quantity-breaks-3 .qb3-error { margin: 0; font-size: 0.9375rem; font-weight: 600; line-height: 1.4; color: var(--danger); text-wrap: pretty; }
.cf-quantity-breaks-3 .qb3-assure { margin: 0; font-size: 0.9375rem; font-weight: 600; line-height: 1.4; color: var(--muted); text-wrap: pretty; }
.cf-quantity-breaks-3 .qb3-ps {
margin: 8px auto 0;
max-width: 58ch;
font-size: clamp(1.0625rem, 1.25vw, 1.125rem);
line-height: 1.5;
color: var(--ink);
text-wrap: pretty;
}
.cf-quantity-breaks-3 .qb3-ps strong { font-weight: 800; }
@keyframes qb3-rise { from { opacity: 0.82; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes qb3-pop { from { transform: scale(0.9); } to { transform: none; } }
@keyframes qb3-spin { to { transform: rotate(360deg); } }
@media (max-width: 720px) {
.cf-quantity-breaks-3 .qb3-list { gap: 12px; }
.cf-quantity-breaks-3 .qb3-row { grid-template-columns: minmax(0, 1fr); }
.cf-quantity-breaks-3 .qb3-num { display: none; }
.cf-quantity-breaks-3 .qb3-num-inline { display: inline-block; }
.cf-quantity-breaks-3 .qb3-card,
.cf-quantity-breaks-3 .qb3-row[data-img] .qb3-card {
grid-template-columns: minmax(0, 1fr);
grid-template-areas: "head" "life" "pricing";
column-gap: 12px;
row-gap: 8px;
padding: 16px;
}
.cf-quantity-breaks-3 .qb3-row[data-img] .qb3-card {
grid-template-columns: 72px minmax(0, 1fr);
grid-template-areas: "photo head" "life life" "pricing pricing";
}
.cf-quantity-breaks-3 .qb3-photo { width: 72px; aspect-ratio: 1 / 1; border-radius: 8px; align-self: start; }
.cf-quantity-breaks-3 .qb3-titleline { align-self: start; gap: 6px 10px; }
.cf-quantity-breaks-3 .qb3-num-inline { order: 1; font-size: 2.5rem; -webkit-text-stroke-width: 2px; }
.cf-quantity-breaks-3 .qb3-dot { order: 2; margin-left: auto; align-self: start; }
.cf-quantity-breaks-3 .qb3-title { order: 3; flex: 1 0 100%; text-wrap: pretty; }
.cf-quantity-breaks-3 .qb3-tag { order: 4; }
.cf-quantity-breaks-3 .qb3-pricing {
display: flex;
flex-wrap: wrap;
align-items: baseline;
justify-content: flex-start;
text-align: left;
column-gap: 12px;
row-gap: 4px;
padding-top: 4px;
}
.cf-quantity-breaks-3 .qb3-price { flex-basis: 100%; margin-bottom: 8px; }
.cf-quantity-breaks-3 .qb3-close { margin-left: 0; justify-items: stretch; }
.cf-quantity-breaks-3 .qb3-cta { width: 100%; min-width: 0; padding: 12px 20px; }
}
@media (prefers-reduced-motion: reduce) {
.cf-quantity-breaks-3 .qb3-row,
.cf-quantity-breaks-3 .qb3-tag,
.cf-quantity-breaks-3 .qb3-spin { animation: none; }
.cf-quantity-breaks-3 .qb3-card,
.cf-quantity-breaks-3 .qb3-cta,
.cf-quantity-breaks-3 .qb3-num,
.cf-quantity-breaks-3 .qb3-num-inline,
.cf-quantity-breaks-3 .qb3-dot,
.cf-quantity-breaks-3 .qb3-dot svg { transition: none; }
.cf-quantity-breaks-3:not([data-disabled]) .qb3-row:hover .qb3-card,
.cf-quantity-breaks-3 .qb3-input:checked ~ .qb3-num,
.cf-quantity-breaks-3 .qb3-cta:active:not(:disabled),
.cf-quantity-breaks-3[data-force="active"] .qb3-cta:not(:disabled) { transform: none; }
}
`
pieces/offer/quantity-breaks-3/specimen.tsx 72 lines
import __studioImageb92c4b7c from "../assets/44701363d47bb187.webp";
import __studioImage11d31bc3 from "../assets/287690f76f90d1ae.webp";
import __studioImage5fa0d6c6 from "../assets/b1cf4edaa0e936f5.webp";
import * as React from "react"
import { QuantityBreaks3, type QuantityBreaks3State } from "../quantity-breaks-3"
import defaults from "../../studio-defaults.json"
import { slot } from "../../slots"
export const states = ["default", "hover", "active", "disabled", "error"]
export default function QuantityBreaks3Specimen({ state }: { state?: QuantityBreaks3State }) {
const tiers = [
{
id: "solo",
quantity: 1,
title: "The desk bottle",
life: "Cold water within reach from the first meeting to the last email.",
pack: "desk bottle",
price: "$34",
image: slot(
"item-1",
__studioImageb92c4b7c
),
imageAlt: "One Summit insulated bottle on a work desk beside a laptop",
},
{
id: "pair",
quantity: 2,
title: "The gym-bag pair",
life: "One rides in your bag, one goes to the friend who trains with you.",
pack: "gym-bag pair",
price: "$58",
image: slot(
"item-2",
__studioImage11d31bc3
),
imageAlt: "Two Summit insulated bottles packed in a gym bag",
},
{
id: "family",
quantity: 4,
title: "The family table",
life: "A bottle at every seat for school runs, weekend hikes and dinner.",
pack: "family four",
price: "$104",
tag: "Best value",
image: slot(
"item-3",
__studioImage5fa0d6c6
),
imageAlt: "Four Summit insulated bottles set at each seat of a family dinner table",
},
]
return (
<QuantityBreaks3
heading="One for you, two to share, four for the table"
headingMark="two to share"
lead="Pick the Summit insulated bottle pack that fits your days. The more of your life it covers, the less each bottle costs."
unit="bottle"
unitPlural="bottles"
tiers={tiers}
defaultTierId="pair"
copy={{ ctaSub: "{price} today · Secure checkout" }}
reassurance={"Backed by our " + defaults.sample.guarantee}
ps={"Whichever pack you pick, you’re covered by our " + defaults.sample.guarantee + ". Live with it for a month; if it isn’t your everyday bottle, you get your money back."}
state={state}
onSubmit={() => undefined}
/>
)
}
| Name | Type | Details |
|---|---|---|
heading OptionalQuantityBreaks3 |
string |
Default "One for you, two to share, four for the table"
|
headingMark OptionalQuantityBreaks3 |
string |
Default "two to share"
|
lead OptionalQuantityBreaks3 |
string |
Default "Pick the pack that fits your days. The more of your life it covers, the less each one costs."
|
unit OptionalQuantityBreaks3 |
string |
Default "bottle"
|
unitPlural OptionalQuantityBreaks3 |
string |
|
tiers OptionalQuantityBreaks3 |
QuantityBreaks3Tier[] |
Default DEFAULT_TIERS
|
defaultTierId OptionalQuantityBreaks3 |
string |
|
copy OptionalQuantityBreaks3 |
Partial<QuantityBreaks3Copy> |
|
reassurance OptionalQuantityBreaks3 |
string |
Default ""
|
ps OptionalQuantityBreaks3 |
string |
Default ""
|
name OptionalQuantityBreaks3 |
string |
|
state OptionalQuantityBreaks3 |
QuantityBreaks3State |
Default "default"
|
onSubmit OptionalQuantityBreaks3 |
(tier: QuantityBreaks3Tier) => void | Promise<void> |
|
className OptionalQuantityBreaks3 |
string |
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-bg--button-2-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.
item-1- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-2- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-3- One image per offer item (item-1, item-2…), shown in stacks and lists.
-
287690f76f90d1ae.webp
image/webp · 114 KB
-
44701363d47bb187.webp
image/webp · 28 KB
-
b1cf4edaa0e936f5.webp
image/webp · 45.2 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB