Bundle Picker 9
Dark-stage package picker: 1, 3 and 6 units compared column by column with ticks and crosses, so the bigger box
Use it in a prompt
Use offer/bundle-picker-9 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/bundle-picker-9.tsx. - Import it and pass your copy and images (Props tab):
import { BundlePicker9 } from "@/components/funneldna/offer/bundle-picker-9"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/bundle-picker-9/component.tsx 814 lines
// layout: comparison-columns
// Dark-stage package picker: 1, 3 and 6 units compared column by column with ticks and crosses, so the bigger box
// sells itself on price per unit. Savings come only from the supplied prices; the chosen column drives the send-it button.
'use client'
import * as React from 'react'
import { AlertCircle, Check, Loader2, Lock, X } from 'lucide-react'
// Official payment-network marks keep their brand colours (theme-contract §3 exception).
import { AmericanExpress, Discover, Mastercard, Visa } from 'react-svg-credit-card-payment-icons/icons/flat-rounded'
export type StagePackage = {
/** Number of units in the package, e.g. 1, 3, 6. */
units: number
/** Total price of the package in the chosen currency. */
price: number
/** Cut-out shot of this exact package (one bottle, three, six) on a transparent background. */
image?: string
/** Alt text for the package image; defaults to the copy.imageAlt template. */
imageAlt?: string
/** Value passed back for this package; defaults to the unit count. */
id?: string
}
/** An extra supplied comparison row: one tick or cross per package, in package order. */
export type StageRow = { label: string; included: boolean[] }
/** Facts about the selected package, passed to a function buttonLabel. */
export type StageContext = {
units: number
unitWord: string
total: string
perUnit: string
savings: string
percent: number
}
export type BundlePicker9State = 'default' | 'hover' | 'active' | 'disabled' | 'error'
/** Templates use named placeholders: {units}, {unit}, {unitWord}, {total}, {perUnit}, {compare}, {savings}, {percent}, {base}, {bestUnits}, {bestPer}, {guarantee}. */
export type BundlePicker9Copy = typeof DEFAULT_COPY
export type BundlePicker9Props = {
headline?: string
/** Phrase inside the headline set in the warm metal colour. */
highlight?: string
/** Supporting line under the headline. */
lead?: string
/** Packages compared column by column, in display order. */
packages?: StagePackage[]
/** Unit words for one and many, e.g. Bottle / Bottles. */
unit?: { one: string; other: string }
/** Index selected on load; defaults to the best-value package. Pass -1 to start with none. */
defaultSelected?: number
/** ISO currency code for all prices. */
currency?: string
/** Locale used to format prices. */
locale?: string
/** Template ({units}, {unitWord}, {total}, {perUnit}) or a function of the selected package. */
buttonLabel?: string | ((ctx: StageContext) => string)
/** Button text while onSubmit is pending. */
loadingLabel?: string
/** Badge on the lowest price-per-unit column. */
bestValueLabel?: string
/** Supplied guarantee; shown as a ticked row in every column. Empty hides it. */
guarantee?: string
secureLabel?: string
showPaymentMarks?: boolean
/** Accessible names for the payment marks; default to the network name. */
paymentLabels?: Partial<Record<PaymentName, string>>
/** Extra supplied comparison rows (ticks and crosses). */
extraRows?: StageRow[]
/** Shown when onSubmit rejects. */
errorMessage?: string
state?: BundlePicker9State
/** Called when a package is chosen. */
onSelect?: (pkg: StagePackage, index: number) => void
/** Called with the selected package. A rejected promise shows the inline error. */
onSubmit?: (pkg: StagePackage, index: number) => void | Promise<void>
/** Overrides for the generated copy templates. */
copy?: Partial<BundlePicker9Copy>
className?: string
style?: React.CSSProperties
}
type PaymentName = 'Visa' | 'Mastercard' | 'American Express' | 'Discover'
type Status = 'idle' | 'loading' | 'error' | 'choose'
type Compare = { yes: boolean; label: string }
export function BundlePicker9(props: BundlePicker9Props) {
const {
headline = 'Pick your supply. The more you take, the less each bottle costs.',
highlight = 'the less each bottle costs',
lead = 'Choose one package. Your price per bottle drops as the box gets bigger.',
packages = DEFAULT_PACKAGES,
unit = { one: 'Bottle', other: 'Bottles' },
defaultSelected,
currency = 'USD',
locale = 'en-US',
buttonLabel = 'Rush Me {units} {unitWord}',
loadingLabel = 'Sending your order…',
bestValueLabel = 'Best value',
guarantee = '30-day money-back guarantee',
secureLabel = 'Secure checkout',
showPaymentMarks = true,
paymentLabels,
extraRows = [],
errorMessage = 'We couldn’t add that to your order. Please try again.',
state,
onSelect,
onSubmit,
copy,
className,
style,
} = props
const text = { ...DEFAULT_COPY, ...copy }
const uid = React.useId()
const titleId = `${uid}-title`
const errId = `${uid}-error`
const groupName = `${uid}-package`
const unitLower = unit.one.toLowerCase()
const money = React.useCallback(
(n: number) => {
const whole = Math.abs(n - Math.round(n)) < 0.005
return new Intl.NumberFormat(locale, {
style: 'currency',
currency,
minimumFractionDigits: whole ? 0 : 2,
maximumFractionDigits: whole ? 0 : 2,
}).format(whole ? Math.round(n) : n)
},
[locale, currency]
)
const rows = React.useMemo(() => {
const valid = packages.filter((p) => p.units > 0)
const base = valid.reduce<StagePackage | undefined>((m, p) => (!m || p.units < m.units ? p : m), undefined)
const baseUnit = base ? base.price / base.units : 0
return packages.map((p) => {
const per = p.units > 0 ? p.price / p.units : p.price
const compare = baseUnit * p.units
const raw = compare - p.price
const savings = raw > 0.005 ? raw : 0
const pct = savings > 0 && compare > 0 ? Math.round((savings / compare) * 100) : 0
return { per, compare, savings, pct, baseUnit }
})
}, [packages])
const bestIndex = React.useMemo(() => {
if (rows.length < 2) return -1
const min = Math.min(...rows.map((r) => r.per))
const hits = rows.filter((r) => Math.abs(r.per - min) < 0.005)
if (hits.length !== 1 || !(min < rows[0].baseUnit - 0.005)) return -1
return rows.findIndex((r) => Math.abs(r.per - min) < 0.005)
}, [rows])
const [selected, setSelected] = React.useState(() => {
if (typeof defaultSelected === 'number') {
return defaultSelected >= 0 && defaultSelected < packages.length ? defaultSelected : -1
}
return bestIndex >= 0 ? bestIndex : 0
})
const [status, setStatus] = React.useState<Status>(state === 'error' ? 'error' : 'idle')
React.useEffect(() => {
setStatus(state === 'error' ? 'error' : 'idle')
}, [state])
const alive = React.useRef(true)
React.useEffect(() => {
alive.current = true
return () => {
alive.current = false
}
}, [])
const disabled = state === 'disabled'
const loading = status === 'loading'
const index = selected >= 0 && selected < packages.length ? selected : -1
const pkg = index >= 0 ? packages[index] : undefined
const row = index >= 0 ? rows[index] : undefined
const hasMedia = packages.some((p) => Boolean(p.image))
const wordFor = (n: number) => (n === 1 ? unit.one : unit.other)
const choose = (i: number) => {
if (disabled || loading) return
setSelected(i)
if (status !== 'idle') setStatus('idle')
onSelect?.(packages[i], i)
}
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault()
if (disabled || loading) return
if (!pkg) {
setStatus('choose')
return
}
if (!onSubmit) return
setStatus('loading')
try {
await onSubmit(pkg, index)
if (alive.current) setStatus('idle')
} catch {
if (alive.current) setStatus('error')
}
}
const ctx: StageContext | undefined =
pkg && row
? {
units: pkg.units,
unitWord: wordFor(pkg.units),
total: money(pkg.price),
perUnit: money(row.per),
savings: money(row.savings),
percent: row.pct,
}
: undefined
const label = ctx
? typeof buttonLabel === 'function'
? buttonLabel(ctx)
: formatCopy(buttonLabel, { ...ctx })
: text.emptyButton
const sublabel = ctx ? formatCopy(text.sublabel, { ...ctx, unit: unitLower }) : ''
let summaryLead = text.emptyLead
let summaryBody = formatCopy(text.emptyBody, { unit: unitLower })
if (pkg && row) {
const vals = {
units: pkg.units,
unitWord: wordFor(pkg.units).toLowerCase(),
unit: unitLower,
perUnit: money(row.per),
total: money(pkg.price),
compare: money(row.compare),
}
summaryLead = formatCopy(pkg.units === 1 ? text.summaryLeadOne : text.summaryLead, vals)
if (row.savings > 0) summaryBody = formatCopy(text.summarySave, vals)
else if (bestIndex >= 0 && bestIndex !== index)
summaryBody = formatCopy(text.summaryNudge, {
...vals,
bestUnits: packages[bestIndex].units,
bestPer: money(rows[bestIndex].per),
})
else summaryBody = formatCopy(text.summaryPlain, vals)
}
const compareRows = (i: number): Compare[] => {
const r = rows[i]
const out: Compare[] = []
if (bestIndex >= 0) out.push({ yes: i === bestIndex, label: formatCopy(text.rowBest, { unit: unitLower }) })
out.push(
r.savings > 0
? { yes: true, label: formatCopy(text.rowSave, { savings: money(r.savings), percent: r.pct }) }
: { yes: false, label: text.rowNoSave }
)
if (guarantee) out.push({ yes: true, label: guarantee })
extraRows.forEach((extra) => out.push({ yes: Boolean(extra.included[i]), label: extra.label }))
return out
}
const showAlert = status === 'error' || status === 'choose'
const btnClass = ['bp9-btn', state === 'hover' ? 'is-hover' : '', state === 'active' ? 'is-active' : '']
.filter(Boolean)
.join(' ')
return (
<form
className={['cf-bundle-picker-9', className].filter(Boolean).join(' ')}
style={style}
onSubmit={handleSubmit}
noValidate
aria-labelledby={titleId}
>
<style>{CSS}</style>
<header className='bp9-head'>
<h2 id={titleId} className='bp9-title'>
{withHighlight(headline, highlight)}
</h2>
{lead ? <p className='bp9-lead'>{lead}</p> : null}
</header>
<fieldset
className={hasMedia ? 'bp9-set' : 'bp9-set bp9-nomedia'}
disabled={disabled}
aria-describedby={status === 'choose' ? errId : undefined}
style={{ ['--bp9-n' as string]: Math.max(packages.length, 1) } as React.CSSProperties}
>
<legend className='bp9-sr'>{text.legend}</legend>
{packages.map((p, i) => {
const r = rows[i]
const on = i === index
const best = i === bestIndex
const word = wordFor(p.units)
return (
<label
key={p.id ?? `${p.units}-${i}`}
className={['bp9-opt', on ? 'is-on' : '', best ? 'is-best' : ''].filter(Boolean).join(' ')}
>
<input
className='bp9-sr bp9-radio'
type='radio'
name={groupName}
value={p.id ?? String(p.units)}
checked={on}
onChange={() => choose(i)}
/>
{best ? <span className='bp9-badge'>{bestValueLabel}</span> : null}
<span className='bp9-qty'>
<span className='bp9-dot' aria-hidden='true' />
<span className='bp9-qty-t'>{formatCopy(text.quantity, { units: p.units, unitWord: word })}</span>
</span>
{hasMedia ? (
<span className='bp9-media'>
{p.image ? (
<img
src={p.image}
alt={p.imageAlt ?? formatCopy(text.imageAlt, { units: p.units, unitWord: word })}
width={320}
height={320}
loading='lazy'
decoding='async'
/>
) : null}
</span>
) : null}
<span className='bp9-price'>
<span className='bp9-per'>
<span className='bp9-per-n'>{money(r.per)}</span>
<span className='bp9-per-u'>{formatCopy(text.perUnit, { unit: unitLower })}</span>
</span>
<span className='bp9-anchor'>
{r.savings > 0
? formatCopy(text.anchor, { base: money(r.baseUnit) })
: formatCopy(text.anchorBase, { unit: unitLower })}
</span>
<span className='bp9-total'>{formatCopy(text.total, { total: money(p.price) })}</span>
</span>
<span className='bp9-rows'>
{compareRows(i).map((c, k) => (
<span key={k} className={c.yes ? 'bp9-row is-yes' : 'bp9-row is-no'}>
<span className='bp9-ic' aria-hidden='true'>
{c.yes ? <Check /> : <X />}
</span>
<span>
{c.yes ? null : <span className='bp9-sr'>{text.notIncluded}</span>}
{c.label}
</span>
</span>
))}
</span>
</label>
)
})}
</fieldset>
<div className='bp9-deal'>
<div className='bp9-sum' aria-live='polite'>
<div key={index} className='bp9-sum-in'>
<p className='bp9-sum-main'>
<b>{summaryLead}</b> {summaryBody}
</p>
{guarantee ? (
<p>
<b>{text.guaranteeLead}</b> {formatCopy(text.guaranteeBody, { guarantee })}
</p>
) : null}
</div>
</div>
<div className='bp9-act'>
<button
type='submit'
className={btnClass}
disabled={disabled}
aria-busy={loading || undefined}
aria-describedby={showAlert ? errId : undefined}
>
<span className='bp9-btn-main'>
{loading ? <Loader2 className='bp9-spin' aria-hidden='true' /> : null}
{loading ? loadingLabel : label}
</span>
{!loading && sublabel ? <span className='bp9-btn-sub'>{sublabel}</span> : null}
</button>
{showAlert ? (
<p id={errId} className='bp9-alert' role='alert'>
<AlertCircle aria-hidden='true' />
<span>{status === 'choose' ? text.chooseError : errorMessage}</span>
</p>
) : null}
<div className='bp9-trust'>
<span className='bp9-secure'>
<Lock aria-hidden='true' />
{secureLabel}
</span>
{showPaymentMarks ? (
<ul className='bp9-cards' aria-label={text.payments}>
{PAYMENT_MARKS.map(([name, Icon]) => (
<li key={name}>
<Icon width={38} role='img' aria-label={paymentLabels?.[name] ?? name} />
</li>
))}
</ul>
) : null}
</div>
</div>
</div>
</form>
)
}
export default BundlePicker9
/** Replaces {name} placeholders with values; unknown placeholders stay as written. */
function formatCopy(template: string, vals: Record<string, string | number>) {
return template.replace(/[{]([a-zA-Z]+)[}]/g, (m: string, k: string) => (k in vals ? String(vals[k]) : m))
}
/** Wraps the first occurrence of phrase in the metal highlight span. */
function withHighlight(text: string, phrase?: string): React.ReactNode {
if (!phrase) return text
const at = text.indexOf(phrase)
if (at < 0) return text
return (
<>
{text.slice(0, at)}
<span className='bp9-hl'>{phrase}</span>
{text.slice(at + phrase.length)}
</>
)
}
const DEFAULT_PACKAGES: StagePackage[] = [
{ units: 1, price: 47, id: 'supply-1' },
{ units: 3, price: 117, id: 'supply-3' },
{ units: 6, price: 198, id: 'supply-6' },
]
const DEFAULT_COPY = {
legend: 'Choose your package',
quantity: '{units} {unitWord}',
perUnit: '/ {unit}',
anchor: 'vs. {base} one at a time',
anchorBase: 'Single-{unit} price',
total: '{total} today',
rowBest: 'Lowest price per {unit}',
rowSave: 'Save {savings} ({percent}%)',
rowNoSave: 'Bundle saving',
notIncluded: 'Not included: ',
imageAlt: '{units} {unitWord}',
summaryLead: '{units} {unitWord} at {perUnit} each.',
summaryLeadOne: '{units} {unitWord} at {perUnit}.',
summarySave: '{total} today, not {compare} buying one {unit} at a time.',
summaryNudge: '{total} today. Take {bestUnits} and pay {bestPer} a {unit}.',
summaryPlain: '{total} today.',
emptyLead: 'Pick your package above.',
emptyBody: 'Your total and price per {unit} show up here.',
guaranteeLead: 'Every package is covered.',
guaranteeBody: '{guarantee}, whichever box you pick.',
emptyButton: 'Rush My Order',
sublabel: '{total} today · {perUnit} per {unit}',
chooseError: 'Choose a package to continue.',
payments: 'Accepted cards',
}
const PAYMENT_MARKS = [
['Visa', Visa],
['Mastercard', Mastercard],
['American Express', AmericanExpress],
['Discover', Discover],
] as const
/* Every colour reads the contract tokens. Tick and cross circles are solid status badges (--success / --danger
fill, white glyph) per theme-contract §1. The hidden radio and its drawn dot read the --field role tokens (§2).
Reduced motion keeps !important: the universal reset must beat more specific transition, animation and
transform declarations (state, hover and image selectors) without duplicating each selector. */
const CSS = `
.cf-bundle-picker-9, .cf-bundle-picker-9 *, .cf-bundle-picker-9 *::before, .cf-bundle-picker-9 *::after { box-sizing: border-box; }
.cf-bundle-picker-9 {
--bp9-metal: oklch(from var(--metal, var(--marker, #fae37c)) l c h / 1);
--bp9-metal-hi: oklch(from var(--bp9-metal) calc(l + 0.03) c h);
--bp9-metal-lo: oklch(from var(--bp9-metal) calc(l - 0.13) calc(c + 0.02) h);
--bp9-metal-ink: oklch(from var(--bp9-metal) 0.25 0.05 h);
--bp9-ring: oklch(from var(--field-focus, var(--accent, #2f6fd6)) max(l, 0.76) c h);
--bp9-shade: var(--shadow, oklch(0.22 0.03 256));
--bp9-line: oklch(from var(--band-ink, #ffffff) l c h / 0.16);
--bp9-cta: var(--button-bg, var(--cta, #d6352b));
--bp9-cta-2: var(--button-bg-2, var(--cta-2, #b82a21));
--bp9-rest: var(--card-shadow, var(--shadow-md, 0 1px 2px oklch(from var(--bp9-shade) l c h / 0.22), 0 4px 10px -2px oklch(from var(--bp9-shade) l c h / 0.2)));
--bp9-lift: var(--shadow-lg, 0 2px 4px oklch(from var(--bp9-shade) l c h / 0.22), 0 12px 24px -8px oklch(from var(--bp9-shade) l c h / 0.32));
container-type: inline-size;
position: relative;
isolation: isolate;
width: 100%;
max-width: 72rem;
margin: 0 auto;
padding: clamp(24px, 4.4vw, 56px) clamp(16px, 3.6vw, 48px) clamp(20px, 3.6vw, 44px);
border-radius: calc(var(--radius, 12px) + 10px);
background: var(--band, oklch(0.27 0.067 256));
color: var(--band-ink, #ffffff);
font-family: var(--font-body, system-ui, sans-serif);
box-shadow: inset 0 1px 0 oklch(from var(--bp9-metal) l c h / 0.42), var(--bp9-lift);
}
.cf-bundle-picker-9 :where(h2, p) { margin: 0; }
.cf-bundle-picker-9 .bp9-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
/* Native radio (visually hidden; .bp9-dot draws it) reads the field role tokens. */
.cf-bundle-picker-9 .bp9-radio {
accent-color: var(--field-focus, var(--accent, #2f6fd6));
background: var(--field, #ffffff);
color: var(--field-ink, var(--ink, #1a2233));
}
.cf-bundle-picker-9 .bp9-head { display: grid; justify-items: center; text-align: center; max-width: 60rem; margin: 0 auto clamp(24px, 3.6cqi, 40px); }
.cf-bundle-picker-9 .bp9-title {
font-family: var(--font-display, inherit);
font-weight: var(--display-weight, 800);
text-transform: var(--display-case, none);
letter-spacing: var(--display-tracking, -0.022em);
font-size: clamp(2rem, 1.05rem + 3.7cqi, 3.75rem);
line-height: 1.04;
color: var(--band-ink, #ffffff);
text-wrap: balance;
}
.cf-bundle-picker-9 .bp9-hl { color: var(--bp9-metal); }
.cf-bundle-picker-9 .bp9-lead { margin-top: clamp(14px, 1.8cqi, 20px); max-width: 58ch; font-size: clamp(17px, 0.9rem + 0.5cqi, 20px); font-weight: 500; line-height: 1.5; color: var(--band-ink, #ffffff); text-wrap: pretty; }
.cf-bundle-picker-9 .bp9-set {
border: 0;
margin: 0;
padding: 24px 0 0;
min-width: 0;
display: grid;
grid-template-columns: repeat(var(--bp9-n, 3), minmax(0, 1fr));
grid-template-rows: auto auto auto 1fr;
column-gap: clamp(12px, 2cqi, 24px);
row-gap: 0;
}
.cf-bundle-picker-9 .bp9-nomedia { grid-template-rows: auto auto 1fr; }
.cf-bundle-picker-9 .bp9-opt {
position: relative;
min-width: 0;
grid-row: span 4;
display: grid;
grid-template-rows: subgrid;
row-gap: 14px;
padding: 26px clamp(14px, 1.9cqi, 22px) clamp(14px, 1.9cqi, 20px);
text-align: center;
background: var(--card, #ffffff);
color: var(--ink, #1a2233);
border: 1px solid var(--card-border, color-mix(in oklch, var(--ink, #1a2233) 12%, transparent));
border-radius: var(--card-radius, var(--radius, 14px));
box-shadow: var(--bp9-rest);
cursor: pointer;
-webkit-tap-highlight-color: transparent;
transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.24s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.cf-bundle-picker-9 .bp9-nomedia .bp9-opt { grid-row: span 3; }
.cf-bundle-picker-9 .bp9-opt:hover { transform: translateY(-3px); box-shadow: var(--bp9-lift); }
.cf-bundle-picker-9 .bp9-opt:active { transform: translateY(-1px); }
.cf-bundle-picker-9 .bp9-opt.is-on {
background: color-mix(in oklch, var(--accent-fill, var(--accent, #2f6fd6)) 7%, var(--card, #ffffff));
border-color: var(--accent, #2f6fd6);
box-shadow: 0 0 0 3px var(--bp9-ring), var(--bp9-lift);
transform: translateY(-6px);
}
.cf-bundle-picker-9 .bp9-opt:has(input:focus-visible) { outline: 3px solid var(--band-ink, #ffffff); outline-offset: 5px; }
.cf-bundle-picker-9 .bp9-set:disabled .bp9-opt { cursor: not-allowed; opacity: 0.6; transform: none; }
.cf-bundle-picker-9 .bp9-badge {
position: absolute;
z-index: 2;
top: 0;
left: 50%;
translate: -50% -50%;
display: inline-flex;
align-items: center;
min-height: 30px;
padding: 5px 16px;
border-radius: 999px;
background: linear-gradient(var(--bp9-metal-hi), var(--bp9-metal-lo));
color: var(--bp9-metal-ink);
font-family: var(--font-body, inherit);
font-size: 14px;
font-weight: 800;
line-height: 1.1;
letter-spacing: 0.05em;
text-transform: uppercase;
white-space: nowrap;
box-shadow: inset 0 1px 0 oklch(from var(--bp9-metal) calc(l + 0.06) c h / 0.9), inset 0 -2px 0 oklch(from var(--bp9-metal) calc(l - 0.22) c h / 0.55), 0 1px 2px oklch(from var(--bp9-shade) l c h / 0.35), 0 4px 10px -2px oklch(from var(--bp9-shade) l c h / 0.3);
}
.cf-bundle-picker-9 .bp9-qty { display: flex; align-items: center; justify-content: center; gap: 12px; min-width: 0; }
.cf-bundle-picker-9 .bp9-dot {
flex: none;
display: grid;
place-items: center;
width: 24px;
height: 24px;
border-radius: 50%;
border: 2px solid var(--field-border, oklch(from var(--ink, #1a2233) l c h / 0.32));
background: var(--field, #ffffff);
transition: border-color 0.2s ease;
}
.cf-bundle-picker-9 .bp9-dot::after { content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--accent, #2f6fd6); transform: scale(0); transition: transform 0.22s cubic-bezier(0.3, 1.6, 0.5, 1); }
.cf-bundle-picker-9 .bp9-opt.is-on .bp9-dot { border-color: var(--accent, #2f6fd6); }
.cf-bundle-picker-9 .bp9-opt.is-on .bp9-dot::after { transform: scale(1); }
.cf-bundle-picker-9 .bp9-qty-t {
font-family: var(--font-display, inherit);
font-weight: var(--display-weight, 800);
text-transform: var(--display-case, none);
font-size: clamp(1.35rem, 0.9rem + 1.6cqi, 1.9rem);
line-height: 1.1;
letter-spacing: -0.01em;
white-space: nowrap;
}
.cf-bundle-picker-9 .bp9-media { position: relative; display: block; height: clamp(128px, 17cqi, 196px); padding-bottom: 10px; }
.cf-bundle-picker-9 .bp9-media::before {
content: '';
position: absolute;
left: 50%;
bottom: 2px;
translate: -50% 0;
width: min(80%, 230px);
height: 9px;
border-radius: 999px;
background: var(--secondary, oklch(0.93 0.015 263));
box-shadow: inset 0 1px 0 oklch(from var(--card, #ffffff) l c h / 0.7), 0 1px 2px oklch(from var(--bp9-shade) l c h / 0.22);
transition: background 0.25s ease;
}
.cf-bundle-picker-9 .bp9-opt.is-on .bp9-media::before { background: linear-gradient(90deg, var(--bp9-metal-lo), var(--bp9-metal-hi) 50%, var(--bp9-metal-lo)); }
.cf-bundle-picker-9 .bp9-media img {
position: relative;
z-index: 1;
display: block;
width: 100%;
height: 100%;
object-fit: contain;
object-position: 50% 100%;
filter: drop-shadow(0 2px 2px oklch(from var(--bp9-shade) l c h / 0.32)) drop-shadow(0 8px 10px oklch(from var(--bp9-shade) l c h / 0.18));
transform-origin: 50% 100%;
transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.cf-bundle-picker-9 .bp9-opt.is-on .bp9-media img { transform: scale(1.04); }
.cf-bundle-picker-9 .bp9-price { display: grid; justify-items: center; align-content: start; min-width: 0; }
.cf-bundle-picker-9 .bp9-per { display: flex; align-items: baseline; justify-content: center; gap: 6px; flex-wrap: wrap; }
.cf-bundle-picker-9 .bp9-per-n {
font-family: var(--font-display, inherit);
font-weight: var(--display-weight, 800);
font-size: clamp(2.5rem, 1.4rem + 3.4cqi, 3.6rem);
line-height: 1;
letter-spacing: -0.03em;
font-variant-numeric: tabular-nums;
color: var(--ink, #1a2233);
}
.cf-bundle-picker-9 .bp9-per-u { font-size: 16px; font-weight: 600; color: var(--muted, #4a5568); }
.cf-bundle-picker-9 .bp9-anchor { margin-top: 12px; font-size: 15px; font-weight: 500; line-height: 1.35; color: var(--muted, #4a5568); text-wrap: pretty; }
.cf-bundle-picker-9 .bp9-total { margin-top: 4px; font-size: 16px; font-weight: 700; line-height: 1.35; color: var(--ink, #1a2233); font-variant-numeric: tabular-nums; }
.cf-bundle-picker-9 .bp9-rows {
display: grid;
align-content: start;
gap: 10px;
padding: 14px;
border-radius: max(6px, calc(var(--card-radius, var(--radius, 14px)) - 4px));
background: color-mix(in oklch, var(--ink, #1a2233) 4%, var(--card, #ffffff));
text-align: left;
}
.cf-bundle-picker-9 .bp9-row { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--ink, #1a2233); text-wrap: pretty; }
.cf-bundle-picker-9 .bp9-row.is-no { color: var(--muted, #4a5568); font-weight: 500; }
.cf-bundle-picker-9 .bp9-ic { flex: none; display: grid; place-items: center; width: 22px; height: 22px; margin-top: -1px; border-radius: 50%; }
.cf-bundle-picker-9 .bp9-ic svg { width: 14px; height: 14px; stroke-width: 3; }
/* Solid status badges: status fill, white glyph (theme-contract §1). */
.cf-bundle-picker-9 .bp9-row.is-yes .bp9-ic { background: var(--success, oklch(0.5 0.14 150)); color: var(--bp9-glyph, #fff); }
.cf-bundle-picker-9 .bp9-row.is-no .bp9-ic { background: var(--danger, oklch(0.5 0.17 27)); color: var(--bp9-glyph, #fff); }
.cf-bundle-picker-9 .bp9-deal {
margin-top: clamp(26px, 3.6cqi, 42px);
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(300px, 440px);
align-items: start;
gap: clamp(18px, 3cqi, 40px);
padding: clamp(18px, 2.6cqi, 28px);
border: 1px solid var(--bp9-line);
border-radius: var(--card-radius, var(--radius, 14px));
background: color-mix(in oklch, var(--band-ink, #ffffff) 7%, var(--band, oklch(0.27 0.067 256)));
}
.cf-bundle-picker-9 .bp9-sum { min-width: 0; padding-top: 4px; }
.cf-bundle-picker-9 .bp9-sum p { font-size: clamp(16px, 0.9rem + 0.4cqi, 18px); line-height: 1.55; color: var(--band-ink, #ffffff); text-wrap: pretty; }
.cf-bundle-picker-9 .bp9-sum p + p { margin-top: 12px; }
.cf-bundle-picker-9 .bp9-sum .bp9-sum-main { font-size: clamp(19px, 1rem + 0.8cqi, 23px); line-height: 1.4; }
.cf-bundle-picker-9 .bp9-sum b { font-weight: 800; }
.cf-bundle-picker-9 .bp9-sum-in { animation: bp9-in 0.3s ease both; }
.cf-bundle-picker-9 .bp9-act { min-width: 0; }
.cf-bundle-picker-9 .bp9-btn {
appearance: none;
width: 100%;
min-height: 70px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 3px;
padding: 12px 20px 14px;
border: 1px solid oklch(from var(--bp9-cta) calc(l - 0.14) c h);
border-radius: var(--button-radius, var(--radius, 12px));
background: linear-gradient(oklch(from var(--bp9-cta) calc(l + 0.04) c h), var(--bp9-cta-2));
color: var(--button-ink, var(--cta-ink, #ffffff));
text-shadow: var(--button-text-shadow, none);
text-align: center;
cursor: pointer;
box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--bp9-cta) calc(l + 0.12) c h / 0.6), inset 0 -3px 0 oklch(from var(--bp9-cta) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--bp9-shade) l c h / 0.45), 0 6px 12px -4px oklch(from var(--bp9-shade) l c h / 0.5));
transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.cf-bundle-picker-9 .bp9-btn-main {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 10px;
font-family: var(--button-font, var(--font-display, inherit));
font-weight: var(--button-weight, 800);
text-transform: var(--button-case, none);
font-size: clamp(20px, 1rem + 1cqi, 25px);
line-height: 1.15;
letter-spacing: -0.005em;
text-wrap: balance;
}
.cf-bundle-picker-9 .bp9-btn-main svg { width: 22px; height: 22px; flex: none; }
.cf-bundle-picker-9 .bp9-btn-sub { font-family: var(--font-body, inherit); font-size: 15px; font-weight: 600; line-height: 1.3; text-wrap: pretty; }
.cf-bundle-picker-9 .bp9-btn:hover:not(:disabled), .cf-bundle-picker-9 .bp9-btn.is-hover {
background: linear-gradient(oklch(from var(--bp9-cta) calc(l - 0.02) c h), oklch(from var(--bp9-cta-2) calc(l - 0.06) c h));
transform: translateY(-1px);
}
.cf-bundle-picker-9 .bp9-btn:active:not(:disabled), .cf-bundle-picker-9 .bp9-btn.is-active {
background: oklch(from var(--bp9-cta-2) calc(l - 0.04) c h);
transform: translateY(1px);
box-shadow: inset 0 2px 4px oklch(from var(--bp9-shade) l c h / 0.4), 0 1px 1px oklch(from var(--bp9-shade) l c h / 0.35);
}
.cf-bundle-picker-9 .bp9-btn:focus-visible { outline: 3px solid var(--band-ink, #ffffff); outline-offset: 3px; }
.cf-bundle-picker-9 .bp9-btn[aria-busy='true'] { cursor: progress; }
.cf-bundle-picker-9 .bp9-btn:disabled {
cursor: not-allowed;
background: var(--button-2-bg, var(--secondary, oklch(0.93 0.015 263)));
color: var(--button-2-ink, var(--secondary-ink, #1a2233));
border-color: transparent;
text-shadow: none;
box-shadow: none;
transform: none;
}
.cf-bundle-picker-9 .bp9-spin { animation: bp9-spin 0.8s linear infinite; }
.cf-bundle-picker-9 .bp9-alert {
display: flex;
align-items: flex-start;
gap: 8px;
margin-top: 12px;
padding: 10px 12px;
border-radius: max(6px, calc(var(--radius, 12px) - 2px));
background: var(--danger-soft, oklch(0.93 0.024 27));
color: var(--danger, oklch(0.5 0.17 27));
font-size: 15px;
font-weight: 600;
line-height: 1.4;
text-wrap: pretty;
}
.cf-bundle-picker-9 .bp9-alert svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.cf-bundle-picker-9 .bp9-trust { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 14px; }
.cf-bundle-picker-9 .bp9-secure { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--band-ink, #ffffff); }
.cf-bundle-picker-9 .bp9-secure svg { width: 16px; height: 16px; flex: none; }
.cf-bundle-picker-9 .bp9-cards { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.cf-bundle-picker-9 .bp9-cards li { display: block; line-height: 0; }
.cf-bundle-picker-9 .bp9-cards svg { display: block; width: 38px; height: auto; }
@keyframes bp9-in { from { opacity: 0.45; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes bp9-spin { to { transform: rotate(360deg); } }
@container (max-width: 700px) {
.cf-bundle-picker-9 .bp9-set { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; row-gap: 24px; padding-top: 16px; }
.cf-bundle-picker-9 .bp9-opt {
grid-row: auto;
grid-template-rows: auto auto auto;
grid-template-columns: 96px minmax(0, 1fr);
grid-template-areas: 'media qty' 'media price' 'rows rows';
align-content: start;
column-gap: 14px;
row-gap: 6px;
padding: 24px 16px 16px;
text-align: left;
}
.cf-bundle-picker-9 .bp9-nomedia .bp9-opt { grid-row: auto; grid-template-columns: minmax(0, 1fr); grid-template-areas: 'qty' 'price' 'rows'; }
.cf-bundle-picker-9 .bp9-opt.is-on { transform: none; }
.cf-bundle-picker-9 .bp9-opt:hover { transform: none; }
.cf-bundle-picker-9 .bp9-qty { grid-area: qty; justify-content: flex-start; }
.cf-bundle-picker-9 .bp9-media { grid-area: media; align-self: start; height: 112px; padding-bottom: 8px; }
.cf-bundle-picker-9 .bp9-media::before { width: 86%; height: 7px; }
.cf-bundle-picker-9 .bp9-price { grid-area: price; justify-items: start; }
.cf-bundle-picker-9 .bp9-per { justify-content: flex-start; }
.cf-bundle-picker-9 .bp9-per-n { font-size: 2.4rem; }
.cf-bundle-picker-9 .bp9-anchor { margin-top: 8px; }
.cf-bundle-picker-9 .bp9-rows { grid-area: rows; margin-top: 10px; }
.cf-bundle-picker-9 .bp9-badge { left: 16px; translate: 0 -50%; }
.cf-bundle-picker-9 .bp9-deal { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
.cf-bundle-picker-9 *, .cf-bundle-picker-9 *::before, .cf-bundle-picker-9 *::after { transition-duration: 0.01ms !important; animation: none !important; }
.cf-bundle-picker-9 .bp9-opt, .cf-bundle-picker-9 .bp9-opt:hover, .cf-bundle-picker-9 .bp9-opt.is-on, .cf-bundle-picker-9 .bp9-btn:hover:not(:disabled), .cf-bundle-picker-9 .bp9-btn.is-hover, .cf-bundle-picker-9 .bp9-btn.is-active, .cf-bundle-picker-9 .bp9-opt.is-on .bp9-media img { transform: none !important; }
}
`
pieces/offer/bundle-picker-9/specimen.tsx 46 lines
// Specimen: the premium dark-stage bundle picker with 1, 3 and 6 bottle packages.
import __studioImage1a035f67 from "../assets/49b82419938b0cc5.webp";
import __studioImagef414ac11 from "../assets/159df819acedbddb.webp";
import __studioImage7e148f36 from "../assets/fecff5667ebe4000.webp";
import * as React from 'react'
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
import { BundlePicker9, type BundlePicker9State } from '../bundle-picker-9'
export const states: BundlePicker9State[] = ['default', 'hover', 'active', 'disabled', 'error']
const sample = defaults.sample
const singlePrice = Number(sample.price.replace(/[^0-9.]/g, '')) || 47
export default function BundlePicker9Specimen({ state }: { state?: BundlePicker9State }) {
return (
<BundlePicker9
state={state}
guarantee={sample.guarantee}
packages={[
{
units: 1,
price: singlePrice,
id: 'supply-1',
image: slot('item-1', __studioImage1a035f67),
imageAlt: 'One amber supplement bottle with a gold cap',
},
{
units: 3,
price: 117,
id: 'supply-3',
image: slot('item-2', __studioImagef414ac11),
imageAlt: 'Three amber supplement bottles with gold caps',
},
{
units: 6,
price: 198,
id: 'supply-6',
image: slot('item-3', __studioImage7e148f36),
imageAlt: 'Six amber supplement bottles with gold caps in two rows',
},
]}
onSubmit={() => undefined}
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalBundlePicker9 |
string |
|
highlight OptionalBundlePicker9 |
string |
|
lead OptionalBundlePicker9 |
string |
|
packages OptionalBundlePicker9 |
StagePackage[] |
|
unit OptionalBundlePicker9 |
{ one: string; other: string } |
|
defaultSelected OptionalBundlePicker9 |
number |
|
currency OptionalBundlePicker9 |
string |
|
locale OptionalBundlePicker9 |
string |
|
buttonLabel OptionalBundlePicker9 |
string | ((ctx: StageContext) => string) |
|
loadingLabel OptionalBundlePicker9 |
string |
|
bestValueLabel OptionalBundlePicker9 |
string |
|
guarantee OptionalBundlePicker9 |
string |
|
secureLabel OptionalBundlePicker9 |
string |
|
showPaymentMarks OptionalBundlePicker9 |
boolean |
|
paymentLabels OptionalBundlePicker9 |
Partial<Record<PaymentName, string>> |
|
extraRows OptionalBundlePicker9 |
StageRow[] |
|
errorMessage OptionalBundlePicker9 |
string |
|
state OptionalBundlePicker9 |
BundlePicker9State |
|
onSelect OptionalBundlePicker9 |
(pkg: StagePackage, index: number) => void |
|
onSubmit OptionalBundlePicker9 |
(pkg: StagePackage, index: number) => void | Promise<void> |
|
copy OptionalBundlePicker9 |
Partial<BundlePicker9Copy> |
|
className OptionalBundlePicker9 |
string |
|
style OptionalBundlePicker9 |
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- 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- 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.
-
159df819acedbddb.webp
image/webp · 134 KB
-
49b82419938b0cc5.webp
image/webp · 85.6 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB
-
fecff5667ebe4000.webp
image/webp · 166 KB