Subscription Picker 2
The per-box staircase: subscription plans rise as steps beside a flat-lay of the box. Each step lowers the price
Use it in a prompt
Use offer/subscription-picker-2 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-2.tsx. - Import it and pass your copy and images (Props tab):
import { SubscriptionPicker2 } from "@/components/funneldna/offer/subscription-picker-2"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/subscription-picker-2/component.tsx 721 lines
// layout: unboxing-flatlay
// The per-box staircase: subscription plans rise as steps beside a flat-lay of the box. Each step lowers the price
// of every box in figures computed from the supplied prices, so commitment is rewarded honestly and the top step sells itself.
import * as React from 'react'
import { motion, useReducedMotion } from 'motion/react'
import { AlertCircle, BadgePercent, Check, DoorOpen, Receipt, ShoppingCart, SkipForward } from 'lucide-react'
export type SubscriptionPicker2Plan = {
/** stable id passed back to onAction */
id: string
name: string
/** the amount charged each time this plan bills, e.g. 96 */
price: number
/** how many boxes one charge covers */
boxes: number
/** how many months one charge covers */
months: number
/** how the charge repeats, set after the amount, e.g. 'billed every 3 months' */
billing?: string
/** what this step adds over the step below it */
adds?: string[]
}
export type SubscriptionPicker2Unit = 'box' | 'month'
export type SubscriptionPicker2Choice = {
planId: string
plan: SubscriptionPicker2Plan
/** the display unit the visitor was comparing in */
unit: SubscriptionPicker2Unit
/** the amount this plan charges */
price: number
perBox: number
perMonth: number
}
type CopyKey =
| 'plansLabel'
| 'toggleLabel'
| 'unitBox'
| 'unitMonth'
| 'perBox'
| 'perMonth'
| 'billed'
| 'everything'
| 'saveBox'
| 'saveMonth'
| 'baseNote'
| 'lowestBox'
| 'lowestMonth'
| 'boxOne'
| 'boxMany'
| 'summary'
| 'sumSave'
| 'action'
| 'actionAria'
| 'stepAria'
| 'error'
| 'psLabel'
| 'imageAlt'
/** Every visible word. Placeholders replaced as text: {amount}, {billing}, {plan}, {count}, {boxes}, {unit}. */
export type SubscriptionPicker2Copy = Record<CopyKey, string>
export type SubscriptionPicker2Props = {
headline?: string
/** phrase inside the headline swiped with the marker highlight */
headlineHighlight?: string
lead?: string
/** the steps, lowest commitment first; they rise left to right */
plans?: SubscriptionPicker2Plan[]
/** the step set in the action colour; defaults to the last (top) step */
featuredId?: string
/** preselected plan; defaults to the featured step, null for none */
defaultPlanId?: string | null
defaultUnit?: SubscriptionPicker2Unit
currency?: string
locale?: string
/** product slot image: a flat-lay of a typical box */
boxImage?: string
boxImageAlt?: string
/** heading under the flat-lay */
boxHeading?: string
/** numbered list of what is in a typical box */
boxContents?: string[]
/** skip terms, shown only when supplied */
skipTerms?: string
/** cancel terms, shown only when supplied */
cancelTerms?: string
/** billing terms, shown only when supplied */
billingTerms?: string
/** P.S. line under the action; empty hides it */
ps?: string
copy?: Partial<SubscriptionPicker2Copy>
/** called with the chosen plan when the visitor starts their box */
onAction?: (choice: SubscriptionPicker2Choice) => void
state?: 'default' | 'hover' | 'active' | 'disabled' | 'error'
className?: string
}
export function SubscriptionPicker2(props: SubscriptionPicker2Props) {
const {
headline = 'Stay a step longer and every box costs less',
headlineHighlight = 'every box costs less',
lead = 'Every step up lowers the price of each box. Pick the step that suits you.',
plans = DEFAULT_PLANS,
featuredId,
defaultPlanId,
defaultUnit = 'box',
currency = 'USD',
locale = 'en-US',
boxImage = '',
boxImageAlt,
boxHeading = 'Fresh in every delivery',
boxContents = [],
skipTerms = '',
cancelTerms = '',
billingTerms = '',
ps = '',
copy: copyOverrides,
onAction,
state = 'default',
className,
} = props
const copy: SubscriptionPicker2Copy = { ...DEFAULT_COPY, ...copyOverrides }
const reduce = useReducedMotion() ?? false
const uid = React.useId()
const headId = `${uid}-head`
const errId = `${uid}-error`
const radios = React.useRef<Array<HTMLButtonElement | null>>([])
const rows = React.useMemo<Row[]>(
() =>
plans
.filter((p) => Number.isFinite(p.price) && p.price >= 0 && p.boxes > 0 && p.months > 0)
.map((plan) => ({ plan, perBox: round2(plan.price / plan.boxes), perMonth: round2(plan.price / plan.months) })),
[plans],
)
const featured = featuredId ?? rows[rows.length - 1]?.plan.id
const initialId: string | null = defaultPlanId === undefined ? featured ?? null : defaultPlanId
const disabled = state === 'disabled'
const [selected, setSelected] = React.useState<string | null>(state === 'error' ? null : initialId)
const [unit, setUnit] = React.useState<SubscriptionPicker2Unit>(defaultUnit)
const [showError, setShowError] = React.useState(state === 'error')
React.useEffect(() => {
if (state === 'error') {
setSelected(null)
setShowError(true)
} else {
setSelected(initialId)
setShowError(false)
}
}, [state, initialId])
const showToggle = rows.some((r) => r.perBox !== r.perMonth)
const activeUnit: SubscriptionPicker2Unit = showToggle ? unit : 'box'
const valueOf = (r: Row) => (activeUnit === 'box' ? r.perBox : r.perMonth)
const money = (n: number) => moneyParts(n, locale, currency).text
const values = rows.map(valueOf)
const lowest = Math.min(...values)
const lowestOnly = rows.length > 1 && values.filter((v) => v === lowest).length === 1
const baseValue = values[0] ?? 0
const unitLabel = activeUnit === 'box' ? copy.perBox : copy.perMonth
const selectedIndex = rows.findIndex((r) => r.plan.id === selected)
const selectedRow = selectedIndex >= 0 ? rows[selectedIndex] : undefined
const featuredIndex = rows.findIndex((r) => r.plan.id === featured)
const tabIndexAt = selectedIndex >= 0 ? selectedIndex : Math.max(0, featuredIndex)
const baseRow = rows[0]
const totalSave =
selectedRow && selectedIndex > 0 && baseRow
? round2(baseRow.perBox * selectedRow.plan.boxes - selectedRow.plan.price)
: 0
const billedText = (r: Row) => fill(copy.billed, { amount: money(r.plan.price), billing: r.plan.billing ?? '' }).trim()
const boxesText = (n: number) => fill(n === 1 ? copy.boxOne : copy.boxMany, { count: n })
const choose = (id: string) => {
if (disabled) return
setSelected(id)
setShowError(false)
}
const onStepKey = (event: React.KeyboardEvent<HTMLButtonElement>, index: number) => {
const last = rows.length - 1
let next = -1
if (event.key === 'ArrowRight' || event.key === 'ArrowUp') next = index === last ? 0 : index + 1
else if (event.key === 'ArrowLeft' || event.key === 'ArrowDown') next = index === 0 ? last : index - 1
else if (event.key === 'Home') next = 0
else if (event.key === 'End') next = last
const target = next >= 0 ? rows[next] : undefined
if (!target) return
event.preventDefault()
choose(target.plan.id)
radios.current[next]?.focus()
}
const handleAction = () => {
if (disabled) return
if (!selectedRow) {
setShowError(true)
radios.current[tabIndexAt]?.focus()
return
}
onAction?.({
planId: selectedRow.plan.id,
plan: selectedRow.plan,
unit: activeUnit,
price: selectedRow.plan.price,
perBox: selectedRow.perBox,
perMonth: selectedRow.perMonth,
})
}
const terms = [
{ text: skipTerms, Icon: SkipForward },
{ text: cancelTerms, Icon: DoorOpen },
{ text: billingTerms, Icon: Receipt },
].filter((t) => t.text)
const hasBox = Boolean(boxImage) || boxContents.length > 0
const buttonClass = cx('sp2-btn', state === 'hover' && 'is-hover', state === 'active' && 'is-active')
return (
<section className={cx('cf-subscription-picker-2', className)} aria-labelledby={headId}>
<style>{CSS}</style>
<div className='sp2-wrap'>
<header className='sp2-head'>
<h2 className='sp2-h2' id={headId}>
{highlight(headline, headlineHighlight)}
</h2>
{lead ? <p className='sp2-lead'>{lead}</p> : null}
</header>
<div className={cx('sp2-stage', !hasBox && 'no-box')}>
{hasBox ? (
<div className='sp2-boxwrap'>
<figure className='sp2-box'>
{boxImage ? (
<img
className='sp2-photo'
src={boxImage}
alt={boxImageAlt ?? copy.imageAlt}
width={800}
height={800}
loading='lazy'
decoding='async'
/>
) : null}
<figcaption className='sp2-cap'>
{boxHeading ? <h3 className='sp2-h3'>{boxHeading}</h3> : null}
{boxContents.length > 0 ? (
<ol className='sp2-legend'>
{boxContents.map((item, i) => (
<li key={`${i}-${item}`}>
<span className='sp2-num' aria-hidden='true'>
{i + 1}
</span>
<span>{item}</span>
</li>
))}
</ol>
) : null}
</figcaption>
</figure>
</div>
) : null}
<div className='sp2-climb'>
{showToggle ? (
<div className='sp2-toggle' role='group' aria-label={copy.toggleLabel}>
{(['box', 'month'] as const).map((u) => {
const on = activeUnit === u
return (
<button
key={u}
type='button'
className='sp2-tog'
aria-pressed={on}
disabled={disabled}
onClick={() => setUnit(u)}
>
{on ? (
<motion.span
layoutId={`${uid}-thumb`}
className='sp2-tog-thumb'
aria-hidden='true'
transition={reduce ? { duration: 0 } : { duration: 0.3, ease: EASE }}
/>
) : null}
<span className='sp2-tog-label'>{u === 'box' ? copy.unitBox : copy.unitMonth}</span>
</button>
)
})}
</div>
) : null}
<div
className='sp2-stairs'
role='radiogroup'
aria-label={copy.plansLabel}
aria-describedby={showError ? errId : undefined}
aria-invalid={showError || undefined}
style={{ '--sp2-count': rows.length } as React.CSSProperties}
>
{rows.map((row, i) => {
const id = row.plan.id
const isSelected = selected === id
const isFeatured = id === featured
const value = valueOf(row)
const save = i > 0 ? round2(baseValue - value) : 0
const riser =
i === 0
? copy.baseNote
: save > 0
? fill(activeUnit === 'box' ? copy.saveBox : copy.saveMonth, { amount: money(save) })
: ''
const adds = row.plan.adds ?? []
const prev = i > 0 ? rows[i - 1] : undefined
const descId = `${uid}-desc-${i}`
const riserId = `${uid}-riser-${i}`
return (
<button
key={id}
ref={(el) => {
radios.current[i] = el
}}
type='button'
role='radio'
aria-checked={isSelected}
aria-label={fill(copy.stepAria, { plan: row.plan.name, amount: money(value), unit: unitLabel })}
aria-describedby={riser ? `${descId} ${riserId}` : descId}
tabIndex={i === tabIndexAt ? 0 : -1}
disabled={disabled}
className={cx('sp2-step', isFeatured && 'is-featured', isSelected && 'is-selected')}
style={{ '--sp2-down': rows.length - 1 - i, '--sp2-i': i } as React.CSSProperties}
onClick={() => choose(id)}
onKeyDown={(event) => onStepKey(event, i)}
>
<span className='sp2-step-body'>
{lowestOnly && value === lowest ? (
<span className='sp2-flag'>{activeUnit === 'box' ? copy.lowestBox : copy.lowestMonth}</span>
) : null}
<span className='sp2-step-top'>
<span className='sp2-name'>{row.plan.name}</span>
<span className='sp2-dot' aria-hidden='true'>
{isSelected ? <Check size={16} strokeWidth={3} /> : null}
</span>
</span>
<span className='sp2-pricebox' aria-hidden='true'>
<Figure
key={`${activeUnit}-${value}`}
value={value}
locale={locale}
currency={currency}
reduce={reduce}
/>
<span className='sp2-unit'>{unitLabel}</span>
</span>
<span className='sp2-desc' id={descId}>
<span className='sp2-billed'>{billedText(row)}</span>
{adds.length > 0 ? (
<span className='sp2-adds'>
{prev ? (
<span className='sp2-adds-lead'>{fill(copy.everything, { plan: prev.plan.name })}</span>
) : null}
{adds.map((item, j) => (
<span className='sp2-add' key={`${j}-${item}`}>
<Check size={18} strokeWidth={2.5} aria-hidden='true' />
<span>{item}</span>
</span>
))}
</span>
) : null}
</span>
</span>
{riser ? (
<span className={cx('sp2-riser', i > 0 && 'is-save')} id={riserId}>
{i > 0 ? (
<BadgePercent className='sp2-ico' size={16} strokeWidth={2.5} aria-hidden='true' />
) : null}
{riser}
</span>
) : null}
</button>
)
})}
</div>
{showError ? (
<p className='sp2-error' id={errId} role='alert'>
<AlertCircle className='sp2-ico' size={18} strokeWidth={2.5} aria-hidden='true' />
{copy.error}
</p>
) : null}
{terms.length > 0 ? (
<ul className='sp2-terms'>
{terms.map(({ text, Icon }) => (
<li key={text}>
<Icon className='sp2-ico' size={16} strokeWidth={2.5} aria-hidden='true' />
{text}
</li>
))}
</ul>
) : null}
<div className='sp2-checkout'>
<p className='sp2-summary' aria-live='polite'>
{selectedRow ? (
<>
<span className='sp2-sum-plan'>
{fill(copy.summary, { plan: selectedRow.plan.name, boxes: boxesText(selectedRow.plan.boxes) })}
</span>
<span className='sp2-sum-bill'>{billedText(selectedRow)}</span>
{totalSave > 0 && baseRow ? (
<span className='sp2-sum-save'>
<BadgePercent className='sp2-ico' size={16} strokeWidth={2.5} aria-hidden='true' />
{fill(copy.sumSave, { amount: money(totalSave), plan: baseRow.plan.name })}
</span>
) : null}
</>
) : (
<span className='sp2-sum-plan'>{copy.plansLabel}</span>
)}
</p>
<button
type='button'
className={buttonClass}
disabled={disabled}
onClick={handleAction}
aria-label={
selectedRow
? fill(copy.actionAria, { plan: selectedRow.plan.name, amount: money(selectedRow.plan.price) })
: undefined
}
>
<ShoppingCart size={20} strokeWidth={2.5} aria-hidden='true' />
<span>{copy.action}</span>
{selectedRow ? (
<>
<span aria-hidden='true'>·</span>
<span className='sp2-btn-price'>{money(selectedRow.plan.price)}</span>
</>
) : null}
</button>
</div>
{ps ? (
<p className='sp2-ps'>
<strong>{copy.psLabel}</strong> {ps}
</p>
) : null}
</div>
</div>
</div>
</section>
)
}
export default SubscriptionPicker2
type Row = { plan: SubscriptionPicker2Plan; perBox: number; perMonth: number }
const EASE: [number, number, number, number] = [0.2, 0.7, 0.2, 1]
const DEFAULT_PLANS: SubscriptionPicker2Plan[] = [
{ id: 'monthly', name: 'Monthly', price: 36, boxes: 2, months: 1, billing: 'billed every month' },
{ id: 'quarterly', name: 'Quarterly', price: 96, boxes: 6, months: 3, billing: 'billed every 3 months' },
{ id: 'year', name: 'Prepaid year', price: 336, boxes: 24, months: 12, billing: 'billed once a year' },
]
const DEFAULT_COPY: SubscriptionPicker2Copy = {
plansLabel: 'Choose your plan',
toggleLabel: 'Show prices',
unitBox: 'Per box',
unitMonth: 'Per month',
perBox: 'per box',
perMonth: 'per month',
billed: '{amount} {billing}',
everything: 'Everything in {plan}, plus:',
saveBox: 'Save {amount} a box',
saveMonth: 'Save {amount} a month',
baseNote: 'Pay as you go',
lowestBox: 'Lowest per box',
lowestMonth: 'Lowest per month',
boxOne: '{count} box',
boxMany: '{count} boxes',
summary: '{plan} · {boxes}',
sumSave: 'You save {amount} compared with {plan}',
action: 'Start my box',
actionAria: 'Start my box on the {plan} plan, {amount}',
stepAria: '{plan}, {amount} {unit}',
error: 'Pick a plan above to start your box.',
psLabel: 'P.S.',
imageAlt: 'A typical box, laid out',
}
function Figure({
value,
locale,
currency,
reduce,
}: {
value: number
locale: string
currency: string
reduce: boolean
}) {
const p = moneyParts(value, locale, currency)
return (
<motion.span
className='sp2-fig'
initial={reduce ? false : { opacity: 0.82, y: 8 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.45, ease: EASE }}
>
{p.before && p.symbol ? <span className='sp2-sup is-pre'>{p.symbol}</span> : null}
<span>{p.main}</span>
{p.fraction ? <span className='sp2-sup'>{p.fraction}</span> : null}
{!p.before && p.symbol ? <span className='sp2-sup is-post'>{p.symbol}</span> : null}
</motion.span>
)
}
function moneyParts(n: number, locale: string, currency: string) {
const whole = Math.abs(n - Math.round(n)) < 0.005
const amount = whole ? Math.round(n) : n
const nf = new Intl.NumberFormat(locale, {
style: 'currency',
currency,
minimumFractionDigits: whole ? 0 : 2,
maximumFractionDigits: whole ? 0 : 2,
})
let symbol = ''
let main = ''
let fraction = ''
let before = true
let seenNumber = false
for (const part of nf.formatToParts(amount)) {
if (part.type === 'currency') {
symbol = part.value
before = !seenNumber
} else if (part.type === 'integer' || part.type === 'group') {
main += part.value
seenNumber = true
} else if (part.type === 'fraction') {
fraction = part.value
} else if (part.type === 'minusSign') {
main = part.value + main
}
}
return { symbol, main, fraction, before, text: nf.format(amount) }
}
function round2(n: number) {
return Math.round(n * 100) / 100
}
function fill(template: string, values: Record<string, string | number>) {
let out = template
for (const [key, value] of Object.entries(values)) out = out.split('{' + key + '}').join(String(value))
return out
}
function highlight(text: string, phrase: string) {
const at = phrase ? text.indexOf(phrase) : -1
if (at < 0) return text
return (
<>
{text.slice(0, at)}
<span className='sp2-mark'>{phrase}</span>
{text.slice(at + phrase.length)}
</>
)
}
function cx(...classes: Array<string | false | null | undefined>) {
return classes.filter(Boolean).join(' ')
}
const CSS = `
.cf-subscription-picker-2{
--sp2-rise:40px;
--sp2-radius:var(--card-radius,var(--radius,14px));
--sp2-marker:var(--marker,#fae37c);
--sp2-shadow:var(--shadow,oklch(0.22 0.03 260));
--sp2-cta:var(--button-bg,var(--cta,oklch(0.58 0.21 29)));
--sp2-cta-ink:var(--button-ink,var(--cta-ink,oklch(1 0 0)));
--sp2-md:var(--card-shadow,var(--shadow-md,0 1px 2px oklch(from var(--sp2-shadow) l c h / 0.22),0 4px 10px -2px oklch(from var(--sp2-shadow) l c h / 0.2)));
--sp2-lg:var(--shadow-lg,0 2px 4px oklch(from var(--sp2-shadow) l c h / 0.22),0 12px 24px -8px oklch(from var(--sp2-shadow) l c h / 0.32));
position:relative;
background:var(--surface,oklch(1 0 0));
color:var(--ink,oklch(0.21 0.034 263));
font-family:var(--font-body,system-ui,sans-serif);
font-size:clamp(1.0625rem,1.25vw,1.125rem);
line-height:1.5;
padding:clamp(56px,8vw,112px) clamp(16px,5vw,48px) clamp(64px,8.5vw,120px);
overflow-x:clip;
}
.cf-subscription-picker-2 *,.cf-subscription-picker-2 *::before,.cf-subscription-picker-2 *::after{box-sizing:border-box}
.cf-subscription-picker-2 .sp2-wrap{max-width:1120px;margin:0 auto}
.cf-subscription-picker-2 .sp2-head{max-width:46rem;margin:0 0 clamp(32px,4.5vw,56px)}
.cf-subscription-picker-2 .sp2-h2{margin:0 0 16px;font-family:var(--font-display,inherit);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);text-wrap:balance;color:var(--ink)}
.cf-subscription-picker-2 .sp2-mark{background-image:linear-gradient(color-mix(in oklch,var(--sp2-marker) 80%,transparent),color-mix(in oklch,var(--sp2-marker) 80%,transparent));background-repeat:no-repeat;background-size:100% 0.46em;background-position:0 88%;padding:0 0.06em;margin:0 -0.06em;border-radius:0.22em 0.08em 0.26em 0.1em;-webkit-box-decoration-break:clone;box-decoration-break:clone}
.cf-subscription-picker-2 .sp2-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-subscription-picker-2 .sp2-stage{display:grid;grid-template-columns:minmax(0,320px) minmax(0,1fr);gap:clamp(32px,5vw,64px);align-items:start}
.cf-subscription-picker-2 .sp2-stage.no-box{grid-template-columns:minmax(0,1fr)}
.cf-subscription-picker-2 .sp2-boxwrap{position:sticky;top:24px;min-width:0;container-type:inline-size}
.cf-subscription-picker-2 .sp2-box{margin:0;display:grid;gap:20px}
@container (min-width:560px){.cf-subscription-picker-2 .sp2-box{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:32px;align-items:start}}
.cf-subscription-picker-2 .sp2-photo{display:block;width:100%;height:auto;aspect-ratio:1/1;object-fit:cover;object-position:50% 50%;border-radius:12px;background:color-mix(in oklch,var(--ink) 4%,var(--surface))}
.cf-subscription-picker-2 .sp2-cap{min-width:0}
.cf-subscription-picker-2 .sp2-h3{margin:0;font-family:var(--font-display,inherit);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;font-weight:var(--display-weight,800);letter-spacing:-0.01em;text-wrap:balance;color:var(--ink)}
.cf-subscription-picker-2 .sp2-legend{list-style:none;margin:16px 0 0;padding:0;display:grid;gap:10px}
.cf-subscription-picker-2 .sp2-legend li{display:grid;grid-template-columns:28px minmax(0,1fr);gap:8px;align-items:baseline;font-size:1.0625rem;line-height:1.45;color:var(--ink);text-wrap:pretty}
.cf-subscription-picker-2 .sp2-num{font-family:var(--font-display,inherit);font-size:1.3125rem;line-height:1;font-weight:800;color:var(--accent);font-variant-numeric:tabular-nums}
.cf-subscription-picker-2 .sp2-climb{min-width:0;container-type:inline-size}
.cf-subscription-picker-2 .sp2-toggle{display:flex;width:max-content;max-width:100%;gap:2px;padding:4px;margin:0 0 24px;border-radius:999px;background:color-mix(in oklch,var(--ink) 6%,var(--surface));box-shadow:inset 0 0 0 1px oklch(from var(--ink) l c h / 0.1)}
.cf-subscription-picker-2 .sp2-tog{position:relative;isolation:isolate;appearance:none;border:0;background:transparent;min-height:44px;padding:0 20px;border-radius:999px;font:inherit;font-size:0.9375rem;font-weight:800;line-height:1.2;color:var(--ink);cursor:pointer;transition:background-color .16s ease,color .16s ease}
.cf-subscription-picker-2 .sp2-tog[aria-pressed='true']{color:var(--surface)}
.cf-subscription-picker-2 .sp2-tog[aria-pressed='false']:hover:not(:disabled){background:color-mix(in oklch,var(--ink) 6%,transparent)}
.cf-subscription-picker-2 .sp2-tog:focus-visible{outline:3px solid oklch(from var(--field-focus,var(--accent)) l c h / 0.55);outline-offset:2px}
.cf-subscription-picker-2 .sp2-tog:disabled{cursor:not-allowed}
.cf-subscription-picker-2 .sp2-tog-thumb{position:absolute;inset:0;z-index:-1;border-radius:999px;background:var(--ink);box-shadow:var(--shadow-sm,0 1px 2px oklch(from var(--sp2-shadow) l c h / 0.22))}
.cf-subscription-picker-2 .sp2-tog-label{position:relative}
.cf-subscription-picker-2 .sp2-stairs{display:grid;grid-template-columns:repeat(var(--sp2-count,3),minmax(0,1fr));gap:16px;align-items:stretch}
.cf-subscription-picker-2 .sp2-step{position:relative;display:flex;flex-direction:column;min-width:0;margin:calc(var(--sp2-down,0) * var(--sp2-rise)) 0 0;padding:0;appearance:none;font:inherit;text-align:left;color:var(--ink);background:var(--card);border:1px solid var(--card-border,oklch(from var(--ink) l c h / 0.12));border-radius:var(--sp2-radius);box-shadow:var(--sp2-md);cursor:pointer;transition:box-shadow .16s ease,border-color .16s ease,background-color .16s ease,transform .16s ease;animation:sp2-rise .45s cubic-bezier(.2,.7,.2,1) backwards;animation-delay:calc(var(--sp2-i,0) * 0.07s)}
.cf-subscription-picker-2 .sp2-step::after{content:'';position:absolute;inset:-7px;z-index:2;border-radius:calc(var(--sp2-radius) + 6px);border:3px solid transparent;pointer-events:none;transition:border-color .16s ease}
.cf-subscription-picker-2 .sp2-step:hover:not(:disabled){border-color:oklch(from var(--ink) l c h / 0.26);box-shadow:var(--sp2-lg)}
.cf-subscription-picker-2 .sp2-step:active:not(:disabled){transform:translateY(1px)}
.cf-subscription-picker-2 .sp2-step:focus-visible{outline:3px solid oklch(from var(--field-focus,var(--accent)) l c h / 0.55);outline-offset:10px}
.cf-subscription-picker-2 .sp2-step:disabled{cursor:not-allowed}
.cf-subscription-picker-2 .sp2-step.is-selected{border-color:var(--accent);box-shadow:var(--sp2-lg)}
.cf-subscription-picker-2 .sp2-step.is-selected::after{border-color:var(--accent)}
.cf-subscription-picker-2 .sp2-step.is-featured{color:var(--sp2-cta-ink);background:var(--sp2-cta);border-color:oklch(from var(--sp2-cta) calc(l - 0.08) c h);box-shadow:inset 0 1px 0 oklch(from var(--sp2-cta) calc(l + 0.14) c h / 0.6),var(--sp2-lg)}
.cf-subscription-picker-2 .sp2-step.is-featured:hover:not(:disabled){background:oklch(from var(--sp2-cta) calc(l - 0.03) c h);border-color:oklch(from var(--sp2-cta) calc(l - 0.1) c h)}
.cf-subscription-picker-2 .sp2-step.is-featured.is-selected::after{border-color:var(--sp2-cta)}
.cf-subscription-picker-2 .sp2-step-body{display:flex;flex-direction:column;flex:1 1 auto;padding:clamp(20px,2vw,24px)}
.cf-subscription-picker-2 .sp2-flag{align-self:flex-start;display:inline-flex;align-items:center;min-height:28px;padding:4px 12px;margin:0 0 12px;border-radius:999px;font-size:0.875rem;font-weight:800;line-height:1.2;white-space:nowrap;background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card));animation:sp2-pop .3s cubic-bezier(.2,.7,.2,1) backwards}
.cf-subscription-picker-2 .is-featured .sp2-flag{background:var(--card);color:var(--ink)}
.cf-subscription-picker-2 .sp2-step-top{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.cf-subscription-picker-2 .sp2-name{min-width:0;font-family:var(--font-display,inherit);font-size:clamp(1.3125rem,1.6vw,1.5rem);line-height:1.15;font-weight:var(--display-weight,800);letter-spacing:-0.01em;text-wrap:balance}
.cf-subscription-picker-2 .sp2-dot{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:999px;border:2px solid oklch(from var(--ink) l c h / 0.32);background:var(--card);color:var(--accent-fill-ink,var(--card));transition:background-color .16s ease,border-color .16s ease}
.cf-subscription-picker-2 .is-selected .sp2-dot{background:var(--accent-fill,var(--accent));border-color:var(--accent-fill,var(--accent))}
.cf-subscription-picker-2 .is-featured .sp2-dot{background:transparent;border-color:oklch(from var(--sp2-cta-ink) l c h / 0.65);color:var(--sp2-cta)}
.cf-subscription-picker-2 .is-featured.is-selected .sp2-dot{background:var(--sp2-cta-ink);border-color:var(--sp2-cta-ink)}
.cf-subscription-picker-2 .sp2-pricebox{display:flex;flex-direction:column;align-items:flex-start;margin-top:16px}
.cf-subscription-picker-2 .sp2-fig{display:inline-flex;align-items:flex-start;font-family:var(--font-display,inherit);font-size:clamp(2.5rem,4.2vw,3.75rem);line-height:1;font-weight:var(--display-weight,800);letter-spacing:-0.03em;font-variant-numeric:tabular-nums;white-space:nowrap}
.cf-subscription-picker-2 .sp2-sup{font-size:0.44em;line-height:1;margin-top:0.14em;letter-spacing:0}
.cf-subscription-picker-2 .sp2-sup.is-pre{margin-right:0.06em}
.cf-subscription-picker-2 .sp2-sup.is-post{margin-left:0.06em}
.cf-subscription-picker-2 .sp2-unit{margin-top:12px;font-size:0.9375rem;font-weight:700;line-height:1.3}
.cf-subscription-picker-2 .sp2-desc{display:contents}
.cf-subscription-picker-2 .sp2-billed{display:block;margin-top:4px;font-size:0.9375rem;font-weight:500;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-subscription-picker-2 .is-featured .sp2-billed{color:inherit}
.cf-subscription-picker-2 .sp2-adds{display:flex;flex-direction:column;gap:8px;margin-top:16px;padding-top:16px;border-top:1px solid oklch(from var(--ink) l c h / 0.12)}
.cf-subscription-picker-2 .is-featured .sp2-adds{border-top-color:oklch(from var(--sp2-cta-ink) l c h / 0.3)}
.cf-subscription-picker-2 .sp2-adds-lead{font-size:0.9375rem;font-weight:800;line-height:1.35}
.cf-subscription-picker-2 .sp2-add{display:grid;grid-template-columns:18px minmax(0,1fr);gap:8px;align-items:start;font-size:1rem;font-weight:500;line-height:1.4;text-wrap:pretty}
.cf-subscription-picker-2 .sp2-add svg{margin-top:2px;color:var(--success)}
.cf-subscription-picker-2 .is-featured .sp2-add svg{color:inherit}
.cf-subscription-picker-2 .sp2-riser{display:block;padding:14px clamp(20px,2vw,24px);border-radius:0 0 calc(var(--sp2-radius) - 1px) calc(var(--sp2-radius) - 1px);background:color-mix(in oklch,var(--ink) 5%,var(--card));font-size:0.9375rem;font-weight:800;line-height:1.35;color:var(--muted);text-wrap:pretty}
.cf-subscription-picker-2 .sp2-riser.is-save{color:var(--success)}
.cf-subscription-picker-2 .is-featured .sp2-riser{background:oklch(from var(--sp2-cta) calc(l - 0.06) c h);color:var(--sp2-cta-ink)}
.cf-subscription-picker-2 .sp2-ico{display:inline-block;vertical-align:-0.15em;margin-inline-end:0.4em;flex:none}
.cf-subscription-picker-2 .sp2-error{margin:16px 0 0;padding:12px 16px;border-radius:10px;background:var(--danger-soft);color:var(--danger);font-size:0.9375rem;font-weight:700;line-height:1.4;text-wrap:pretty}
.cf-subscription-picker-2 .sp2-terms{list-style:none;margin:24px 0 0;padding:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:8px 24px}
.cf-subscription-picker-2 .sp2-terms li{font-size:0.9375rem;font-weight:500;line-height:1.45;color:var(--muted);text-wrap:pretty}
.cf-subscription-picker-2 .sp2-terms .sp2-ico{color:var(--ink)}
.cf-subscription-picker-2 .sp2-checkout{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:16px 24px;margin-top:32px;padding:clamp(20px,3vw,28px);border-radius:var(--sp2-radius);background:color-mix(in oklch,var(--ink) 4%,var(--surface));border:1px solid oklch(from var(--ink) l c h / 0.08)}
.cf-subscription-picker-2 .sp2-summary{margin:0;display:flex;flex-direction:column;gap:4px;min-width:0}
.cf-subscription-picker-2 .sp2-sum-save{margin-top:4px;font-size:0.9375rem;font-weight:800;line-height:1.4;color:var(--success);text-wrap:pretty}
.cf-subscription-picker-2 .sp2-sum-plan{font-size:1.0625rem;font-weight:800;line-height:1.3;color:var(--ink)}
.cf-subscription-picker-2 .sp2-sum-bill{font-size:0.9375rem;font-weight:500;line-height:1.4;color:var(--muted)}
.cf-subscription-picker-2 .sp2-btn{appearance:none;border:0;display:inline-flex;align-items:center;justify-content:center;gap:10px;min-height:64px;padding:0 28px;border-radius:var(--button-radius,var(--radius,12px));font-family:var(--button-font,var(--font-display,inherit));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:clamp(1.125rem,1.55vw,1.375rem);line-height:1.15;white-space:nowrap;color:var(--sp2-cta-ink);text-shadow:var(--button-text-shadow,none);background:linear-gradient(oklch(from var(--sp2-cta) calc(l + 0.04) c h),oklch(from var(--button-bg-2,var(--cta-2,var(--sp2-cta))) calc(l - 0.02) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--sp2-cta) calc(l + 0.14) c h / 0.7),inset 0 -3px 0 oklch(from var(--sp2-cta) calc(l - 0.16) c h),0 1px 2px oklch(from var(--sp2-shadow) l c h / 0.3),0 8px 16px -6px oklch(from var(--sp2-shadow) l c h / 0.38));cursor:pointer;transition:background .16s ease,box-shadow .16s ease,transform .16s ease}
.cf-subscription-picker-2 .sp2-btn:hover:not(:disabled),.cf-subscription-picker-2 .sp2-btn.is-hover{background:linear-gradient(oklch(from var(--sp2-cta) calc(l - 0.01) c h),oklch(from var(--button-bg-2,var(--cta-2,var(--sp2-cta))) calc(l - 0.07) c h));box-shadow:inset 0 1px 0 oklch(from var(--sp2-cta) calc(l + 0.1) c h / 0.6),inset 0 -3px 0 oklch(from var(--sp2-cta) calc(l - 0.18) c h),0 1px 2px oklch(from var(--sp2-shadow) l c h / 0.32),0 10px 18px -6px oklch(from var(--sp2-shadow) l c h / 0.45)}
.cf-subscription-picker-2 .sp2-btn:active:not(:disabled),.cf-subscription-picker-2 .sp2-btn.is-active{transform:translateY(1px);box-shadow:inset 0 2px 4px oklch(from var(--sp2-cta) calc(l - 0.2) c h / 0.45),inset 0 -2px 0 oklch(from var(--sp2-cta) calc(l - 0.16) c h),0 1px 2px oklch(from var(--sp2-shadow) l c h / 0.3)}
.cf-subscription-picker-2 .sp2-btn:focus-visible{outline:3px solid oklch(from var(--field-focus,var(--accent)) l c h / 0.55);outline-offset:3px}
.cf-subscription-picker-2 .sp2-btn:disabled{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;cursor:not-allowed;transform:none}
.cf-subscription-picker-2 .sp2-btn-price{font-variant-numeric:tabular-nums}
.cf-subscription-picker-2 .sp2-ps{margin:24px 0 0;max-width:64ch;font-size:1.0625rem;line-height:1.5;color:var(--ink);text-wrap:pretty}
.cf-subscription-picker-2 .sp2-ps strong{font-weight:800}
@container (max-width:619px){
.cf-subscription-picker-2 .sp2-stairs{display:flex;flex-direction:column-reverse;gap:16px}
.cf-subscription-picker-2 .sp2-step{margin-top:0}
.cf-subscription-picker-2 .sp2-step-body{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:'flag flag' 'top price' 'billed price' 'adds adds';column-gap:16px;align-items:start}
.cf-subscription-picker-2 .sp2-flag{grid-area:flag;justify-self:start}
.cf-subscription-picker-2 .sp2-step-top{grid-area:top;flex-direction:row-reverse;justify-content:flex-end;align-items:center}
.cf-subscription-picker-2 .sp2-pricebox{grid-area:price;margin-top:0;align-items:flex-end;text-align:right}
.cf-subscription-picker-2 .sp2-fig{font-size:2.5rem}
.cf-subscription-picker-2 .sp2-billed{grid-area:billed;margin-top:6px;padding-inline-start:38px}
.cf-subscription-picker-2 .sp2-adds{grid-area:adds}
.cf-subscription-picker-2 .sp2-checkout{flex-direction:column;align-items:stretch}
.cf-subscription-picker-2 .sp2-btn{width:100%}
}
@media (max-width:1080px){
.cf-subscription-picker-2 .sp2-stage{grid-template-columns:minmax(0,1fr)}
.cf-subscription-picker-2 .sp2-boxwrap{position:static}
}
@media (max-width:560px){
.cf-subscription-picker-2 .sp2-photo{aspect-ratio:4/3}
}
@keyframes sp2-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes sp2-pop{from{transform:scale(.9)}to{transform:none}}
@media (prefers-reduced-motion:reduce){
.cf-subscription-picker-2 .sp2-step,.cf-subscription-picker-2 .sp2-flag{animation:none}
.cf-subscription-picker-2 .sp2-step,.cf-subscription-picker-2 .sp2-step::after,.cf-subscription-picker-2 .sp2-btn,.cf-subscription-picker-2 .sp2-tog,.cf-subscription-picker-2 .sp2-dot{transition:none}
.cf-subscription-picker-2 .sp2-step:active:not(:disabled),.cf-subscription-picker-2 .sp2-btn:active:not(:disabled),.cf-subscription-picker-2 .sp2-btn.is-active{transform:none}
}
`
pieces/offer/subscription-picker-2/specimen.tsx 68 lines
import __studioImage48d8ba54 from "../assets/9f0f671163afc3cf.webp";
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
import { SubscriptionPicker2, type SubscriptionPicker2Plan } from '../subscription-picker-2'
const plans: SubscriptionPicker2Plan[] = [
{
id: 'monthly',
name: 'Monthly',
price: 36,
boxes: 2,
months: 1,
billing: 'billed every month',
adds: ['Two fresh boxes a month', 'Free shipping on every box'],
},
{
id: 'quarterly',
name: 'Quarterly',
price: 96,
boxes: 6,
months: 3,
billing: 'billed every 3 months',
adds: ['A stainless brewing basket', 'First pick of new blends'],
},
{
id: 'year',
name: 'Prepaid year',
price: 336,
boxes: 24,
months: 12,
billing: 'billed once a year',
adds: ['A glass teapot in your first box', 'Two bonus seasonal tins'],
},
]
export const states = ['default', 'hover', 'active', 'disabled', 'error']
export default function SubscriptionPicker2Specimen({
state,
}: {
state?: 'default' | 'hover' | 'active' | 'disabled' | 'error'
}) {
return (
<SubscriptionPicker2
headline='Stay a little longer and pay less for every box'
headlineHighlight='pay less for every box'
lead='Kettlefern Tea Club sends two boxes of fresh loose-leaf tea every month. Each step up lowers the price of every box.'
plans={plans}
boxImage={slot(
'product',
__studioImage48d8ba54,
)}
boxImageAlt='A Kettlefern Tea Club box laid out: three tea tins, a jar of oolong, cotton filters, a tasting card and a cup of tea'
boxHeading='Two boxes like this arrive every month'
boxContents={[
'Three loose-leaf teas, 40 g each',
'A small-batch seasonal jar',
'Cotton brewing filters',
'A tasting card with brew times',
]}
skipTerms='Skip any delivery from your account, up to 3 days before it ships.'
cancelTerms='Cancel monthly or quarterly anytime before your next bill.'
billingTerms='The prepaid year is one payment, billed up front.'
ps={`Every step comes with our ${defaults.sample.guarantee}, so your first box is risk free.`}
state={state}
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalSubscriptionPicker2 |
string |
|
headlineHighlight OptionalSubscriptionPicker2 |
string |
|
lead OptionalSubscriptionPicker2 |
string |
|
plans OptionalSubscriptionPicker2 |
SubscriptionPicker2Plan[] |
|
featuredId OptionalSubscriptionPicker2 |
string |
|
defaultPlanId OptionalSubscriptionPicker2 |
string | null |
|
defaultUnit OptionalSubscriptionPicker2 |
SubscriptionPicker2Unit |
|
currency OptionalSubscriptionPicker2 |
string |
|
locale OptionalSubscriptionPicker2 |
string |
|
boxImage OptionalSubscriptionPicker2 |
string |
|
boxImageAlt OptionalSubscriptionPicker2 |
string |
|
boxHeading OptionalSubscriptionPicker2 |
string |
|
boxContents OptionalSubscriptionPicker2 |
string[] |
|
skipTerms OptionalSubscriptionPicker2 |
string |
|
cancelTerms OptionalSubscriptionPicker2 |
string |
|
billingTerms OptionalSubscriptionPicker2 |
string |
|
ps OptionalSubscriptionPicker2 |
string |
|
copy OptionalSubscriptionPicker2 |
Partial<SubscriptionPicker2Copy> |
|
onAction OptionalSubscriptionPicker2 |
(choice: SubscriptionPicker2Choice) => void |
|
state OptionalSubscriptionPicker2 |
'default' | 'hover' | 'active' | 'disabled' | 'error' |
|
className OptionalSubscriptionPicker2 |
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.
product- The main product shot or cover (ebook, kit, bottle).
-
9f0f671163afc3cf.webp
image/webp · 107 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB