Subscription Picker 3
The right-sized box: a flat-lay of one week’s packs beside a numbered contents list, and a plan builder where a
Use it in a prompt
Use offer/subscription-picker-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/subscription-picker-3.tsx. - Import it and pass your copy and images (Props tab):
import { SubscriptionPicker3 } from "@/components/funneldna/offer/subscription-picker-3"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/subscription-picker-3/component.tsx 609 lines
// layout: unboxing-flatlay
// The right-sized box: a flat-lay of one week’s packs beside a numbered contents list, and a plan builder where a
// dog-size stepper rescales the dog silhouette and updates the daily portion, packs per delivery and the hang-tag price.
import * as React from 'react'
import { AlertCircle, Check, Dog, Minus, Plus } from 'lucide-react'
import { FX_HOST, Texture } from '../fx/fx'
import linen from '../fx/textures/linen'
export type DogSize = {
/** full size name, e.g. Medium */
label: string
/** short label for the stepper track, e.g. M */
short?: string
/** supplied weight range, e.g. 10–20 kg */
range?: string
/** supplied daily portion, e.g. 340 g */
portion: string
/** packs in one week for this size */
packsPerWeek: number
/** supplied weekly plan price for this size */
weekly: number
/** supplied regular weekly price; struck through on the tag when it is higher than the plan price */
regularWeekly?: number
}
export type DeliveryCadence = {
weeks: number
label: string
}
export type BoxItem = {
name: string
detail?: string
}
export type SubscriptionPicker3Values = {
size: string
sizeIndex: number
cadenceWeeks: number
portion: string
packsPerDelivery: number
weeklyPrice: number
deliveryPrice: number
}
type CopyKey =
| 'sizeHeading'
| 'sizeGroupLabel'
| 'smallerLabel'
| 'biggerLabel'
| 'portionLabel'
| 'packsLabel'
| 'tagLabel'
| 'regularLabel'
| 'todayLabel'
| 'tagDelivery'
| 'cadenceLegend'
| 'cadenceError'
| 'actionLabel'
| 'secondaryLabel'
| 'psLabel'
| 'caption'
| 'announce'
/** Every visible word. Placeholders replaced as text: {amount}, {size}, {packs}, {portion}, {price}. */
export type SubscriptionPicker3Copy = Record<CopyKey, string>
export type SubscriptionPicker3Props = {
headline?: string
/** phrase inside the headline set in the accent colour */
headlineEmphasis?: string
lead?: string
/** product slot: flat-lay photo of one delivery’s contents */
flatlayImage?: string
flatlayAlt?: string
/** dog silhouette cut-out on a transparent background, used as a token-tinted mask (like an fx Spot, no slot) */
silhouetteImage?: string
/** supplied portion and price table, smallest dog first */
sizes?: DogSize[]
/** index into sizes selected on load */
defaultSize?: number
cadences?: DeliveryCadence[]
/** weeks of the cadence selected on load; null starts with none chosen */
defaultCadence?: number | null
contentsHeading?: string
/** what arrives in every box, in the order it reads in the photo */
items?: BoxItem[]
/** P.S. line under the action; empty hides it */
ps?: string
/** where the quiet link goes; defaults to the contents list */
secondaryHref?: string
currency?: string
locale?: string
copy?: Partial<SubscriptionPicker3Copy>
/** called with the built plan when the visitor starts it */
onSubmit?: (values: SubscriptionPicker3Values) => void
state?: 'default' | 'hover' | 'active' | 'disabled' | 'error'
className?: string
}
export function SubscriptionPicker3(props: SubscriptionPicker3Props) {
const {
headline = 'Fresh food, portioned for the size of your dog',
headlineEmphasis = 'the size of your dog',
lead = 'Pick their size and we set the daily portion, the packs in every box and your weekly price. Then choose how often it arrives.',
flatlayImage = '',
flatlayAlt = 'One week of meal packs laid out with the feeding card and scoop',
silhouetteImage = '',
sizes = DEFAULT_SIZES,
defaultSize = 1,
cadences = DEFAULT_CADENCES,
defaultCadence = 2,
contentsHeading = 'Everything in the box, ready to serve',
items = DEFAULT_ITEMS,
ps = '',
secondaryHref,
currency = 'USD',
locale = 'en-US',
copy: copyOverrides,
onSubmit,
state = 'default',
className,
} = props
const copy: SubscriptionPicker3Copy = { ...DEFAULT_COPY, ...copyOverrides }
const uid = React.useId()
const headId = `${uid}-head`
const contentsId = `${uid}-contents`
const errId = `${uid}-cadence-error`
const list = sizes.length ? sizes : DEFAULT_SIZES
const plans = cadences.filter((c) => Number.isFinite(c.weeks) && c.weeks > 0)
const n = list.length
const clampIndex = (i: number) => Math.min(n - 1, Math.max(0, Math.round(i)))
const firstCadence = (): number | null => {
if (defaultCadence === null) return null
const found = plans.find((c) => c.weeks === defaultCadence)
return found ? found.weeks : plans[0]?.weeks ?? null
}
const [index, setIndex] = React.useState(() => clampIndex(defaultSize))
const [weeks, setWeeks] = React.useState<number | null>(() => (state === 'error' ? null : firstCadence()))
const [showError, setShowError] = React.useState(state === 'error')
const segRefs = React.useRef<(HTMLButtonElement | null)[]>([])
const chipRef = React.useRef<HTMLInputElement>(null)
React.useEffect(() => {
setShowError(state === 'error')
if (state === 'error') setWeeks(null)
}, [state])
const money = React.useCallback(
(value: number) => {
const digits = Number.isInteger(value) ? 0 : 2
return new Intl.NumberFormat(locale, {
style: 'currency',
currency,
minimumFractionDigits: digits,
maximumFractionDigits: digits,
}).format(value)
},
[locale, currency],
)
const disabled = state === 'disabled'
const safe = clampIndex(index)
const size = list[safe]
const activeWeeks = weeks !== null && plans.some((c) => c.weeks === weeks) ? weeks : null
const span = activeWeeks ?? 1
const packs = size.packsPerWeek * span
const delivery = Math.round(size.weekly * span * 100) / 100
const scale = n > 1 ? 0.5 + (0.5 * safe) / (n - 1) : 1
const hasRegular = typeof size.regularWeekly === 'number' && size.regularWeekly > size.weekly
const caption = fill(copy.caption, {
size: size.label.toLocaleLowerCase(locale),
packs: String(size.packsPerWeek),
portion: size.portion,
})
const announce = fill(copy.announce, {
size: size.label,
portion: size.portion,
packs: String(packs),
price: money(size.weekly),
})
const quietHref = secondaryHref ?? (items.length ? `#${contentsId}` : '')
const errorOn = showError && activeWeeks === null
const dogMask: React.CSSProperties | undefined = silhouetteImage
? { WebkitMaskImage: `url('${silhouetteImage}')`, maskImage: `url('${silhouetteImage}')` }
: undefined
const go = (next: number, focus = false) => {
if (disabled) return
const i = clampIndex(next)
setIndex(i)
if (focus) segRefs.current[i]?.focus()
}
const onTrackKey = (event: React.KeyboardEvent<HTMLDivElement>) => {
const moves: Record<string, number> = {
ArrowRight: safe + 1,
ArrowDown: safe + 1,
ArrowLeft: safe - 1,
ArrowUp: safe - 1,
Home: 0,
End: n - 1,
}
if (!(event.key in moves)) return
event.preventDefault()
go(moves[event.key], true)
}
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault()
if (disabled) return
if (activeWeeks === null) {
setShowError(true)
chipRef.current?.focus()
return
}
onSubmit?.({
size: size.label,
sizeIndex: safe,
cadenceWeeks: activeWeeks,
portion: size.portion,
packsPerDelivery: packs,
weeklyPrice: size.weekly,
deliveryPrice: delivery,
})
}
const buttonClass = ['sp3-btn', state === 'hover' ? 'is-hover' : '', state === 'active' ? 'is-active' : '']
.filter(Boolean)
.join(' ')
return (
<section
className={['cf-subscription-picker-3', className].filter(Boolean).join(' ')}
style={FX_HOST}
aria-labelledby={headId}
>
<Texture src={linen} tone='ink' />
<style>{CSS}</style>
<div className='sp3-inner'>
<header className='sp3-head sp3-rise'>
<h2 id={headId} className='sp3-h2'>
{emphasise(headline, headlineEmphasis)}
</h2>
{lead ? <p className='sp3-lead'>{lead}</p> : null}
</header>
<div className='sp3-grid'>
{flatlayImage ? (
<figure className='sp3-media sp3-rise' style={v({ '--d': 1 })}>
<img src={flatlayImage} alt={flatlayAlt} width={1200} height={900} decoding='async' />
<figcaption>{caption}</figcaption>
</figure>
) : null}
<form
className={'sp3-card sp3-rise' + (disabled ? ' is-disabled' : '')}
style={v({ '--d': 2 })}
onSubmit={handleSubmit}
noValidate
>
<h3 className='sp3-h3'>{copy.sizeHeading}</h3>
<div className='sp3-stage' aria-hidden='true'>
{silhouetteImage ? (
<>
<span className='sp3-dog is-ghost' style={dogMask} />
<span className='sp3-dog' style={{ ...dogMask, ...v({ '--s': scale }) }} />
</>
) : (
<>
<Dog className='sp3-dog-icon is-ghost' strokeWidth={2.5} />
<Dog className='sp3-dog-icon' strokeWidth={2.5} style={v({ '--s': scale })} />
</>
)}
</div>
<p className='sp3-size'>
<span className='sp3-size-name'>{size.label}</span>
{size.range ? <span className='sp3-size-range'>{size.range}</span> : null}
</p>
<div className='sp3-stepper'>
<button
type='button'
className='sp3-step'
aria-label={copy.smallerLabel}
disabled={disabled || safe === 0}
onClick={() => go(safe - 1)}
>
<Minus size={20} strokeWidth={2.5} aria-hidden='true' />
</button>
<div
className='sp3-track'
role='radiogroup'
aria-label={copy.sizeGroupLabel}
onKeyDown={onTrackKey}
style={v({ '--n': n, '--i': safe })}
>
<span className='sp3-thumb' aria-hidden='true' />
{list.map((s, i) => (
<button
key={s.label}
ref={(el) => {
segRefs.current[i] = el
}}
type='button'
role='radio'
aria-checked={i === safe}
aria-label={s.range ? `${s.label}, ${s.range}` : s.label}
tabIndex={i === safe ? 0 : -1}
disabled={disabled}
className='sp3-seg'
onClick={() => go(i)}
>
{s.short || s.label}
</button>
))}
</div>
<button
type='button'
className='sp3-step'
aria-label={copy.biggerLabel}
disabled={disabled || safe === n - 1}
onClick={() => go(safe + 1)}
>
<Plus size={20} strokeWidth={2.5} aria-hidden='true' />
</button>
</div>
<div className='sp3-readout'>
<dl className='sp3-well'>
<div className='sp3-stat'>
<dt>{copy.portionLabel}</dt>
<dd>{size.portion}</dd>
</div>
<div className='sp3-stat'>
<dt>{copy.packsLabel}</dt>
<dd>{packs}</dd>
</div>
</dl>
<div className='sp3-tagwrap'>
<svg className='sp3-string' viewBox='0 0 20 44' width='20' height='44' aria-hidden='true' focusable='false'>
<path d='M10 0 C 5 14, 15 28, 10 43' />
</svg>
<div className='sp3-tagshade' key={`${safe}-${activeWeeks ?? 0}`}>
<div className='sp3-tag'>
<span className='sp3-hole' aria-hidden='true' />
<p className='sp3-tag-label'>{copy.tagLabel}</p>
{hasRegular ? (
<p className='sp3-was'>
<span className='sp3-sr'>{copy.regularLabel} </span>
<del>{money(size.regularWeekly as number)}</del>
</p>
) : null}
<p className='sp3-now'>
<span className='sp3-sr'>{copy.todayLabel} </span>
{money(size.weekly)}
</p>
{activeWeeks !== null ? (
<p className='sp3-per'>{fill(copy.tagDelivery, { amount: money(delivery) })}</p>
) : null}
</div>
</div>
</div>
</div>
<p className='sp3-sr' role='status' aria-live='polite'>
{announce}
</p>
<fieldset
className={'sp3-cadence' + (errorOn ? ' is-error' : '')}
aria-describedby={errorOn ? errId : undefined}
disabled={disabled}
>
<legend className='sp3-legend'>{copy.cadenceLegend}</legend>
<div className='sp3-chips'>
{plans.map((c, i) => {
const on = c.weeks === activeWeeks
return (
<label key={c.weeks} className={'sp3-chip' + (on ? ' is-on' : '')}>
<input
ref={i === 0 ? chipRef : undefined}
type='radio'
className='sp3-sr'
name={`${uid}-cadence`}
value={c.weeks}
checked={on}
aria-invalid={errorOn || undefined}
onChange={() => {
setWeeks(c.weeks)
setShowError(false)
}}
/>
{on ? (
<span className='sp3-chip-badge' aria-hidden='true'>
<Check size={16} strokeWidth={3} />
</span>
) : null}
<span className='sp3-chip-label'>{c.label}</span>
</label>
)
})}
</div>
{errorOn ? (
<p id={errId} className='sp3-error' role='alert'>
<AlertCircle className='sp3-error-icon' size={18} strokeWidth={2.5} aria-hidden='true' />
{copy.cadenceError}
</p>
) : null}
</fieldset>
<div className='sp3-action'>
<button type='submit' className={buttonClass} disabled={disabled}>
{copy.actionLabel}
</button>
{quietHref ? (
<a className='sp3-quiet' href={quietHref}>
{copy.secondaryLabel}
</a>
) : null}
</div>
{ps ? (
<p className='sp3-ps'>
<strong>{copy.psLabel}</strong> {ps}
</p>
) : null}
</form>
{items.length ? (
<div className='sp3-contents sp3-rise' id={contentsId} style={v({ '--d': 3 })}>
<h3 className='sp3-h3'>{contentsHeading}</h3>
<ol className='sp3-list'>
{items.map((item, i) => (
<li key={item.name} className='sp3-item'>
<span className='sp3-num' aria-hidden='true'>
{i + 1}
</span>
<span>
<span className='sp3-item-name'>{item.name}</span>
{item.detail ? <span className='sp3-item-detail'>{item.detail}</span> : null}
</span>
</li>
))}
</ol>
</div>
) : null}
</div>
</div>
</section>
)
}
export default SubscriptionPicker3
function v(vars: Record<string, string | number>): React.CSSProperties {
return vars as unknown as React.CSSProperties
}
function fill(template: string, values: Record<string, string>): string {
return Object.keys(values).reduce((out, key) => out.split('{' + key + '}').join(values[key]), template)
}
function emphasise(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='sp3-em'>{phrase}</span>
{text.slice(at + phrase.length)}
</>
)
}
const DEFAULT_COPY: SubscriptionPicker3Copy = {
sizeHeading: 'How big is your dog?',
sizeGroupLabel: 'Dog size',
smallerLabel: 'Smaller dog',
biggerLabel: 'Bigger dog',
portionLabel: 'Daily portion',
packsLabel: 'Packs per delivery',
tagLabel: 'Your weekly price',
regularLabel: 'Regular price',
todayLabel: 'Your plan price',
tagDelivery: '{amount} per delivery',
cadenceLegend: 'How often should it arrive?',
cadenceError: 'Choose how often your box arrives to continue.',
actionLabel: 'Start my dog’s plan',
secondaryLabel: 'or see what’s in every box first',
psLabel: 'P.S.',
caption: 'Sized for {size} dogs: {packs} packs a week, {portion} a day.',
announce: '{size}: {portion} a day, {packs} packs per delivery, {price} a week.',
}
const DEFAULT_SIZES: DogSize[] = [
{ label: 'Small', short: 'S', range: 'Up to 10 kg', portion: '180 g', packsPerWeek: 7, weekly: 24 },
{ label: 'Medium', short: 'M', range: '10–20 kg', portion: '340 g', packsPerWeek: 7, weekly: 33 },
{ label: 'Large', short: 'L', range: '20–35 kg', portion: '520 g', packsPerWeek: 14, weekly: 45 },
{ label: 'Extra large', short: 'XL', range: 'Over 35 kg', portion: '700 g', packsPerWeek: 14, weekly: 58 },
]
const DEFAULT_CADENCES: DeliveryCadence[] = [
{ weeks: 1, label: 'Every week' },
{ weeks: 2, label: 'Every 2 weeks' },
{ weeks: 4, label: 'Every 4 weeks' },
]
const DEFAULT_ITEMS: BoxItem[] = [
{ name: 'A week of meal packs', detail: 'Sealed and portioned for the size you pick.' },
{ name: 'Your feeding card', detail: 'Your dog’s daily portion, printed for their size.' },
{ name: 'A measuring scoop', detail: 'Serve the same amount at every meal.' },
]
const R = '.cf-subscription-picker-3'
const CSS = `
${R}{background:var(--surface);color:var(--ink);font-family:var(--font-body);padding:clamp(56px,8vw,112px) clamp(16px,5vw,48px) clamp(64px,8.5vw,120px);overflow:clip}
${R} *,${R} *::before,${R} *::after{box-sizing:border-box}
${R} .sp3-inner{position:relative;z-index:1;max-width:1120px;margin:0 auto}
${R} .sp3-head{max-width:46rem;margin-bottom:clamp(32px,4vw,48px)}
${R} .sp3-h2{margin:0;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)}
${R} .sp3-em{color:var(--accent)}
${R} .sp3-lead{margin:16px 0 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}
${R} .sp3-grid{display:grid;grid-template-columns:minmax(0,1.08fr) minmax(0,1fr);grid-template-rows:auto 1fr;grid-template-areas:'media card' 'list card';column-gap:clamp(32px,5vw,72px);row-gap:clamp(28px,3vw,40px);align-items:start}
${R} .sp3-media{grid-area:media;margin:0}
${R} .sp3-media img{display:block;width:100%;height:auto;aspect-ratio:4/3;object-fit:cover;object-position:50% 50%;border-radius:12px}
${R} .sp3-media figcaption{margin-top:12px;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted);text-align:center;text-wrap:pretty}
${R} .sp3-contents{grid-area:list}
${R} .sp3-h3{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-0.01em;text-transform:var(--display-case,none);text-wrap:balance;color:var(--ink)}
${R} .sp3-list{list-style:none;margin:20px 0 0;padding:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px 28px}
${R} .sp3-item{display:grid;grid-template-columns:auto minmax(0,1fr);gap:12px;align-items:start}
${R} .sp3-num{min-width:1.1em;font-family:var(--font-display);font-weight:800;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;font-variant-numeric:tabular-nums;color:var(--accent)}
${R} .sp3-item-name{display:block;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.35;font-weight:700;color:var(--ink);text-wrap:pretty}
${R} .sp3-item-detail{display:block;margin-top:4px;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;color:var(--muted);text-wrap:pretty}
${R} .sp3-card{grid-area:card;container:sp3 / inline-size;background:var(--card);color:var(--ink);border:1px solid var(--card-border,oklch(from var(--ink) l c h / .12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(0.22 0.03 260 / .22),0 12px 24px -8px oklch(0.22 0.03 260 / .32)));padding:clamp(20px,3vw,32px)}
${R} .sp3-card.is-disabled .sp3-stage{opacity:.6}
${R} .sp3-stage{position:relative;height:172px;margin-top:20px;border-bottom:2px solid oklch(from var(--ink) l c h / .14);overflow:hidden}
${R} .sp3-dog{position:absolute;left:50%;bottom:0;width:232px;height:168px;margin-left:-116px;background:var(--accent-fill,var(--accent));-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:50% 100%;mask-position:50% 100%;-webkit-mask-size:contain;mask-size:contain;transform:scale(var(--s,1));transform-origin:50% 100%;transition:transform .45s cubic-bezier(.2,.7,.2,1)}
${R} .sp3-dog.is-ghost{background:color-mix(in oklch,var(--ink) 8%,var(--card));transform:none}
${R} .sp3-dog-icon{position:absolute;left:50%;bottom:4px;width:160px;height:160px;margin-left:-80px;color:var(--accent);transform:scale(var(--s,1));transform-origin:50% 100%;transition:transform .45s cubic-bezier(.2,.7,.2,1)}
${R} .sp3-dog-icon.is-ghost{color:color-mix(in oklch,var(--ink) 10%,var(--card));transform:none}
${R} .sp3-size{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 12px;margin:14px 0 0}
${R} .sp3-size-name{font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;color:var(--ink)}
${R} .sp3-size-range{font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted)}
${R} .sp3-stepper{display:grid;grid-template-columns:48px minmax(0,1fr) 48px;gap:8px;margin-top:14px}
${R} .sp3-step{display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;padding:0;border:1px solid var(--button-2-border,transparent);border-radius:var(--button-radius,var(--radius,12px));background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));box-shadow:var(--button-2-shadow,var(--shadow-sm));cursor:pointer;transition:transform .16s ease,background .16s ease,box-shadow .16s ease}
${R} .sp3-step:hover:not(:disabled){background:oklch(from var(--button-2-bg,var(--secondary)) calc(l - 0.04) c h)}
${R} .sp3-step:active:not(:disabled){transform:translateY(1px);box-shadow:none}
${R} .sp3-step:disabled{opacity:.42;cursor:not-allowed;box-shadow:none}
${R} .sp3-track{position:relative;display:grid;grid-template-columns:repeat(var(--n),minmax(0,1fr));min-height:48px;padding:4px;border-radius:var(--button-radius,var(--radius,12px));background:color-mix(in oklch,var(--ink) 6%,var(--card))}
${R} .sp3-thumb{position:absolute;top:4px;bottom:4px;left:4px;width:calc((100% - 8px) / var(--n));border-radius:calc(var(--button-radius,var(--radius,12px)) - 4px);background:linear-gradient(oklch(from var(--accent-fill,var(--accent)) calc(l + 0.03) c h),oklch(from var(--accent-fill,var(--accent)) calc(l - 0.03) c h));box-shadow:inset 0 1px 0 oklch(from var(--accent-fill,var(--accent)) calc(l + 0.12) c h / .6),0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / .3),0 4px 8px -3px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / .35);transform:translateX(calc(var(--i) * 100%));transition:transform .35s cubic-bezier(.2,.7,.2,1)}
${R} .sp3-seg{position:relative;z-index:1;display:flex;align-items:center;justify-content:center;min-width:0;padding:0 4px;border:0;border-radius:calc(var(--button-radius,var(--radius,12px)) - 4px);background:transparent;font-family:var(--font-body);font-size:1rem;font-weight:800;line-height:1.2;color:var(--ink);cursor:pointer;transition:color .16s ease,background .16s ease}
${R} .sp3-seg:hover:not([aria-checked='true']):not(:disabled){background:color-mix(in oklch,var(--ink) 7%,transparent)}
${R} .sp3-seg[aria-checked='true']{color:var(--accent-fill-ink,var(--card))}
${R} .sp3-seg:disabled{cursor:not-allowed}
${R} .sp3-readout{display:grid;grid-template-columns:minmax(0,1fr) 184px;gap:16px;align-items:end;margin-top:24px}
${R} .sp3-well{margin:0;padding:16px 18px;border-radius:10px;background:color-mix(in oklch,var(--ink) 4%,var(--card));display:grid;gap:14px;align-self:stretch;align-content:center}
${R} .sp3-stat{margin:0}
${R} .sp3-stat dt{font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted)}
${R} .sp3-stat dd{margin:4px 0 0;font-family:var(--font-display);font-weight:800;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;font-variant-numeric:tabular-nums;color:var(--ink)}
${R} .sp3-tagwrap{position:relative;padding-top:24px}
${R} .sp3-string{position:absolute;top:0;left:50%;margin-left:-10px;z-index:2;overflow:visible;fill:none;stroke:var(--muted);stroke-width:1.5;stroke-linecap:round}
${R} .sp3-tagshade{transform:rotate(-2deg);transform-origin:50% 18px;filter:drop-shadow(0 1px 1px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / .32)) drop-shadow(0 6px 8px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / .24));animation:sp3-swing .7s cubic-bezier(.2,.7,.2,1) both}
${R} .sp3-tag{position:relative;padding:38px 16px 20px;text-align:center;border-radius:12px;color:var(--accent-fill-ink,var(--card));background:linear-gradient(oklch(from var(--accent-fill,var(--accent)) calc(l + 0.03) c h),oklch(from var(--accent-fill,var(--accent)) calc(l - 0.04) c h));clip-path:polygon(24% 0,76% 0,100% 13%,100% 100%,0 100%,0 13%)}
${R} .sp3-hole{position:absolute;top:12px;left:50%;width:12px;height:12px;margin-left:-6px;border-radius:50%;background:var(--card);box-shadow:inset 0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / .5)}
${R} .sp3-tag-label{margin:0;font-size:.875rem;line-height:1.2;font-weight:800;letter-spacing:.02em}
${R} .sp3-was{margin:12px 0 0;font-size:1.125rem;line-height:1.2;font-weight:700;font-variant-numeric:tabular-nums;opacity:1}
${R} .sp3-was del{position:relative;display:inline-block;text-decoration:none}
${R} .sp3-was del::after{content:'';position:absolute;left:-8%;right:-8%;top:50%;height:.13em;margin-top:-.065em;border-radius:999px;background:currentColor;transform:rotate(-8deg)}
${R} .sp3-now{margin:14px 0 0;font-family:var(--font-display);font-weight:800;font-size:clamp(2.25rem,3.4vw,2.75rem);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums}
${R} .sp3-per{margin:12px 0 0;font-size:.9375rem;line-height:1.4;font-weight:600;text-wrap:pretty}
${R} .sp3-cadence{margin:24px 0 0;padding:0;border:0;min-inline-size:0}
${R} .sp3-legend{padding:0;margin-bottom:12px;font-size:1.0625rem;line-height:1.35;font-weight:700;color:var(--ink)}
${R} .sp3-chips{display:grid;grid-template-columns:repeat(auto-fit,minmax(5.5rem,1fr));gap:10px}
${R} .sp3-chip{position:relative;display:flex;align-items:center;justify-content:center;min-height:52px;padding:8px 12px;border-radius:var(--field-radius,var(--radius,12px));border:1px solid oklch(from var(--ink) l c h / .16);background:color-mix(in oklch,var(--ink) 4%,var(--card));color:var(--ink);font-size:1rem;line-height:1.2;font-weight:700;text-align:center;cursor:pointer;transition:background .16s ease,border-color .16s ease,box-shadow .16s ease,transform .16s ease}
${R} .sp3-chip-label{text-wrap:balance}
${R} .sp3-chip:hover{background:color-mix(in oklch,var(--ink) 8%,var(--card));border-color:oklch(from var(--ink) l c h / .3)}
${R} .sp3-chip:active{transform:translateY(1px)}
${R} .sp3-chip.is-on{background:color-mix(in oklch,var(--accent) 12%,var(--card));border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}
${R} .sp3-chip-badge{position:absolute;top:-9px;right:-9px;display:grid;place-items:center;width:24px;height:24px;border-radius:50%;background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card));box-shadow:0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / .3),0 3px 6px -2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / .3);animation:sp3-pop .3s cubic-bezier(.2,.7,.2,1) both}
${R} .sp3-chip:has(input:focus-visible){outline:3px solid var(--field-focus,var(--accent));outline-offset:2px}
${R} .sp3-cadence:disabled .sp3-chip{opacity:.55;cursor:not-allowed}
${R} .sp3-cadence.is-error .sp3-chip{border-color:var(--danger)}
${R} .sp3-error{margin:12px 0 0;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--danger);text-wrap:pretty}
${R} .sp3-error-icon{display:inline-block;vertical-align:-0.2em;margin-inline-end:.4em}
${R} .sp3-action{display:grid;justify-items:center;gap:14px;margin-top:24px}
${R} .sp3-btn{display:inline-flex;align-items:center;justify-content:center;width:100%;min-height:64px;padding:0 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:clamp(1.125rem,1.55vw,1.375rem);line-height:1.15;text-align:center;text-wrap:balance;color:var(--button-ink,var(--cta-ink));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 / .7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.16) c h),0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / .3),0 8px 16px -6px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / .45));cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
${R} .sp3-btn:hover:not(:disabled),${R} .sp3-btn.is-hover: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 / .7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.2) c h),0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / .34),0 10px 20px -6px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / .52))}
${R} .sp3-btn:active:not(:disabled),${R} .sp3-btn.is-active:not(:disabled){transform:translateY(1px);box-shadow:inset 0 2px 4px oklch(from var(--button-bg,var(--cta)) calc(l - 0.22) c h / .55),inset 0 -2px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.16) c h),0 1px 1px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / .3)}
${R} .sp3-btn:disabled{cursor:not-allowed;transform:none;text-shadow:none;box-shadow:none;background:color-mix(in oklch,var(--ink) 12%,var(--card));color:color-mix(in oklch,var(--ink) 52%,var(--card))}
${R} .sp3-quiet{font-size:.9375rem;line-height:1.4;font-weight:500;text-align:center;color:var(--muted);text-decoration:underline;text-decoration-color:oklch(from var(--muted) l c h / .5);text-underline-offset:.18em}
${R} .sp3-quiet:hover{color:var(--ink);text-decoration-color:currentColor}
${R} .sp3-ps{margin:20px 0 0;padding-top:16px;border-top:1px solid oklch(from var(--ink) l c h / .12);font-size:1rem;line-height:1.5;color:var(--ink);text-wrap:pretty}
${R} .sp3-ps strong{font-weight:800}
${R} :is(.sp3-btn,.sp3-step,.sp3-seg,.sp3-quiet):focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:2px}
${R} .sp3-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}
${R} .sp3-rise{animation:sp3-rise .45s cubic-bezier(.2,.7,.2,1) both;animation-delay:calc(var(--d,0) * .07s)}
@keyframes sp3-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes sp3-swing{from{transform:rotate(-7deg)}to{transform:rotate(-2deg)}}
@keyframes sp3-pop{from{transform:scale(.9)}to{transform:scale(1)}}
@container sp3 (max-width: 400px){${R} .sp3-readout{grid-template-columns:minmax(0,1fr)}${R} .sp3-tagwrap{justify-self:center;width:min(100%,232px)}${R} .sp3-stage{height:150px}${R} .sp3-dog{width:200px;height:146px;margin-left:-100px}${R} .sp3-dog-icon{width:140px;height:140px;margin-left:-70px}}
@media (max-width: 960px){${R} .sp3-grid{grid-template-columns:minmax(0,1fr);grid-template-rows:none;grid-template-areas:'media' 'card' 'list'}}
@media (max-width: 560px){${R} .sp3-list{grid-template-columns:minmax(0,1fr)}}
@media (prefers-reduced-motion: reduce){${R} .sp3-rise,${R} .sp3-tagshade,${R} .sp3-chip-badge{animation:none}${R} .sp3-dog,${R} .sp3-dog-icon,${R} .sp3-thumb,${R} .sp3-btn,${R} .sp3-step,${R} .sp3-seg,${R} .sp3-chip{transition:none}}
`
pieces/offer/subscription-picker-3/specimen.tsx 53 lines
import __studioImagede7b562b from "../assets/5a399e825006d410.webp";
import __studioImage15abda04 from "../assets/40c94f0399ea6e9e.webp";
// Specimen: Bramble & Bone fresh dog food, the right-sized box picker.
import * as React from 'react'
import { SubscriptionPicker3, type SubscriptionPicker3Props } from '../subscription-picker-3'
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
export const states = ['default', 'hover', 'active', 'disabled', 'error']
const SIZES = [
{ label: 'Small', short: 'S', range: 'Up to 10 kg', portion: '180 g', packsPerWeek: 7, weekly: 24, regularWeekly: 30 },
{ label: 'Medium', short: 'M', range: '10–20 kg', portion: '340 g', packsPerWeek: 7, weekly: 33, regularWeekly: 41 },
{ label: 'Large', short: 'L', range: '20–35 kg', portion: '520 g', packsPerWeek: 14, weekly: 45, regularWeekly: 56 },
{ label: 'Extra large', short: 'XL', range: 'Over 35 kg', portion: '700 g', packsPerWeek: 14, weekly: 58, regularWeekly: 72 },
]
const CADENCES = [
{ weeks: 1, label: 'Every week' },
{ weeks: 2, label: 'Every 2 weeks' },
{ weeks: 4, label: 'Every 4 weeks' },
]
const ITEMS = [
{ name: 'A week of meal packs', detail: 'Gently cooked, sealed and portioned for the size you pick.' },
{ name: 'Your feeding card', detail: 'Your dog’s daily portion, printed for their size.' },
{ name: 'A measuring scoop', detail: 'Serve the same amount at every meal.' },
{ name: 'Real food you can see', detail: 'Chicken, rice, carrots and peas in every pack.' },
]
export default function SubscriptionPicker3Specimen({ state = 'default' }: { state?: SubscriptionPicker3Props['state'] }) {
return (
<SubscriptionPicker3
headline='Fresh food, portioned for the size of your dog'
headlineEmphasis='the size of your dog'
lead='Tell us how big your dog is. Bramble & Bone sets the daily portion, the packs in every box and your weekly price, then delivers on your schedule.'
flatlayImage={slot(
'product',
__studioImagede7b562b,
)}
flatlayAlt='A week of Bramble & Bone meal packs with a bowl of chicken, rice and vegetables, a feeding card and a measuring scoop'
silhouetteImage={__studioImage15abda04}
sizes={SIZES}
defaultSize={1}
cadences={CADENCES}
defaultCadence={2}
contentsHeading='Everything in the box, ready to serve'
items={ITEMS}
ps={`Your first box is covered by our ${defaults.sample.guarantee}. If it isn’t right for your dog, you get your money back.`}
state={state}
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalSubscriptionPicker3 |
string |
|
headlineEmphasis OptionalSubscriptionPicker3 |
string |
|
lead OptionalSubscriptionPicker3 |
string |
|
flatlayImage OptionalSubscriptionPicker3 |
string |
|
flatlayAlt OptionalSubscriptionPicker3 |
string |
|
silhouetteImage OptionalSubscriptionPicker3 |
string |
|
sizes OptionalSubscriptionPicker3 |
DogSize[] |
|
defaultSize OptionalSubscriptionPicker3 |
number |
|
cadences OptionalSubscriptionPicker3 |
DeliveryCadence[] |
|
defaultCadence OptionalSubscriptionPicker3 |
number | null |
|
contentsHeading OptionalSubscriptionPicker3 |
string |
|
items OptionalSubscriptionPicker3 |
BoxItem[] |
|
ps OptionalSubscriptionPicker3 |
string |
|
secondaryHref OptionalSubscriptionPicker3 |
string |
|
currency OptionalSubscriptionPicker3 |
string |
|
locale OptionalSubscriptionPicker3 |
string |
|
copy OptionalSubscriptionPicker3 |
Partial<SubscriptionPicker3Copy> |
|
onSubmit OptionalSubscriptionPicker3 |
(values: SubscriptionPicker3Values) => void |
|
state OptionalSubscriptionPicker3 |
'default' | 'hover' | 'active' | 'disabled' | 'error' |
|
className OptionalSubscriptionPicker3 |
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-border--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--field-radius- Form inputs: background, ink, border, radius and focus colour.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
product- The main product shot or cover (ebook, kit, bottle).
-
2c539f422023a290.webp
image/webp · 115 KB
-
40c94f0399ea6e9e.webp
image/webp · 38.9 KB
-
5a399e825006d410.webp
image/webp · 128 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB