Subscription Picker 1
Subscribe-and-save stage: the product lit centre stage beside what arrives in each box, a delivery rail that
Use it in a prompt
Use offer/subscription-picker 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.tsx. - Import it and pass your copy and images (Props tab):
import { SubscriptionPicker } from "@/components/funneldna/offer/subscription-picker"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/subscription-picker/component.tsx 651 lines
// layout: product-stage
// Subscribe-and-save stage: the product lit centre stage beside what arrives in each box, a delivery rail that
// redraws as the visitor picks a cadence, and an add-to-cart card that makes the saving and the daily cost plain.
import * as React from "react"
import { AnimatePresence, motion, useReducedMotion } from "motion/react"
import { AlertCircle, BadgePercent, Check, Package, RotateCcw } from "lucide-react"
import { FX_HOST, Glow } from "../fx/fx"
export type SubscriptionPickerItem = {
name: string
detail?: string
/** item-n slot image (real product photo) */
image?: string
imageAlt?: string
}
export type SubscriptionPickerValues = {
plan: "subscribe" | "once"
/** delivery cadence in days; null for a one-time purchase */
frequencyDays: number | null
/** the price charged for this order */
price: number
}
type CopyKey =
| "plansLegend"
| "subscribeTitle"
| "subscribeNote"
| "onceTitle"
| "onceNote"
| "wasLabel"
| "frequencyLegend"
| "frequencyOption"
| "frequencyPerYear"
| "todayLabel"
| "perDaySubscribe"
| "perDayOnce"
| "subscribeButton"
| "onceButton"
| "commitError"
| "railSubscribe"
| "railOnce"
| "railFlag"
| "railStart"
| "railMid"
| "railEnd"
/** Every visible word. Placeholders replaced as text: {percent}, {amount}, {days}, {count}. */
export type SubscriptionPickerCopy = Record<CopyKey, string>
export type SubscriptionPickerProps = {
headline?: string
/** phrase inside the headline swiped with the marker highlight */
headlineHighlight?: string
lead?: string
/** shown under the product, also its default alt text */
productName?: string
/** product slot image, transparent background */
productImage?: string
productAlt?: string
/** one-time price as a number, e.g. 47 */
oneTimePrice?: number
/** the supplied subscribe-and-save discount in percent, e.g. 15 */
discountPercent?: number
/** explicit subscription price; otherwise the one-time price minus the discount */
subscriptionPrice?: number
currency?: string
locale?: string
/** delivery cadences in days */
frequencies?: number[]
defaultFrequency?: number
defaultPlan?: "subscribe" | "once"
/** heading over the list of what arrives in each delivery */
includesHeading?: string
items?: SubscriptionPickerItem[]
/** guarantee confirmation ticked above the button; empty hides it */
commitLabel?: string
/** cancel-anytime line under the button; empty hides it (use only if the offer supplies it) */
cancelLine?: string
copy?: Partial<SubscriptionPickerCopy>
/** called with the chosen plan when the visitor adds to cart */
onSubmit?: (values: SubscriptionPickerValues) => void
state?: "default" | "hover" | "active" | "disabled" | "error"
className?: string
}
export function SubscriptionPicker(props: SubscriptionPickerProps) {
const {
headline = "Get it delivered and save on every order",
headlineHighlight = "save on every order",
lead = "Choose one-time or subscribe and save, then pick how often it arrives.",
productName = "",
productImage = "",
productAlt,
oneTimePrice = 47,
discountPercent = 15,
subscriptionPrice,
currency = "USD",
locale = "en-US",
frequencies = DEFAULT_FREQUENCIES,
defaultFrequency,
defaultPlan = "subscribe",
includesHeading = "Everything you need arrives in every box",
items = [],
commitLabel = "",
cancelLine = "",
copy: copyOverrides,
onSubmit,
state = "default",
className,
} = props
const copy: SubscriptionPickerCopy = { ...DEFAULT_COPY, ...copyOverrides }
const reduce = useReducedMotion() ?? false
const uid = React.useId()
const errId = `${uid}-commit-error`
const checkRef = React.useRef<HTMLInputElement>(null)
const cadences = React.useMemo(() => {
const list = frequencies.filter((d) => Number.isFinite(d) && d > 0)
return list.length ? list : DEFAULT_FREQUENCIES
}, [frequencies])
const firstCadence = cadences[0] ?? 30
const [plan, setPlan] = React.useState<"subscribe" | "once">(defaultPlan)
const [days, setDays] = React.useState<number>(() =>
defaultFrequency !== undefined && cadences.includes(defaultFrequency) ? defaultFrequency : firstCadence,
)
const [committed, setCommitted] = React.useState(state !== "error")
const [showError, setShowError] = React.useState(state === "error")
React.useEffect(() => {
setCommitted(state !== "error")
setShowError(state === "error")
}, [state])
const money = React.useMemo(() => new Intl.NumberFormat(locale, { style: "currency", currency }), [locale, currency])
const disabled = state === "disabled"
const isSub = plan === "subscribe"
const activeDays = cadences.includes(days) ? days : firstCadence
const subPrice = subscriptionPrice ?? Math.round(oneTimePrice * (100 - discountPercent)) / 100
const saving = Math.max(0, Math.round((oneTimePrice - subPrice) * 100) / 100)
const price = isSub ? subPrice : oneTimePrice
const percent = String(discountPercent)
const count = isSub ? perYear(activeDays) : 1
const maxCount = Math.max(1, ...cadences.map(perYear))
const at = (i: number) => Math.min(100, (i * activeDays * 100) / 365)
const lastAt = isSub ? at(count - 1) : 0
const ease: [number, number, number, number] = [0.2, 0.7, 0.2, 1]
const move = reduce ? { duration: 0 } : { duration: 0.45, ease }
const hasNotes = items.length > 0
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault()
if (disabled) return
if (commitLabel && !committed) {
setShowError(true)
checkRef.current?.focus()
return
}
onSubmit?.({ plan, frequencyDays: isSub ? activeDays : null, price })
}
const buttonClass = ["sp-btn", state === "hover" ? "is-hover" : "", state === "active" ? "is-active" : ""]
.filter(Boolean)
.join(" ")
return (
<section
className={["cf-subscription-picker", className].filter(Boolean).join(" ")}
style={FX_HOST}
aria-labelledby={`${uid}-title`}
>
<Glow />
<style>{CSS}</style>
<div className="sp-wrap">
<header className="sp-head sp-reveal">
<h2 id={`${uid}-title`} className="sp-title">
<Highlighted text={headline} phrase={headlineHighlight} />
</h2>
{lead ? <p className="sp-lead">{lead}</p> : null}
</header>
<div className={hasNotes ? "sp-grid has-notes" : "sp-grid"}>
<div className="sp-stage sp-reveal" style={revealDelay(1)}>
{productImage ? (
<figure className="sp-figure">
<div className="sp-plate">
<img src={productImage} alt={productAlt ?? productName} width={720} height={720} decoding="async" />
</div>
{productName ? <figcaption className="sp-caption">{productName}</figcaption> : null}
</figure>
) : productName ? (
<p className="sp-caption">{productName}</p>
) : null}
<div className="sp-rail">
<div className="sp-rail-head">
<p className="sp-rail-count">{isSub ? fill(copy.railSubscribe, { count }) : copy.railOnce}</p>
<AnimatePresence initial={false}>
{isSub && saving > 0 ? (
<motion.span
key="flag"
className="sp-flag"
initial={reduce ? false : { opacity: 0, scale: 0.9 }}
animate={{ opacity: 1, scale: 1 }}
exit={reduce ? { opacity: 0, transition: { duration: 0 } } : { opacity: 0, scale: 0.9 }}
transition={reduce ? { duration: 0 } : { duration: 0.3, ease }}
>
{fill(copy.railFlag, { percent })}
</motion.span>
) : null}
</AnimatePresence>
</div>
<div className="sp-track" aria-hidden="true">
<motion.span className="sp-track-fill" initial={false} animate={{ width: `${lastAt}%` }} transition={move} />
{Array.from({ length: maxCount }, (_, i) => {
const on = i < count
return (
<motion.span
key={i}
className={i === 0 ? "sp-dot is-first" : "sp-dot"}
style={{ x: "-50%", y: "-50%" }}
initial={false}
animate={{ left: `${on ? at(i) : lastAt}%`, opacity: on ? 1 : 0, scale: on ? 1 : 0.4 }}
transition={reduce ? { duration: 0 } : { duration: 0.45, ease, delay: Math.min(i * 0.02, 0.28) }}
>
{i === 0 ? <Package size={16} strokeWidth={2.5} /> : null}
</motion.span>
)
})}
</div>
<div className="sp-rail-scale" aria-hidden="true">
<span>{copy.railStart}</span>
<span>{copy.railMid}</span>
<span>{copy.railEnd}</span>
</div>
</div>
</div>
{hasNotes ? (
<div className="sp-notes sp-reveal" style={revealDelay(2)}>
{includesHeading ? <h3 className="sp-notes-title">{includesHeading}</h3> : null}
<ul className="sp-items">
{items.map((item, i) => (
<li key={`${item.name}-${i}`} className={item.image ? "sp-item" : "sp-item no-img"}>
{item.image ? (
<img src={item.image} alt={item.imageAlt ?? item.name} width={64} height={64} loading="lazy" decoding="async" />
) : null}
<div>
<p className="sp-item-name">{item.name}</p>
{item.detail ? <p className="sp-item-detail">{item.detail}</p> : null}
</div>
</li>
))}
</ul>
</div>
) : null}
<div className="sp-offer sp-reveal" style={revealDelay(hasNotes ? 3 : 2)}>
<form className="sp-card" onSubmit={handleSubmit} noValidate>
<fieldset className="sp-fieldset" disabled={disabled}>
<fieldset className="sp-plans">
<legend className="sp-sr">{copy.plansLegend}</legend>
<label className={isSub ? "sp-tile is-selected" : "sp-tile"}>
<input
className="sp-sr sp-control"
type="radio"
name={`${uid}-plan`}
value="subscribe"
checked={isSub}
onChange={() => setPlan("subscribe")}
/>
<span className="sp-radio" aria-hidden="true" />
<span className="sp-tile-title">{fill(copy.subscribeTitle, { percent })}</span>
<span className="sp-tile-price">
<span className="sp-tile-num">{money.format(subPrice)}</span>
{saving > 0 ? (
<s className="sp-was">
<span className="sp-sr">{copy.wasLabel} </span>
{money.format(oneTimePrice)}
</s>
) : null}
</span>
{saving > 0 ? (
<span className="sp-tile-note is-save">
<BadgePercent size={16} strokeWidth={2.5} aria-hidden="true" />
{fill(copy.subscribeNote, { amount: money.format(saving) })}
</span>
) : null}
</label>
<label className={isSub ? "sp-tile" : "sp-tile is-selected"}>
<input
className="sp-sr sp-control"
type="radio"
name={`${uid}-plan`}
value="once"
checked={!isSub}
onChange={() => setPlan("once")}
/>
<span className="sp-radio" aria-hidden="true" />
<span className="sp-tile-title">{copy.onceTitle}</span>
<span className="sp-tile-price">
<span className="sp-tile-num">{money.format(oneTimePrice)}</span>
</span>
<span className="sp-tile-note">{copy.onceNote}</span>
</label>
</fieldset>
<AnimatePresence initial={false}>
{isSub ? (
<motion.div
key="freq"
className="sp-freq-wrap"
initial={reduce ? false : { height: 0, opacity: 0 }}
animate={{ height: "auto", opacity: 1 }}
exit={reduce ? { height: 0, opacity: 0, transition: { duration: 0 } } : { height: 0, opacity: 0 }}
transition={move}
>
<fieldset className="sp-freq">
<legend className="sp-freq-legend">{copy.frequencyLegend}</legend>
<div className="sp-seg">
{cadences.map((d) => {
const on = d === activeDays
return (
<label key={d} className={on ? "sp-seg-opt is-selected" : "sp-seg-opt"}>
<input
className="sp-sr sp-control"
type="radio"
name={`${uid}-freq`}
value={d}
checked={on}
onChange={() => setDays(d)}
/>
<span className="sp-seg-days">{fill(copy.frequencyOption, { days: d })}</span>
<span className="sp-seg-year">{fill(copy.frequencyPerYear, { count: perYear(d) })}</span>
</label>
)
})}
</div>
</fieldset>
</motion.div>
) : null}
</AnimatePresence>
<div className="sp-total" aria-live="polite">
<p className="sp-total-figure">
<motion.span
key={`${plan}-${price}`}
className="sp-total-price"
initial={reduce ? false : { opacity: 0.82, y: 8 }}
animate={{ opacity: 1, y: 0 }}
transition={move}
>
{money.format(price)}
</motion.span>
<span className="sp-total-today">{copy.todayLabel}</span>
</p>
<p className="sp-total-perday">
{isSub
? fill(copy.perDaySubscribe, { amount: money.format(subPrice / activeDays), days: activeDays })
: copy.perDayOnce}
</p>
</div>
{commitLabel ? (
<div className="sp-commit-block">
<label className={showError ? "sp-commit is-invalid" : "sp-commit"}>
<input
ref={checkRef}
className="sp-sr sp-control"
type="checkbox"
checked={committed}
aria-invalid={showError || undefined}
aria-describedby={showError ? errId : undefined}
onChange={(event) => {
setCommitted(event.target.checked)
if (event.target.checked) setShowError(false)
}}
/>
<span className="sp-check" aria-hidden="true">
<Check size={16} strokeWidth={3} />
</span>
<span>{commitLabel}</span>
</label>
{showError ? (
<p id={errId} className="sp-error" role="alert">
<AlertCircle size={16} strokeWidth={2.5} aria-hidden="true" />
{copy.commitError}
</p>
) : null}
</div>
) : null}
<button type="submit" className={buttonClass} disabled={disabled}>
{isSub ? copy.subscribeButton : copy.onceButton}
</button>
{cancelLine ? (
<p className="sp-cancel">
<RotateCcw size={16} strokeWidth={2.5} aria-hidden="true" />
{cancelLine}
</p>
) : null}
</fieldset>
</form>
</div>
</div>
</div>
</section>
)
}
export default SubscriptionPicker
const DEFAULT_FREQUENCIES = [30, 60, 90]
const DEFAULT_COPY: SubscriptionPickerCopy = {
plansLegend: "Choose how you buy",
subscribeTitle: "Subscribe & save {percent}%",
subscribeNote: "Save {amount} on every delivery",
onceTitle: "One-time purchase",
onceNote: "Ships once, no subscription.",
wasLabel: "One-time price",
frequencyLegend: "Deliver every",
frequencyOption: "{days} days",
frequencyPerYear: "{count} a year",
todayLabel: "today",
perDaySubscribe: "About {amount} a day, delivered every {days} days.",
perDayOnce: "One payment, one delivery.",
subscribeButton: "Subscribe & add to cart",
onceButton: "Add to cart",
commitError: "Tick the box above to confirm, then add it to your cart.",
railSubscribe: "{count} deliveries a year",
railOnce: "1 delivery, no repeats",
railFlag: "Save {percent}% each time",
railStart: "Today",
railMid: "6 months",
railEnd: "1 year",
}
function perYear(days: number) {
return Math.max(1, Math.round(365 / days))
}
function fill(template: string, values: Record<string, string | number>) {
return Object.keys(values).reduce((out, key) => out.split("{" + key + "}").join(String(values[key])), template)
}
function revealDelay(index: number) {
return { "--i": index } as React.CSSProperties
}
function Highlighted({ text, phrase }: { text: string; phrase?: string }) {
const at = phrase ? text.indexOf(phrase) : -1
if (!phrase || at < 0) return <>{text}</>
return (
<>
{text.slice(0, at)}
<span className="sp-mark">{phrase}</span>
{text.slice(at + phrase.length)}
</>
)
}
// The marker phrase sits on the dark band, so its ink is derived from the marker's own lightness
// (dark ink on a light marker, light ink on a dark one) and the stroke covers the full letter height.
// Documented fixed values: #fae37c is the contract's marker default and #fff the white glyph on the solid
// success checkbox; both appear only as the last fallback inside var().
// The native radios and checkbox are visually hidden (their drawn twins .sp-radio / .sp-check carry the look);
// .sp-control still reads the field role tokens so the native control and its accent follow the theme.
const CSS = `
.cf-subscription-picker{
--sp-ink:var(--ink, oklch(0.21 0.034 263));
--sp-muted:var(--muted, oklch(0.45 0.03 258));
--sp-card:var(--card, oklch(1 0 0));
--sp-band:var(--band, oklch(0.27 0.067 256));
--sp-band-ink:var(--band-ink, oklch(1 0 0));
--sp-band-soft:color-mix(in oklab, var(--sp-band-ink) 84%, var(--sp-band));
--sp-accent:var(--accent, oklch(0.5 0.17 257));
--sp-shadow:var(--shadow, oklch(0.22 0.03 256));
--sp-marker:var(--marker, #fae37c);
--sp-focus:oklch(from var(--field-focus, var(--sp-accent)) l c h / 0.45);
--sp-quiet:color-mix(in oklch, var(--sp-ink) 4%, var(--sp-card));
--sp-quiet-hover:color-mix(in oklch, var(--sp-ink) 7%, var(--sp-card));
--sp-pick:color-mix(in oklch, var(--sp-accent) 10%, var(--sp-card));
--sp-edge:oklch(from var(--sp-ink) l c h / 0.1);
--sp-ease:cubic-bezier(.2,.7,.2,1);
position:relative;
isolation:isolate;
overflow:clip;
background:var(--sp-band);
color:var(--sp-band-ink);
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);
}
.cf-subscription-picker *,.cf-subscription-picker *::before,.cf-subscription-picker *::after{box-sizing:border-box}
.cf-subscription-picker :where(h2,h3,p,ul,figure,fieldset,legend){margin:0}
.cf-subscription-picker .sp-wrap{position:relative;z-index:1;max-width:1120px;margin:0 auto}
.cf-subscription-picker .sp-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.cf-subscription-picker .sp-control{background:var(--field, var(--sp-card));color:var(--field-ink, var(--sp-ink));border-radius:var(--field-radius, var(--radius, 12px));accent-color:var(--field-focus, var(--sp-accent))}
.cf-subscription-picker .sp-head{max-width:46rem;margin:0 auto clamp(32px, 4vw, 48px);text-align:center}
.cf-subscription-picker .sp-title{font-family:var(--font-display, inherit);font-weight:var(--display-weight, 800);letter-spacing:var(--display-tracking, -0.025em);text-transform:var(--display-case, none);font-size:clamp(2rem, 3.6vw, 3.25rem);line-height:1.06;text-wrap:balance;color:var(--sp-band-ink)}
.cf-subscription-picker .sp-mark{
color:oklch(from var(--sp-marker) calc((0.64 - l) * 1000) 0.02 h / 1);
background:linear-gradient(to bottom, transparent 7%, oklch(from var(--sp-marker) l c h / 1) 7%, oklch(from var(--sp-marker) l c h / 1) 97%, transparent 97%);
padding:0 .14em;
margin:0 -.02em;
border-radius:.18em .42em .26em .36em;
-webkit-box-decoration-break:clone;
box-decoration-break:clone;
}
.cf-subscription-picker .sp-lead{margin:16px auto 0;max-width:60ch;font-size:clamp(1.125rem, 1.5vw, 1.375rem);line-height:1.4;font-weight:500;color:var(--sp-band-soft);text-wrap:balance}
.cf-subscription-picker .sp-grid{display:grid;gap:clamp(32px, 4vw, 48px);grid-template-columns:minmax(0,1fr);grid-template-areas:'stage' 'offer';align-items:start}
.cf-subscription-picker .sp-grid.has-notes{grid-template-areas:'stage' 'notes' 'offer'}
.cf-subscription-picker .sp-stage{grid-area:stage}
.cf-subscription-picker .sp-notes{grid-area:notes;min-width:0}
.cf-subscription-picker .sp-offer{grid-area:offer;min-width:0}
@media (min-width:760px){
.cf-subscription-picker .sp-grid,.cf-subscription-picker .sp-grid.has-notes{grid-template-columns:minmax(0,1fr) minmax(320px,380px);grid-template-areas:'stage offer';column-gap:clamp(32px, 4vw, 48px)}
.cf-subscription-picker .sp-grid.has-notes{grid-template-areas:'stage offer' 'notes offer';grid-template-rows:auto 1fr}
.cf-subscription-picker .sp-offer{position:sticky;top:24px}
}
@media (min-width:1180px){
.cf-subscription-picker .sp-grid{grid-template-columns:minmax(0,1fr) 400px}
.cf-subscription-picker .sp-grid.has-notes{grid-template-columns:minmax(0,.85fr) minmax(0,1fr) 400px;grid-template-areas:'notes stage offer';grid-template-rows:auto;column-gap:40px}
}
.cf-subscription-picker .sp-stage{display:flex;flex-direction:column;align-items:center;text-align:center;min-width:0}
.cf-subscription-picker .sp-figure{width:min(100%, 360px);display:flex;flex-direction:column;align-items:center;gap:12px}
.cf-subscription-picker .sp-plate{position:relative;width:100%;aspect-ratio:1/1;display:grid;place-items:center}
.cf-subscription-picker .sp-plate::before{content:'';position:absolute;left:14%;right:14%;bottom:6%;height:10%;border-radius:50%;background:radial-gradient(closest-side, oklch(from var(--sp-shadow) calc(l - 0.12) c h / 0.55), oklch(from var(--sp-shadow) calc(l - 0.12) c h / 0))}
.cf-subscription-picker .sp-plate img{position:relative;display:block;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 2px 3px oklch(from var(--sp-shadow) calc(l - 0.1) c h / 0.5)) drop-shadow(0 16px 18px oklch(from var(--sp-shadow) calc(l - 0.1) c h / 0.45))}
.cf-subscription-picker .sp-caption{font-weight:800;line-height:1.3;color:var(--sp-band-ink);text-wrap:balance}
@media (max-width:759px){.cf-subscription-picker .sp-figure{width:min(78vw, 300px)}}
.cf-subscription-picker .sp-rail{width:100%;max-width:440px;margin-top:24px;text-align:left}
.cf-subscription-picker .sp-rail-head{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px 12px;min-height:32px;margin-bottom:12px}
.cf-subscription-picker .sp-rail-count{font-weight:800;line-height:1.3;color:var(--sp-band-ink);font-variant-numeric:tabular-nums}
.cf-subscription-picker .sp-flag{display:inline-flex;align-items:center;min-height:28px;padding:4px 12px;border-radius:999px;font-size:.875rem;line-height:1.2;font-weight:800;white-space:nowrap;background:var(--accent-fill, var(--sp-accent));color:var(--accent-fill-ink, var(--sp-card))}
.cf-subscription-picker .sp-track{position:relative;height:32px;margin:0 14px}
.cf-subscription-picker .sp-track::before,.cf-subscription-picker .sp-track-fill{position:absolute;left:0;top:50%;height:2px;margin-top:-1px;border-radius:2px}
.cf-subscription-picker .sp-track::before{content:'';right:0;background:oklch(from var(--sp-band-ink) l c h / 0.22)}
.cf-subscription-picker .sp-track-fill{display:block;background:oklch(from var(--sp-band-ink) l c h / 0.7)}
.cf-subscription-picker .sp-dot{position:absolute;top:50%;width:10px;height:10px;border-radius:50%;background:var(--sp-band-ink)}
.cf-subscription-picker .sp-dot.is-first{width:28px;height:28px;display:grid;place-items:center;color:var(--sp-band)}
.cf-subscription-picker .sp-rail-scale{display:grid;grid-template-columns:1fr auto 1fr;gap:12px;margin-top:8px;font-size:.875rem;line-height:1.2;font-weight:800;color:var(--sp-band-soft);font-variant-numeric:tabular-nums}
.cf-subscription-picker .sp-rail-scale span{white-space:nowrap}
.cf-subscription-picker .sp-rail-scale span:nth-child(2){text-align:center}
.cf-subscription-picker .sp-rail-scale span:last-child{text-align:right}
.cf-subscription-picker .sp-notes-title{font-family:var(--font-display, inherit);font-weight:var(--display-weight, 800);text-transform:var(--display-case, none);font-size:clamp(1.3125rem, 1.8vw, 1.625rem);line-height:1.15;letter-spacing:-0.01em;text-wrap:balance;color:var(--sp-band-ink);margin-bottom:24px}
.cf-subscription-picker .sp-items{list-style:none;padding:0;display:grid}
.cf-subscription-picker .sp-item{display:grid;grid-template-columns:64px minmax(0,1fr);gap:16px;align-items:start;padding:16px 0;border-top:1px solid oklch(from var(--sp-band-ink) l c h / 0.14)}
.cf-subscription-picker .sp-item:first-child{padding-top:0;border-top:0}
.cf-subscription-picker .sp-item.no-img{grid-template-columns:minmax(0,1fr)}
.cf-subscription-picker .sp-item img{display:block;width:64px;height:64px;border-radius:8px;object-fit:cover}
.cf-subscription-picker .sp-item-name{font-weight:800;line-height:1.3;color:var(--sp-band-ink);text-wrap:balance}
.cf-subscription-picker .sp-item-detail{margin-top:4px;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--sp-band-soft);text-wrap:pretty}
.cf-subscription-picker .sp-card{container-type:inline-size;background:var(--sp-card);color:var(--sp-ink);border:1px solid var(--card-border, oklch(from var(--sp-ink) l c h / 0.12));border-radius:var(--card-radius, var(--radius, 14px));box-shadow:var(--card-shadow, var(--shadow-lg, 0 2px 4px oklch(from var(--sp-shadow) l c h / 0.22), 0 12px 24px -8px oklch(from var(--sp-shadow) l c h / 0.32)));padding:clamp(20px, 3vw, 32px);text-align:left}
.cf-subscription-picker .sp-fieldset{border:0;padding:0;min-width:0;display:flex;flex-direction:column}
.cf-subscription-picker .sp-fieldset > * + *{margin-top:24px}
.cf-subscription-picker .sp-fieldset > .sp-freq-wrap{margin-top:0}
.cf-subscription-picker .sp-commit-block + .sp-btn,.cf-subscription-picker .sp-fieldset > .sp-cancel{margin-top:16px}
.cf-subscription-picker .sp-plans{border:0;padding:0;min-width:0;display:grid;gap:12px}
.cf-subscription-picker .sp-tile{position:relative;display:grid;grid-template-columns:24px minmax(0,1fr) auto;grid-template-areas:'radio title price' 'radio note note';column-gap:12px;row-gap:4px;align-items:start;padding:16px;border:2px solid var(--sp-edge);border-radius:var(--radius, 12px);background:var(--sp-quiet);cursor:pointer;transition:background .16s ease, border-color .16s ease, box-shadow .16s ease}
.cf-subscription-picker .sp-fieldset:not(:disabled) .sp-tile:not(.is-selected):hover{background:var(--sp-quiet-hover)}
.cf-subscription-picker .sp-tile.is-selected{background:var(--sp-pick);border-color:var(--sp-accent);box-shadow:var(--shadow-sm, 0 1px 2px oklch(from var(--sp-shadow) l c h / 0.2))}
.cf-subscription-picker .sp-tile:has(input:focus-visible){outline:3px solid var(--sp-focus);outline-offset:2px}
.cf-subscription-picker .sp-radio{grid-area:radio;position:relative;width:22px;height:22px;margin-top:2px;border-radius:50%;border:2px solid var(--field-border, oklch(from var(--sp-ink) l c h / 0.4));background:var(--field, var(--sp-card))}
.cf-subscription-picker .sp-radio::after{content:'';position:absolute;inset:3px;border-radius:50%;background:var(--sp-accent);transform:scale(0);transition:transform .16s ease}
.cf-subscription-picker .is-selected .sp-radio{border-color:var(--sp-accent)}
.cf-subscription-picker .is-selected .sp-radio::after{transform:scale(1)}
.cf-subscription-picker .sp-tile-title{grid-area:title;font-weight:800;line-height:1.3;text-wrap:balance}
.cf-subscription-picker .sp-tile-price{grid-area:price;display:flex;flex-direction:column;align-items:flex-end;gap:4px;text-align:right}
.cf-subscription-picker .sp-tile-num{font-family:var(--font-display, inherit);font-weight:var(--display-weight, 800);font-size:clamp(1.3125rem, 1.8vw, 1.625rem);line-height:1;letter-spacing:-0.02em;font-variant-numeric:tabular-nums}
.cf-subscription-picker .sp-was{font-size:.9375rem;line-height:1.2;font-weight:600;color:var(--sp-muted);text-decoration:line-through;text-decoration-color:var(--danger, oklch(0.5 0.17 27));text-decoration-thickness:2px;font-variant-numeric:tabular-nums}
.cf-subscription-picker .sp-tile-note{grid-area:note;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--sp-muted);text-wrap:pretty}
.cf-subscription-picker .sp-tile-note.is-save{color:var(--sp-ink);font-weight:700}
.cf-subscription-picker .sp-tile-note svg,.cf-subscription-picker .sp-error svg,.cf-subscription-picker .sp-cancel svg{display:inline-block;vertical-align:-0.15em;margin-inline-end:.4em}
.cf-subscription-picker .sp-tile-note svg{color:var(--success, oklch(0.5 0.14 150))}
.cf-subscription-picker .sp-freq-wrap{overflow:hidden;margin-inline:-4px}
.cf-subscription-picker .sp-freq{border:0;min-width:0;padding:24px 4px 4px}
.cf-subscription-picker .sp-freq-legend{float:left;width:100%;padding:0;margin-bottom:12px;font-weight:700;line-height:1.3;color:var(--sp-ink)}
.cf-subscription-picker .sp-seg{clear:both;display:grid;grid-template-columns:repeat(auto-fit, minmax(84px, 1fr));gap:8px}
.cf-subscription-picker .sp-seg-opt{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;min-height:64px;padding:8px 12px;text-align:center;border:2px solid var(--sp-edge);border-radius:var(--radius, 12px);background:var(--sp-quiet);cursor:pointer;transition:background .16s ease, border-color .16s ease, box-shadow .16s ease}
.cf-subscription-picker .sp-fieldset:not(:disabled) .sp-seg-opt:not(.is-selected):hover{background:var(--sp-quiet-hover)}
.cf-subscription-picker .sp-seg-opt.is-selected{background:var(--sp-pick);border-color:var(--sp-accent);box-shadow:var(--shadow-sm, 0 1px 2px oklch(from var(--sp-shadow) l c h / 0.2))}
.cf-subscription-picker .sp-seg-opt:has(input:focus-visible){outline:3px solid var(--sp-focus);outline-offset:2px}
.cf-subscription-picker .sp-seg-days{font-weight:800;line-height:1.2;font-variant-numeric:tabular-nums;white-space:nowrap}
.cf-subscription-picker .sp-seg-year{font-size:.9375rem;line-height:1.3;font-weight:500;color:var(--sp-muted);white-space:nowrap}
.cf-subscription-picker .sp-total{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;padding:16px;border-radius:var(--radius, 10px);background:var(--sp-quiet)}
.cf-subscription-picker .sp-total-figure{display:flex;align-items:baseline;gap:8px;flex:0 0 auto}
.cf-subscription-picker .sp-total-price{display:inline-block;font-family:var(--font-display, inherit);font-weight:var(--display-weight, 800);font-size:clamp(2.5rem, 4.2vw, 3.75rem);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums;color:var(--sp-ink)}
.cf-subscription-picker .sp-total-today{font-size:.9375rem;line-height:1.2;font-weight:600;color:var(--sp-muted)}
.cf-subscription-picker .sp-total-perday{flex:1 1 160px;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--sp-ink);text-wrap:pretty}
.cf-subscription-picker .sp-commit{position:relative;display:grid;grid-template-columns:24px minmax(0,1fr);gap:12px;align-items:start;cursor:pointer;line-height:1.45;font-weight:600;color:var(--label-ink, var(--sp-ink));text-wrap:pretty}
.cf-subscription-picker .sp-check{width:24px;height:24px;margin-top:1px;border-radius:6px;border:2px solid var(--field-border, oklch(from var(--sp-ink) l c h / 0.45));background:var(--field, var(--sp-card));display:grid;place-items:center;color:transparent;transition:background .16s ease, border-color .16s ease}
.cf-subscription-picker .sp-commit input:checked + .sp-check{background:var(--success, oklch(0.5 0.14 150));border-color:var(--success, oklch(0.5 0.14 150));color:var(--sp-check-glyph, #fff)}
.cf-subscription-picker .sp-commit:has(input:focus-visible) .sp-check{outline:3px solid var(--sp-focus);outline-offset:2px}
.cf-subscription-picker .sp-commit.is-invalid .sp-check{border-color:var(--danger, oklch(0.5 0.17 27))}
.cf-subscription-picker .sp-fieldset:disabled .sp-tile,.cf-subscription-picker .sp-fieldset:disabled .sp-seg-opt,.cf-subscription-picker .sp-fieldset:disabled .sp-commit{cursor:not-allowed}
.cf-subscription-picker .sp-error{margin-top:12px;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--danger, oklch(0.5 0.17 27));text-wrap:pretty}
.cf-subscription-picker .sp-btn{
--sp-bg:var(--button-bg, var(--cta, oklch(0.58 0.21 29)));
--sp-bg-2:var(--button-bg-2, var(--cta-2, oklch(0.51 0.21 29)));
appearance:none;width:100%;min-height:64px;padding:12px 20px;
display:inline-flex;align-items:center;justify-content:center;text-align:center;
border:0;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);
font-size:clamp(1.0625rem, 5.6cqi, 1.3125rem);
line-height:1.15;letter-spacing:normal;text-wrap:balance;
color:var(--button-ink, var(--cta-ink, oklch(1 0 0)));text-shadow:var(--button-text-shadow, none);
background:linear-gradient(oklch(from var(--sp-bg) calc(l + 0.04) c h), oklch(from var(--sp-bg-2) calc(l - 0.02) c h));
box-shadow:var(--button-shadow, inset 0 1px 0 oklch(from var(--sp-bg) calc(l + 0.14) c h / 0.7), inset 0 -3px 0 oklch(from var(--sp-bg) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--sp-shadow) l c h / 0.35), 0 8px 16px -6px oklch(from var(--sp-shadow) l c h / 0.45));
cursor:pointer;transition:transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.cf-subscription-picker .sp-btn:not(:disabled):hover,.cf-subscription-picker .sp-btn.is-hover:not(:disabled){
background:linear-gradient(oklch(from var(--sp-bg) calc(l - 0.01) c h), oklch(from var(--sp-bg-2) calc(l - 0.07) c h));
box-shadow:inset 0 1px 0 oklch(from var(--sp-bg) calc(l + 0.12) c h / 0.6), inset 0 -3px 0 oklch(from var(--sp-bg) calc(l - 0.18) c h), 0 1px 2px oklch(from var(--sp-shadow) l c h / 0.38), 0 10px 18px -6px oklch(from var(--sp-shadow) l c h / 0.52);
transform:translateY(-1px);
}
.cf-subscription-picker .sp-btn:not(:disabled):active,.cf-subscription-picker .sp-btn.is-active:not(:disabled){
background:linear-gradient(oklch(from var(--sp-bg) calc(l - 0.04) c h), oklch(from var(--sp-bg-2) calc(l - 0.08) c h));
box-shadow:inset 0 2px 4px oklch(from var(--sp-shadow) l c h / 0.35), inset 0 -2px 0 oklch(from var(--sp-bg) calc(l - 0.16) c h), 0 1px 1px oklch(from var(--sp-shadow) l c h / 0.3);
transform:translateY(1px);
}
.cf-subscription-picker .sp-btn:focus-visible{outline:3px solid oklch(from var(--field-focus, var(--sp-accent)) l c h / 0.6);outline-offset:3px}
.cf-subscription-picker .sp-btn:disabled{background:var(--secondary, oklch(0.93 0.015 263));color:var(--secondary-ink, var(--sp-ink));text-shadow:none;box-shadow:none;cursor:not-allowed;transform:none}
.cf-subscription-picker .sp-cancel{text-align:center;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--sp-muted);text-wrap:pretty}
.cf-subscription-picker .sp-reveal{animation:cf-subscription-picker-rise .45s var(--sp-ease) both;animation-delay:calc(var(--i, 0) * .07s)}
@keyframes cf-subscription-picker-rise{from{opacity:.82;transform:translateY(8px)}}
@media (prefers-reduced-motion: reduce){
.cf-subscription-picker .sp-reveal{animation:none}
.cf-subscription-picker .sp-tile,.cf-subscription-picker .sp-seg-opt,.cf-subscription-picker .sp-btn,.cf-subscription-picker .sp-radio::after,.cf-subscription-picker .sp-check{transition:none}
.cf-subscription-picker .sp-btn:not(:disabled):hover,.cf-subscription-picker .sp-btn.is-hover:not(:disabled),.cf-subscription-picker .sp-btn:not(:disabled):active,.cf-subscription-picker .sp-btn.is-active:not(:disabled){transform:none}
}
`
pieces/offer/subscription-picker/specimen.tsx 43 lines
import __studioImagece02ea82 from "../assets/fd29efab741decb6.webp";
import defaults from "../../studio-defaults.json"
import { slot } from "../../slots"
import { SubscriptionPicker } from "../subscription-picker"
export const states = ["default", "hover", "active", "disabled", "error"]
type SpecimenState = "default" | "hover" | "active" | "disabled" | "error"
const sample = defaults.sample
const discount = 15
const oneTimePrice = Number(sample.price.replace(/[^0-9.]/g, "")) || 47
const itemSlots = ["item-1", "item-2", "item-3"] as const
export default function SubscriptionPickerSpecimen({ state = "default" }: { state?: SpecimenState }) {
return (
<SubscriptionPicker
state={state}
headline={`Keep a fresh kit on your desk and save ${discount}% on every box`}
headlineHighlight={`save ${discount}% on every box`}
lead="The printed guide, workbook and launch checklist, shipped on the schedule you pick."
productName={`${sample.name}, printed edition`}
productAlt={`${sample.name}: printed planning guide, workbook and checklist pad`}
productImage={slot(
"product",
__studioImagece02ea82,
)}
oneTimePrice={oneTimePrice}
discountPercent={discount}
frequencies={[30, 60, 90]}
defaultFrequency={30}
includesHeading="Everything for your next launch, in every box"
items={sample.items.map((item, index) => ({
name: item.name,
detail: item.detail,
image: slot(itemSlots[index] ?? "item-1", item.image),
imageAlt: item.imageAlt,
}))}
commitLabel={`I understand I'm covered by the ${sample.guarantee}.`}
cancelLine="Skip, change or cancel any delivery from your account."
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalSubscriptionPicker |
string |
|
headlineHighlight OptionalSubscriptionPicker |
string |
|
lead OptionalSubscriptionPicker |
string |
|
productName OptionalSubscriptionPicker |
string |
|
productImage OptionalSubscriptionPicker |
string |
|
productAlt OptionalSubscriptionPicker |
string |
|
oneTimePrice OptionalSubscriptionPicker |
number |
|
discountPercent OptionalSubscriptionPicker |
number |
|
subscriptionPrice OptionalSubscriptionPicker |
number |
|
currency OptionalSubscriptionPicker |
string |
|
locale OptionalSubscriptionPicker |
string |
|
frequencies OptionalSubscriptionPicker |
number[] |
|
defaultFrequency OptionalSubscriptionPicker |
number |
|
defaultPlan OptionalSubscriptionPicker |
"subscribe" | "once" |
|
includesHeading OptionalSubscriptionPicker |
string |
|
items OptionalSubscriptionPicker |
SubscriptionPickerItem[] |
|
commitLabel OptionalSubscriptionPicker |
string |
|
cancelLine OptionalSubscriptionPicker |
string |
|
copy OptionalSubscriptionPicker |
Partial<SubscriptionPickerCopy> |
|
onSubmit OptionalSubscriptionPicker |
(values: SubscriptionPickerValues) => void |
|
state OptionalSubscriptionPicker |
"default" | "hover" | "active" | "disabled" | "error" |
|
className OptionalSubscriptionPicker |
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.
--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--field-radius- 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).
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB
-
fd29efab741decb6.webp
image/webp · 103 KB