Subscribe Save 1
Subscribe & save buy-box toggle. It anchors the subscription against buying one at a time, recomputes the yearly
Use it in a prompt
Use offer/subscribe-save 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/subscribe-save.tsx. - Import it and pass your copy and images (Props tab):
import { SubscribeSave } from "@/components/funneldna/offer/subscribe-save"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/subscribe-save/component.tsx 401 lines
// layout: price-staircase
// Subscribe & save buy-box toggle. It anchors the subscription against buying one at a time, recomputes the yearly
// saving for the chosen delivery frequency from the supplied prices, and passes the choice to the add-to-cart action.
import * as React from 'react';
import { Check, ChevronDown, PiggyBank, ShieldCheck } from 'lucide-react';
export type SubscribeSaveChoice = 'subscribe' | 'one-time';
export type SubscribeSaveFrequency = {
/** Days between deliveries. */
days: number;
/** Option text. Defaults to copy.frequencyOption. */
label?: string;
/** Deliveries in a year for the saving line. Defaults to Math.floor(365 / days). */
perYear?: number;
};
/** A short line with a bold lead-in phrase. */
export type SubscribeSaveLine = { lead: string; text?: string };
export type SubscribeSaveCopy = {
legend: string;
subscribeTitle: string;
/** Template: {percent} is the supplied save percent. */
saveChip: string;
subscribeNote: string;
oneTimeTitle: string;
oneTimeNote: string;
regularPriceLabel: string;
frequencyLabel: string;
/** Template: {days}. */
frequencyOption: string;
/** Bold lead-in template: {amount} is the computed yearly saving. */
savingLead: string;
savingText: string;
/** Button second-line templates: {price} and {days}. */
subscribeSub: string;
oneTimeSub: string;
};
export type SubscribeSaveAction = {
purchase: SubscribeSaveChoice;
frequencyDays?: number;
price: number;
currency: string;
};
export type SubscribeSaveProps = {
/** One-time price per unit. Every other price is computed from it. */
price: number;
/** Subscribe & save discount in percent, e.g. 20. */
savePercent: number;
/** ISO currency code used for formatting. */
currency?: string;
locale?: string;
frequencies?: SubscribeSaveFrequency[];
/** Days of the frequency chosen at start. Defaults to the first one. */
defaultFrequency?: number;
defaultChoice?: SubscribeSaveChoice;
/** product slot: transparent cut-out of one unit. */
productImage?: string;
/** Subscription perks (skip, cancel anytime). Shown only when supplied. */
notes?: SubscribeSaveLine[];
/** Risk reversal under the button. Shown only when supplied. */
guarantee?: SubscribeSaveLine;
actionLabel?: string;
copy?: Partial<SubscribeSaveCopy>;
/** Add-to-cart: receives the chosen purchase, frequency and price. */
onAction?: (detail: SubscribeSaveAction) => void;
state?: 'default' | 'hover' | 'active' | 'disabled';
className?: string;
};
const COPY: SubscribeSaveCopy = {
legend: 'Choose how you buy',
subscribeTitle: 'Subscribe & save',
saveChip: 'Save {percent}%',
subscribeNote: '',
oneTimeTitle: 'One-time purchase',
oneTimeNote: '',
regularPriceLabel: 'Regular price',
frequencyLabel: 'Deliver every',
frequencyOption: '{days} days',
savingLead: 'Save {amount} a year',
savingText: 'vs. buying one at a time.',
subscribeSub: '{price} every {days} days',
oneTimeSub: '{price} one-time',
};
const DEFAULT_FREQUENCIES: SubscribeSaveFrequency[] = [{ days: 30 }, { days: 60 }, { days: 90 }];
export function SubscribeSave(props: SubscribeSaveProps) {
const {
price,
savePercent,
currency = 'USD',
locale = 'en-US',
frequencies = DEFAULT_FREQUENCIES,
defaultFrequency,
defaultChoice = 'subscribe',
productImage,
notes = [],
guarantee,
actionLabel = 'Add to cart',
onAction,
state = 'default',
className = '',
} = props;
const c: SubscribeSaveCopy = { ...COPY, ...props.copy };
const uid = React.useId();
const [choice, setChoice] = React.useState<SubscribeSaveChoice>(defaultChoice);
const [days, setDays] = React.useState<number>(defaultFrequency ?? frequencies[0]?.days ?? 30);
const disabled = state === 'disabled';
const forced = state === 'hover' ? ' is-hover' : state === 'active' ? ' is-press' : '';
const subOn = choice === 'subscribe';
const money = (n: number) => formatMoney(n, currency, locale);
const subPrice = round2(price * (1 - savePercent / 100));
const perDelivery = round2(price - subPrice);
const savings = frequencies.map((f) => ({
...f,
saving: round2(perDelivery * (f.perYear ?? Math.floor(365 / f.days))),
}));
const current = savings.find((f) => f.days === days) ?? savings[0];
const stairs = [...savings].sort((a, b) => a.saving - b.saving);
const maxSaving = Math.max(0, ...savings.map((s) => s.saving));
const amount = current ? money(current.saving) : '';
const [before, after = ''] = c.savingLead.split('{amount}');
const thumbCls = productImage ? '' : ' no-thumb';
const pick = (next: SubscribeSaveChoice) => {
if (!disabled) setChoice(next);
};
const act = () => {
if (disabled) return;
onAction?.({
purchase: choice,
frequencyDays: subOn ? current?.days : undefined,
price: subOn ? subPrice : price,
currency,
});
};
const subLine = subOn
? fill(c.subscribeSub, { price: money(subPrice), days: current?.days ?? days })
: fill(c.oneTimeSub, { price: money(price) });
return (
<div className={'cf-subscribe-save' + (disabled ? ' is-disabled' : '') + (className ? ' ' + className : '')}>
<style>{CSS}</style>
<fieldset className='ss-set' disabled={disabled}>
<legend className='ss-sr'>{c.legend}</legend>
<div className={'ss-row ss-row-sub' + (subOn ? ' is-on' : forced) + thumbCls} onClick={() => pick('subscribe')}>
<input
id={uid + '-sub'}
className='ss-radio'
type='radio'
name={uid + '-buy'}
value='subscribe'
checked={subOn}
onChange={() => pick('subscribe')}
/>
{productImage ? (
<span className='ss-thumb ss-thumb-stack' aria-hidden='true'>
<img className='ss-back' src={productImage} alt='' />
<img className='ss-front' src={productImage} alt='' />
</span>
) : null}
<div className='ss-main'>
<label htmlFor={uid + '-sub'} className='ss-title'>
<span>{c.subscribeTitle}</span>
{savePercent > 0 ? <span className='ss-chip'>{fill(c.saveChip, { percent: savePercent })}</span> : null}
</label>
{c.subscribeNote ? <p className='ss-note'>{c.subscribeNote}</p> : null}
</div>
<div className='ss-price'>
{savePercent > 0 ? (
<span className='ss-was'>
<span className='ss-sr'>{c.regularPriceLabel} </span>
<s>{money(price)}</s>
</span>
) : null}
<span className='ss-now'>{money(subPrice)}</span>
</div>
{frequencies.length ? (
<div className='ss-extra'>
<div className='ss-freq'>
<label className='ss-freq-label' htmlFor={uid + '-freq'}>
{c.frequencyLabel}
</label>
<span className='ss-select-wrap'>
<select
id={uid + '-freq'}
className='ss-select'
value={current?.days ?? days}
disabled={!subOn || disabled}
onChange={(e) => setDays(Number(e.target.value))}
>
{frequencies.map((f) => (
<option key={f.days} value={f.days}>
{f.label ?? fill(c.frequencyOption, { days: f.days })}
</option>
))}
</select>
<ChevronDown className='ss-chev' size={18} strokeWidth={2.5} aria-hidden='true' />
</span>
</div>
{current && current.saving > 0 ? (
<p className='ss-saving' aria-live='polite'>
<PiggyBank className='ss-pig' size={20} strokeWidth={2.5} aria-hidden='true' />
<span className='ss-saving-text'>
<b>
{before}
<span key={amount} className='ss-amount'>
{amount}
</span>
{after}
</b>{' '}
{c.savingText}
</span>
<span className='ss-stairs' aria-hidden='true'>
{stairs.map((s) => (
<span
key={s.days}
className={s.days === current.days ? 'is-on' : ''}
style={{ height: (maxSaving > 0 ? 10 + Math.round((s.saving / maxSaving) * 20) : 10) + 'px' }}
/>
))}
</span>
</p>
) : null}
{notes.length ? (
<ul className='ss-notes'>
{notes.map((n, i) => (
<li key={i}>
<Check className='ss-ico-inline ss-ok' size={16} strokeWidth={2.5} aria-hidden='true' />
<b>{n.lead}</b>
{n.text ? ' ' + n.text : ''}
</li>
))}
</ul>
) : null}
</div>
) : null}
</div>
<div className={'ss-row ss-row-one' + (!subOn ? ' is-on' : forced) + thumbCls} onClick={() => pick('one-time')}>
<input
id={uid + '-one'}
className='ss-radio'
type='radio'
name={uid + '-buy'}
value='one-time'
checked={!subOn}
onChange={() => pick('one-time')}
/>
{productImage ? (
<span className='ss-thumb' aria-hidden='true'>
<img src={productImage} alt='' />
</span>
) : null}
<div className='ss-main'>
<label htmlFor={uid + '-one'} className='ss-title'>
<span>{c.oneTimeTitle}</span>
</label>
{c.oneTimeNote ? <p className='ss-note'>{c.oneTimeNote}</p> : null}
</div>
<div className='ss-price'>
<span className='ss-now'>{money(price)}</span>
</div>
</div>
</fieldset>
<button type='button' className={'ss-cta' + forced} disabled={disabled} onClick={act}>
<span className='ss-cta-label'>{actionLabel}</span>
<span className='ss-cta-sub'>{subLine}</span>
</button>
{guarantee ? (
<p className='ss-guarantee'>
<ShieldCheck className='ss-ico-inline ss-ok' size={18} strokeWidth={2.5} aria-hidden='true' />
<b>{guarantee.lead}</b>
{guarantee.text ? ' ' + guarantee.text : ''}
</p>
) : null}
</div>
);
}
export default SubscribeSave;
function round2(n: number) {
return Math.round(n * 100) / 100;
}
function formatMoney(n: number, currency: string, locale: string) {
const whole = Math.abs(n % 1) < 0.005;
try {
return new Intl.NumberFormat(locale, {
style: 'currency',
currency,
minimumFractionDigits: whole ? 0 : 2,
maximumFractionDigits: whole ? 0 : 2,
}).format(n);
} catch {
return String(n);
}
}
function fill(template: string, vars: Record<string, string | number>) {
return Object.keys(vars).reduce((s, k) => s.split('{' + k + '}').join(String(vars[k])), template);
}
const CSS = `
.cf-subscribe-save{--ss-shadow:var(--shadow, oklch(0.22 0.03 260));--ss-accent:var(--accent, oklch(0.5 0.17 257));--ss-fill:var(--accent-fill, var(--ss-accent));--ss-bg:var(--button-bg, var(--cta, oklch(0.58 0.21 29)));--ss-bg-2:var(--button-bg-2, var(--cta-2, oklch(0.51 0.21 29)));position:relative;width:100%;max-width:560px;margin-inline:auto;font-family:var(--font-body);color:var(--ink)}
.cf-subscribe-save *,.cf-subscribe-save *::before,.cf-subscribe-save *::after{box-sizing:border-box}
.cf-subscribe-save .ss-set{display:grid;gap:12px;margin:0;padding:0;border:0;min-inline-size:0}
.cf-subscribe-save .ss-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.cf-subscribe-save .ss-row{position:relative;display:grid;grid-template-columns:24px 52px minmax(0,1fr) auto;column-gap:14px;row-gap:14px;align-items:start;padding:18px 20px;background:var(--card);color:var(--ink);border:1px solid var(--card-border, oklch(from var(--ink) l c h / 0.12));border-radius:var(--card-radius, var(--radius, 14px));box-shadow:var(--shadow-sm, 0 1px 2px oklch(from var(--ss-shadow) l c h / 0.2));cursor:pointer;transition:transform .16s ease, box-shadow .16s ease, background-color .16s ease, border-color .16s ease;animation:ss-rise .45s cubic-bezier(.2,.7,.2,1) backwards}
.cf-subscribe-save .ss-row.no-thumb{grid-template-columns:24px minmax(0,1fr) auto}
.cf-subscribe-save .ss-row-one{animation-delay:.07s}
.cf-subscribe-save:not(.is-disabled) .ss-row:not(.is-on):hover,.cf-subscribe-save .ss-row.is-hover{background:color-mix(in oklch, var(--ink) 3%, var(--card));border-color:oklch(from var(--ink) l c h / 0.3);box-shadow:var(--shadow-md, 0 1px 2px oklch(from var(--ss-shadow) l c h / 0.22), 0 4px 10px -2px oklch(from var(--ss-shadow) l c h / 0.2))}
.cf-subscribe-save:not(.is-disabled) .ss-row:not(.is-on):hover .ss-radio,.cf-subscribe-save .ss-row.is-hover .ss-radio{border-color:oklch(from var(--ink) l c h / 0.75)}
.cf-subscribe-save:not(.is-disabled) .ss-row:not(.is-on):active,.cf-subscribe-save .ss-row.is-press{transform:translateY(1px);background:color-mix(in oklch, var(--ink) 5%, var(--card));box-shadow:none}
.cf-subscribe-save .ss-row.is-on{background:color-mix(in oklch, var(--ss-accent) 8%, var(--card));border-color:var(--ss-accent);box-shadow:inset 0 0 0 1px var(--ss-accent), inset 0 2px 0 oklch(from var(--card) calc(l + 0.04) c h / 0.6), var(--shadow-lg, 0 2px 4px oklch(from var(--ss-shadow) l c h / 0.22), 0 12px 24px -8px oklch(from var(--ss-shadow) l c h / 0.32));transform:translateY(-2px);cursor:default}
.cf-subscribe-save.is-disabled .ss-row:not(.is-on){background:color-mix(in oklch, var(--ink) 4%, var(--card))}
.cf-subscribe-save .ss-row:has(.ss-radio:focus-visible){outline:3px solid oklch(from var(--field-focus, var(--ss-accent)) l c h / 0.5);outline-offset:3px}
.cf-subscribe-save.is-disabled .ss-row{cursor:not-allowed;box-shadow:none;transform:none}
.cf-subscribe-save .ss-radio{appearance:none;-webkit-appearance:none;margin:1px 0 0;width:24px;height:24px;border-radius:999px;border:2px solid oklch(from var(--ink) l c h / 0.45);background:var(--field, var(--card));cursor:inherit;transition:border-color .16s ease, box-shadow .16s ease, background-color .16s ease}
.cf-subscribe-save .ss-radio:checked{border-color:var(--ss-fill);background:var(--ss-fill);box-shadow:inset 0 0 0 5px var(--ss-fill), inset 0 0 0 12px var(--accent-fill-ink, var(--card))}
.cf-subscribe-save .ss-radio:focus-visible{outline:none}
.cf-subscribe-save .ss-radio:disabled:not(:checked){border-color:oklch(from var(--ink) l c h / 0.25)}
.cf-subscribe-save .ss-thumb{position:relative;display:block;width:52px;height:52px}
.cf-subscribe-save .ss-thumb img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;object-position:center bottom;border-radius:0;filter:drop-shadow(0 2px 3px oklch(from var(--ss-shadow) l c h / 0.3)) drop-shadow(0 6px 8px oklch(from var(--ss-shadow) l c h / 0.16))}
.cf-subscribe-save .ss-thumb-stack .ss-back{transform:translate(-8px,-3px) scale(.82);opacity:.7}
.cf-subscribe-save .ss-thumb-stack .ss-front{transform:translate(5px,2px) scale(.94)}
.cf-subscribe-save .ss-main{min-width:0}
.cf-subscribe-save .ss-title{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;margin:0;font-family:var(--font-display);font-weight:var(--display-weight, 800);font-size:1.125rem;line-height:1.2;letter-spacing:-0.01em;color:var(--ink);cursor:inherit;text-wrap:balance}
.cf-subscribe-save .ss-chip{display:inline-flex;align-items:center;min-height:28px;padding:4px 12px;border-radius:999px;background:var(--ss-fill);color:var(--accent-fill-ink, var(--card));font-family:var(--font-body);font-size:.875rem;font-weight:800;line-height:1.2;letter-spacing:0;white-space:nowrap}
.cf-subscribe-save .ss-note{margin:6px 0 0;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
.cf-subscribe-save .ss-price{display:flex;flex-direction:column;align-items:flex-end;gap:6px;padding-top:1px;text-align:right;white-space:nowrap}
.cf-subscribe-save .ss-was{font-size:.9375rem;font-weight:600;line-height:1.2;color:var(--muted);font-variant-numeric:tabular-nums}
.cf-subscribe-save .ss-was s{text-decoration-line:line-through;text-decoration-thickness:2px;text-decoration-color:var(--danger, currentColor)}
.cf-subscribe-save .ss-now{font-family:var(--font-display);font-weight:var(--display-weight, 800);font-size:1.375rem;line-height:1;letter-spacing:-0.02em;color:var(--ink);font-variant-numeric:tabular-nums}
.cf-subscribe-save .ss-row-sub .ss-now{font-size:1.875rem;letter-spacing:-0.03em}
.cf-subscribe-save .ss-extra{grid-column:3 / -1;display:grid;gap:12px;min-width:0}
.cf-subscribe-save .ss-row.no-thumb .ss-extra{grid-column:2 / -1}
.cf-subscribe-save .ss-freq{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px}
.cf-subscribe-save .ss-freq-label{font-size:.9375rem;font-weight:700;line-height:1.3;color:var(--label-ink, var(--ink));cursor:inherit}
.cf-subscribe-save .ss-select-wrap{position:relative;display:block;flex:1 1 180px;max-width:240px}
.cf-subscribe-save .ss-select{appearance:none;-webkit-appearance:none;display:block;width:100%;min-height:52px;margin:0;padding:0 44px 0 14px;font-family:var(--font-body);font-size:1.0625rem;font-weight:700;line-height:1.2;color:var(--field-ink, var(--ink));background:var(--field, var(--card));border:1px solid var(--field-border, color-mix(in oklch, var(--ink) 22%, transparent));border-radius:var(--field-radius, var(--radius, 12px));box-shadow:inset 0 1px 2px oklch(from var(--ss-shadow) l c h / 0.08);cursor:pointer;transition:border-color .16s ease, box-shadow .16s ease}
.cf-subscribe-save .ss-select:hover:not(:disabled){border-color:oklch(from var(--field-ink, var(--ink)) l c h / 0.45)}
.cf-subscribe-save .ss-select:focus-visible{outline:none;border-color:var(--field-focus, var(--ss-accent));box-shadow:0 0 0 3px oklch(from var(--field-focus, var(--ss-accent)) l c h / 0.35)}
.cf-subscribe-save .ss-select:disabled{color:color-mix(in oklch, var(--field-ink, var(--ink)) 62%, var(--field, var(--card)));background:color-mix(in oklch, var(--ink) 5%, var(--field, var(--card)));box-shadow:none;cursor:not-allowed;pointer-events:none}
.cf-subscribe-save .ss-chev{position:absolute;top:50%;right:14px;transform:translateY(-50%);color:var(--field-ink, var(--ink));pointer-events:none}
.cf-subscribe-save .ss-select:disabled + .ss-chev{opacity:.55}
.cf-subscribe-save .ss-saving{display:flex;align-items:center;gap:12px;margin:0;padding:12px 16px;border-radius:10px;background:oklch(from var(--ink) l c h / 0.05);box-shadow:inset 0 0 0 1px oklch(from var(--ink) l c h / 0.06);font-size:.9375rem;line-height:1.4;color:var(--ink)}
.cf-subscribe-save .ss-pig{flex:none;color:var(--success, var(--ss-accent))}
.cf-subscribe-save .ss-saving-text{flex:1 1 auto;min-width:0;text-wrap:balance}
.cf-subscribe-save .ss-saving-text b{font-weight:800}
.cf-subscribe-save .ss-amount{display:inline-block;font-variant-numeric:tabular-nums;animation:ss-pop .3s cubic-bezier(.2,.7,.2,1)}
.cf-subscribe-save .ss-stairs{flex:none;display:flex;align-items:flex-end;gap:4px;height:30px}
.cf-subscribe-save .ss-stairs span{display:block;width:9px;border-radius:3px;background:oklch(from var(--ink) l c h / 0.18);transition:height .3s cubic-bezier(.2,.7,.2,1), background-color .16s ease}
.cf-subscribe-save .ss-stairs span.is-on{background:var(--ss-fill)}
.cf-subscribe-save .ss-notes{display:grid;gap:6px;margin:0;padding:0;list-style:none}
.cf-subscribe-save .ss-notes li{font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--ink);text-wrap:pretty}
.cf-subscribe-save .ss-notes b,.cf-subscribe-save .ss-guarantee b{font-weight:800;color:var(--ink)}
.cf-subscribe-save .ss-ico-inline{display:inline-block;vertical-align:-0.18em;margin-inline-end:.4em}
.cf-subscribe-save .ss-ok{color:var(--success, var(--ss-accent))}
.cf-subscribe-save .ss-cta{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;width:100%;min-height:72px;margin:20px 0 0;padding:12px 28px;border:0;border-radius:var(--button-radius, var(--radius, 12px));background:linear-gradient(oklch(from var(--ss-bg) calc(l + 0.04) c h), oklch(from var(--ss-bg-2) calc(l - 0.02) c h));color:var(--button-ink, var(--cta-ink, oklch(1 0 0)));font-family:var(--button-font, var(--font-display));text-transform:var(--button-case, none);text-align:center;text-shadow:var(--button-text-shadow, none);box-shadow:var(--button-shadow, inset 0 1px 0 oklch(from var(--ss-bg) calc(l + 0.14) c h / 0.7), inset 0 -3px 0 oklch(from var(--ss-bg) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--ss-shadow) l c h / 0.3), 0 8px 16px -6px oklch(from var(--ss-shadow) l c h / 0.45));cursor:pointer;transition:transform .16s ease, box-shadow .16s ease;animation:ss-rise .45s cubic-bezier(.2,.7,.2,1) .14s backwards}
.cf-subscribe-save .ss-cta:hover:not(:disabled),.cf-subscribe-save .ss-cta.is-hover{background:linear-gradient(oklch(from var(--ss-bg) calc(l - 0.01) c h), oklch(from var(--ss-bg-2) calc(l - 0.07) c h));box-shadow:inset 0 1px 0 oklch(from var(--ss-bg) calc(l + 0.1) c h / 0.6), inset 0 -3px 0 oklch(from var(--ss-bg) calc(l - 0.2) c h), 0 1px 2px oklch(from var(--ss-shadow) l c h / 0.32), 0 10px 20px -6px oklch(from var(--ss-shadow) l c h / 0.5)}
.cf-subscribe-save .ss-cta:active:not(:disabled),.cf-subscribe-save .ss-cta.is-press{transform:translateY(1px);background:linear-gradient(oklch(from var(--ss-bg) calc(l - 0.04) c h), oklch(from var(--ss-bg-2) calc(l - 0.08) c h));box-shadow:inset 0 2px 4px oklch(from var(--ss-bg) calc(l - 0.22) c h / 0.55), inset 0 -2px 0 oklch(from var(--ss-bg) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--ss-shadow) l c h / 0.3)}
.cf-subscribe-save .ss-cta:focus-visible{outline:3px solid oklch(from var(--field-focus, var(--ss-accent)) l c h / 0.6);outline-offset:3px}
.cf-subscribe-save .ss-cta:disabled{background:var(--button-2-bg, var(--secondary, oklch(0.93 0.015 263)));color:var(--button-2-ink, var(--secondary-ink, var(--ink)));text-shadow:none;box-shadow:none;cursor:not-allowed}
.cf-subscribe-save .ss-cta-label{font-size:clamp(1.125rem, 1.55vw, 1.375rem);font-weight:var(--button-weight, 800);line-height:1.15;letter-spacing:-0.005em;text-wrap:balance}
.cf-subscribe-save .ss-cta-sub{font-family:var(--font-body);font-size:.9375rem;font-weight:600;line-height:1.3;font-variant-numeric:tabular-nums;text-transform:none;text-wrap:pretty}
.cf-subscribe-save .ss-guarantee{margin:14px 0 0;text-align:center;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty;animation:ss-rise .45s cubic-bezier(.2,.7,.2,1) .21s backwards}
@keyframes ss-rise{from{opacity:.82;transform:translateY(8px)}}
@keyframes ss-pop{from{transform:scale(.9)}}
@media (max-width:480px){
.cf-subscribe-save .ss-row{grid-template-columns:24px 44px minmax(0,1fr) auto;column-gap:12px;padding:16px}
.cf-subscribe-save .ss-row.no-thumb{grid-template-columns:24px minmax(0,1fr) auto}
.cf-subscribe-save .ss-thumb{width:44px;height:44px}
.cf-subscribe-save .ss-extra{grid-column:2 / -1}
.cf-subscribe-save .ss-freq{flex-direction:column;align-items:stretch}
.cf-subscribe-save .ss-select-wrap{flex:none;max-width:none}
.cf-subscribe-save .ss-now{font-size:1.25rem}
.cf-subscribe-save .ss-row-sub .ss-now{font-size:1.625rem}
.cf-subscribe-save .ss-saving{padding:12px 14px}
.cf-subscribe-save .ss-cta{padding:14px 16px}
}
@media (prefers-reduced-motion: reduce){
.cf-subscribe-save *{animation:none !important;transition:none !important}
}
`;
pieces/offer/subscribe-save/specimen.tsx 31 lines
import __studioImagecfcd77d0 from "../assets/8db83743c08ae52f.webp";
import defaults from '../../studio-defaults.json';
import { slot } from '../../slots';
import { SubscribeSave } from '../subscribe-save';
declare function genImage(prompt: string, shape: 'portrait' | 'landscape' | 'square' | 'cutout'): string;
export const states = ['default', 'hover', 'active', 'disabled'] as const;
type SpecimenState = (typeof states)[number];
export default function SubscribeSaveSpecimen({ state = 'default' }: { state?: SpecimenState }) {
return (
<SubscribeSave
state={state}
price={59}
savePercent={20}
frequencies={[{ days: 30 }, { days: 60 }, { days: 90 }]}
productImage={slot(
'product',
__studioImagecfcd77d0
)}
notes={[
{ lead: 'Skip or pause', text: 'any delivery from your account.' },
{ lead: 'Cancel anytime.', text: 'No fees, no phone calls.' },
]}
copy={{ oneTimeNote: 'One pouch, ships once.' }}
actionLabel='Try Morrow Greens for 30 days'
guarantee={{ lead: defaults.sample.guarantee + '.', text: 'Not for you? Ask for a full refund.' }}
/>
);
}
| Name | Type | Details |
|---|---|---|
price RequiredSubscribeSave |
number |
|
savePercent RequiredSubscribeSave |
number |
|
currency OptionalSubscribeSave |
string |
|
locale OptionalSubscribeSave |
string |
|
frequencies OptionalSubscribeSave |
SubscribeSaveFrequency[] |
|
defaultFrequency OptionalSubscribeSave |
number |
|
defaultChoice OptionalSubscribeSave |
SubscribeSaveChoice |
|
productImage OptionalSubscribeSave |
string |
|
notes OptionalSubscribeSave |
SubscribeSaveLine[] |
|
guarantee OptionalSubscribeSave |
SubscribeSaveLine |
|
actionLabel OptionalSubscribeSave |
string |
|
copy OptionalSubscribeSave |
Partial<SubscribeSaveCopy> |
|
onAction OptionalSubscribeSave |
(detail: SubscribeSaveAction) => void |
|
state OptionalSubscribeSave |
'default' | 'hover' | 'active' | 'disabled' |
|
className OptionalSubscribeSave |
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- Secondary button.
--card-border--card-radius- Cards and panels: radius, border and shadow.
--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.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
product- The main product shot or cover (ebook, kit, bottle).
-
8db83743c08ae52f.webp
image/webp · 62.5 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB