Pricing Slider 1
Pricing slider: the buyer drags to their own list size and every plan's price follows from the supplied table, so the right plan and its real price are clear before the click.
Use it in a prompt
Use content/pricing-slider 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/content/pricing-slider.tsx. - Import it and pass your copy and images (Props tab):
import { PricingSlider } from "@/components/funneldna/content/pricing-slider"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/content/pricing-slider/component.tsx 714 lines
// layout: magazine-spread
// Pricing slider: the buyer drags to their own list size and every plan's price follows from the supplied table, so the right plan and its real price are clear before the click.
import React, { useEffect, useId, useMemo, useRef, useState } from 'react';
import { Check, Globe, Mail, TrendingUp, Users, type LucideIcon } from 'lucide-react';
import { useReducedMotion } from 'motion/react';
import { Divider, FX_HOST, Glow, Texture } from '../fx/fx';
import linen from '../fx/textures/linen';
export type PricingBilling = 'monthly' | 'yearly';
/** A plan's price per month at one stop: a number, null for custom pricing, false when the plan is not offered at that list size. */
export type PlanPrice = number | null | false;
export type PricingStop = {
value: number; // subscriber count at this stop
label?: string; // display label for the stop, e.g. '100,000+'
};
export type PricingCta = { label: string; sublabel?: string };
export type PricingPlan = {
id: string;
name: string;
forLine?: string; // who the plan is for, one short line
prices: { monthly: PlanPrice[]; yearly: PlanPrice[] }; // one entry per stop; yearly is the per-month price billed yearly
freeNote?: string; // note under a 0 price
limitNote?: string; // note when the plan is not offered at the chosen size
cta: PricingCta;
customCta?: PricingCta; // button used while the price is custom
ctaStyle?: 'primary' | 'secondary';
href?: string;
customHref?: string;
featuresHeading?: string;
features: { label: string; tag?: string }[];
};
export type PricingContext = {
planId: string;
stopIndex: number;
subscribers: number;
billing: PricingBilling;
price: number | null; // null when custom or not offered
};
export type PricingSliderCopy = {
sliderLabel: string; // {count} is the live list size
valueText: string; // screen-reader value for the slider, {count}
billingLabel: string;
monthly: string;
yearly: string;
save: string; // {percent}, derived from the supplied prices
monthlyNote: string;
yearlyNote: string;
freeNote: string;
custom: string;
customNote: string;
unavailable: string;
unavailableNote: string;
popular: string;
plansLabel: string;
showPlan: string; // {plan}
pull: string; // {count} {plan} {price} {per}
pullCustom: string; // {count} {plan}
pullMonthly: string;
pullYearly: string;
psLabel: string;
};
export type PricingSliderProps = {
headline?: React.ReactNode;
lead?: React.ReactNode;
includesLabel?: string;
includes?: { label: string; icon?: LucideIcon }[];
stops?: PricingStop[];
defaultStop?: number; // index into stops
plans?: PricingPlan[];
popularPlan?: string; // plan id that gets the ring and the badge
defaultBilling?: PricingBilling;
currency?: string;
locale?: string;
ps?: React.ReactNode;
copy?: Partial<PricingSliderCopy>;
state?: 'default' | 'hover' | 'active' | 'disabled';
onAction?: (planId: string, context: PricingContext) => void;
onChange?: (context: { stopIndex: number; subscribers: number; billing: PricingBilling }) => void;
className?: string;
};
export function PricingSlider(props: PricingSliderProps) {
const {
headline = 'Pricing that grows with your list',
lead = 'Slide to your list size to see exactly what you’ll pay on every plan.',
includesLabel = 'All plans include',
includes = DEFAULT_INCLUDES,
stops = DEFAULT_STOPS,
defaultStop = 1,
plans = DEFAULT_PLANS,
popularPlan = 'scale',
defaultBilling = 'yearly',
currency = '$',
locale = 'en-US',
ps = 'Your price follows your list, so you only pay for the readers you actually have.',
state = 'default',
onAction,
onChange,
className,
} = props;
const c: PricingSliderCopy = { ...DEFAULT_COPY, ...props.copy };
const uid = useId();
const rangeId = uid + '-range';
const headId = uid + '-head';
const reduce = !!useReducedMotion();
const last = Math.max(0, stops.length - 1);
const [stopIndex, setStopIndex] = useState(() => clamp(defaultStop, 0, last));
const [billing, setBilling] = useState<PricingBilling>(defaultBilling);
const [visible, setVisible] = useState(0);
const rowRef = useRef<HTMLDivElement>(null);
const segRefs = useRef<Partial<Record<PricingBilling, HTMLButtonElement | null>>>({});
const disabled = state === 'disabled';
const at = Math.min(stopIndex, last);
const stop = stops[at] ?? { value: 0 };
const count = labelOf(stop, locale);
const frac = last > 0 ? at / last : 0;
const savePct = useMemo(() => {
let best = 0;
for (const plan of plans) {
const m = priceAt(plan.prices.monthly, at);
const y = priceAt(plan.prices.yearly, at);
if (typeof m === 'number' && typeof y === 'number' && m > 0 && y < m) best = Math.max(best, Math.round((1 - y / m) * 100));
}
return best;
}, [plans, at]);
const pullPlan = plans.find((p) => p.id === popularPlan) ?? plans[1] ?? plans[0];
const pullPrice = pullPlan ? priceAt(pullPlan.prices[billing], at) : null;
const emit = (i: number, b: PricingBilling) => onChange?.({ stopIndex: i, subscribers: stops[i]?.value ?? 0, billing: b });
const chooseStop = (i: number) => {
setStopIndex(i);
emit(i, billing);
};
const chooseBilling = (b: PricingBilling) => {
if (b === billing) return;
setBilling(b);
emit(at, b);
};
const onSegKey = (e: React.KeyboardEvent<HTMLButtonElement>) => {
if (!['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].includes(e.key)) return;
e.preventDefault();
const next: PricingBilling = billing === 'yearly' ? 'monthly' : 'yearly';
chooseBilling(next);
segRefs.current[next]?.focus();
};
const scrollToCard = (k: number, smooth: boolean) => {
const row = rowRef.current;
const el = row?.children[k] as HTMLElement | undefined;
if (!row || !el) return;
const pad = parseFloat(getComputedStyle(row).paddingLeft) || 0;
row.scrollTo({ left: el.offsetLeft - pad, behavior: smooth && !reduce ? 'smooth' : 'auto' });
};
const onRowScroll = () => {
const row = rowRef.current;
if (!row || plans.length < 2) return;
const a = row.children[0] as HTMLElement | undefined;
const b = row.children[1] as HTMLElement | undefined;
if (!a || !b) return;
const step = b.offsetLeft - a.offsetLeft;
if (step <= 0) return;
const atEnd = row.scrollLeft >= row.scrollWidth - row.clientWidth - 2;
setVisible(atEnd ? plans.length - 1 : clamp(Math.round(row.scrollLeft / step), 0, plans.length - 1));
};
// On a phone the cards swipe; open the row on the featured plan.
useEffect(() => {
const k = plans.findIndex((p) => p.id === popularPlan);
const row = rowRef.current;
if (k > 0 && row && row.scrollWidth > row.clientWidth + 4) {
scrollToCard(k, false);
setVisible(k);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const order: PricingBilling[] = ['yearly', 'monthly'];
const first = stops[0];
const end = stops[last];
return (
<section className={'cf-pricing-slider' + (className ? ' ' + className : '')} style={{ ...FX_HOST, overflow: 'clip' }} aria-labelledby={headId}>
<style>{CSS}</style>
<Texture src={linen} tone='band-ink' />
<Glow />
<div className='cf-ps-wrap'>
<div className='cf-ps-spread'>
<h2 id={headId} className='cf-ps-h'>{headline}</h2>
<div className='cf-ps-side'>
{lead ? <p className='cf-ps-lead'>{lead}</p> : null}
{includes.length ? (
<div className='cf-ps-inc'>
<p className='cf-ps-inc-label'>{includesLabel}</p>
<ul className='cf-ps-chips'>
{includes.map((item, k) => {
const Icon = item.icon ?? Check;
return (
<li key={k} className='cf-ps-chip'>
<Icon size={16} strokeWidth={2.5} aria-hidden='true' />
{item.label}
</li>
);
})}
</ul>
</div>
) : null}
</div>
</div>
<div className='cf-ps-stage'>
<div className='cf-ps-bar'>
<div className='cf-ps-meter'>
<label htmlFor={rangeId} className='cf-ps-meter-label'>
{fill(c.sliderLabel, { count: <span className='cf-ps-count'>{count}</span> })}
</label>
<input
id={rangeId}
className='cf-ps-range'
type='range'
min={0}
max={last}
step={1}
value={at}
disabled={disabled}
aria-valuetext={fillText(c.valueText, { count })}
onChange={(e) => chooseStop(Number(e.target.value))}
style={{ '--frac': frac } as React.CSSProperties}
/>
{first && end ? (
<div className='cf-ps-ticks' aria-hidden='true'>
<span>{labelOf(first, locale)}</span>
<span>{labelOf(end, locale)}</span>
</div>
) : null}
</div>
<div className='cf-ps-toggle' role='radiogroup' aria-label={c.billingLabel}>
{order.map((b) => {
const on = billing === b;
return (
<button
key={b}
ref={(el) => {
segRefs.current[b] = el;
}}
type='button'
role='radio'
aria-checked={on}
tabIndex={on ? 0 : -1}
disabled={disabled}
className='cf-ps-seg'
onClick={() => chooseBilling(b)}
onKeyDown={onSegKey}
>
{b === 'yearly' ? c.yearly : c.monthly}
{b === 'yearly' && savePct > 0 ? <span className='cf-ps-save'>{fillText(c.save, { percent: String(savePct) })}</span> : null}
</button>
);
})}
</div>
</div>
{pullPlan ? (
<p className='cf-ps-pull'>
{typeof pullPrice === 'number'
? fill(c.pull, {
count: <b>{count}</b>,
plan: <b>{pullPlan.name}</b>,
price: (
<b>
{currency}
<Tally value={pullPrice} reduce={reduce} locale={locale} />
</b>
),
per: billing === 'yearly' ? c.pullYearly : c.pullMonthly,
})
: fill(c.pullCustom, { count: <b>{count}</b>, plan: <b>{pullPlan.name}</b> })}
</p>
) : null}
<div ref={rowRef} className='cf-ps-cards' role='group' aria-label={c.plansLabel} onScroll={onRowScroll} style={{ '--ps-n': plans.length } as React.CSSProperties}>
{plans.map((plan, k) => (
<PlanCard
key={plan.id}
plan={plan}
index={k}
at={at}
subscribers={stop.value}
billing={billing}
popular={plan.id === popularPlan}
copy={c}
currency={currency}
locale={locale}
reduce={reduce}
state={state}
onAction={onAction}
/>
))}
</div>
{plans.length > 1 ? (
<div className='cf-ps-dots'>
{plans.map((plan, k) => (
<button
key={plan.id}
type='button'
className='cf-ps-dot'
aria-label={fillText(c.showPlan, { plan: plan.name })}
aria-current={visible === k ? 'true' : undefined}
onClick={() => {
scrollToCard(k, true);
setVisible(k);
}}
>
<span />
</button>
))}
</div>
) : null}
{ps ? (
<p className='cf-ps-ps'>
<strong>{c.psLabel}</strong>
{ps}
</p>
) : null}
</div>
</div>
<Divider shape='curve' tone='surface' height={56} />
</section>
);
}
export default PricingSlider;
type PlanCardProps = {
plan: PricingPlan;
index: number;
at: number;
subscribers: number;
billing: PricingBilling;
popular: boolean;
copy: PricingSliderCopy;
currency: string;
locale: string;
reduce: boolean;
state: NonNullable<PricingSliderProps['state']>;
onAction?: PricingSliderProps['onAction'];
};
function PlanCard({ plan, index, at, subscribers, billing, popular, copy: c, currency, locale, reduce, state, onAction }: PlanCardProps) {
const nameId = useId();
const price = priceAt(plan.prices[billing], at);
const isCustom = price === null;
const isOff = price === false;
const cta = isCustom && plan.customCta ? plan.customCta : plan.cta;
const href = isCustom && plan.customHref ? plan.customHref : plan.href;
const primary = popular || (plan.ctaStyle ?? 'primary') === 'primary';
const note = isOff
? plan.limitNote ?? c.unavailableNote
: isCustom
? c.customNote
: price === 0
? plan.freeNote ?? c.freeNote
: billing === 'yearly'
? c.yearlyNote
: c.monthlyNote;
const btnOff = state === 'disabled' || isOff;
const forced = popular && state === 'hover' ? ' is-hover' : popular && state === 'active' ? ' is-active' : '';
const btnClass = 'cf-ps-btn ' + (primary ? 'is-primary' : 'is-secondary') + forced;
const fire = () => onAction?.(plan.id, { planId: plan.id, stopIndex: at, subscribers, billing, price: typeof price === 'number' ? price : null });
const inner = (
<>
<span className='cf-ps-btn-main'>{cta.label}</span>
{cta.sublabel ? <span className='cf-ps-btn-sub'>{cta.sublabel}</span> : null}
</>
);
return (
<article className={'cf-ps-card' + (popular ? ' is-popular' : '')} aria-labelledby={nameId} style={{ '--i': Math.min(index, 4) } as React.CSSProperties}>
<div className='cf-ps-top'>
<h3 id={nameId} className='cf-ps-name'>{plan.name}</h3>
{popular ? <span className='cf-ps-badge'>{c.popular}</span> : null}
</div>
{plan.forLine ? <p className='cf-ps-for'>{plan.forLine}</p> : null}
<div className='cf-ps-figure'>
{typeof price === 'number' ? (
<>
<span className='cf-ps-sr'>
{currency}
{fmt(price, locale)}
</span>
<span className='cf-ps-amount' aria-hidden='true'>
<span className='cf-ps-cur'>{currency}</span>
<Tally value={price} reduce={reduce} locale={locale} />
</span>
</>
) : (
<span className={'cf-ps-word' + (isOff ? ' is-off' : '')}>{isOff ? c.unavailable : c.custom}</span>
)}
</div>
<p className='cf-ps-note'>{note}</p>
<div className='cf-ps-cta'>
{href && !btnOff ? (
<a className={btnClass} href={href} onClick={fire}>
{inner}
</a>
) : (
<button type='button' className={btnClass} disabled={btnOff} onClick={fire}>
{inner}
</button>
)}
</div>
{plan.features.length ? (
<div className='cf-ps-feat'>
{plan.featuresHeading ? <p className='cf-ps-list-head'>{plan.featuresHeading}</p> : null}
<ul className='cf-ps-list'>
{plan.features.map((f, k) => (
<li key={k}>
<Check size={18} strokeWidth={2.5} aria-hidden='true' />
<span>
{f.label}
{f.tag ? (
<>
{' '}
<span className='cf-ps-tag'>{f.tag}</span>
</>
) : null}
</span>
</li>
))}
</ul>
</div>
) : null}
</article>
);
}
// Counts a price quickly from its last value to the new one; instant under reduced motion. The real value renders first.
function Tally({ value, reduce, locale }: { value: number; reduce: boolean; locale: string }) {
const shown = useTween(value, reduce);
const d = Number.isInteger(value) ? 0 : 2;
return <>{shown.toLocaleString(locale, { minimumFractionDigits: d, maximumFractionDigits: d })}</>;
}
function useTween(target: number, reduce: boolean): number {
const [shown, setShown] = useState(target);
const live = useRef(target);
useEffect(() => {
const from = live.current;
if (reduce || from === target) {
live.current = target;
setShown(target);
return;
}
let raf = 0;
const start = performance.now();
const step = (now: number) => {
const t = Math.min(1, (now - start) / 260);
const v = t < 1 ? from + (target - from) * (1 - Math.pow(1 - t, 3)) : target;
live.current = v;
setShown(v);
if (t < 1) raf = requestAnimationFrame(step);
};
raf = requestAnimationFrame(step);
return () => cancelAnimationFrame(raf);
}, [target, reduce]);
return shown;
}
function splitTemplate(tpl: string): { key?: string; text?: string }[] {
const out: { key?: string; text?: string }[] = [];
let rest = tpl;
while (rest.length) {
const a = rest.indexOf('{');
const b = a < 0 ? -1 : rest.indexOf('}', a);
if (a < 0 || b < 0) {
out.push({ text: rest });
break;
}
if (a > 0) out.push({ text: rest.slice(0, a) });
out.push({ key: rest.slice(a + 1, b) });
rest = rest.slice(b + 1);
}
return out;
}
function fill(tpl: string, values: Record<string, React.ReactNode>): React.ReactNode {
return splitTemplate(tpl).map((part, k) => (
<React.Fragment key={k}>{part.key !== undefined ? (part.key in values ? values[part.key] : '{' + part.key + '}') : part.text}</React.Fragment>
));
}
function fillText(tpl: string, values: Record<string, string>): string {
return splitTemplate(tpl)
.map((part) => (part.key !== undefined ? values[part.key] ?? '{' + part.key + '}' : part.text ?? ''))
.join('');
}
function fmt(n: number, locale: string): string {
const d = Number.isInteger(n) ? 0 : 2;
return n.toLocaleString(locale, { minimumFractionDigits: d, maximumFractionDigits: d });
}
function labelOf(stop: PricingStop, locale: string): string {
return stop.label ?? fmt(stop.value, locale);
}
function priceAt(list: PlanPrice[], i: number): PlanPrice {
return i < list.length ? list[i] : null;
}
function clamp(n: number, min: number, max: number): number {
return Math.min(max, Math.max(min, n));
}
const DEFAULT_COPY: PricingSliderCopy = {
sliderLabel: 'Pricing for {count} subscribers',
valueText: '{count} subscribers',
billingLabel: 'Billing period',
monthly: 'Monthly',
yearly: 'Yearly',
save: 'Save {percent}%',
monthlyNote: 'per month',
yearlyNote: 'per month, billed yearly',
freeNote: 'No charge at this list size',
custom: 'Custom',
customNote: 'Priced around your list',
unavailable: 'Not offered',
unavailableNote: 'Built for smaller lists. See the next plan.',
popular: 'Most popular',
plansLabel: 'Plans',
showPlan: 'Show {plan}',
pull: 'At {count} subscribers, {plan} is {price} {per}.',
pullCustom: 'At {count} subscribers, {plan} is priced around your list.',
pullMonthly: 'a month',
pullYearly: 'a month, billed yearly',
psLabel: 'P.S.',
};
const DEFAULT_STOPS: PricingStop[] = [
{ value: 500 },
{ value: 1000 },
{ value: 2500 },
{ value: 5000 },
{ value: 10000 },
{ value: 25000 },
{ value: 50000 },
{ value: 100000, label: '100,000+' },
];
const DEFAULT_INCLUDES: { label: string; icon?: LucideIcon }[] = [
{ label: 'Email sends', icon: Mail },
{ label: 'Sign-up pages', icon: Globe },
{ label: 'Subscriber lists', icon: Users },
{ label: 'Open and click stats', icon: TrendingUp },
];
const FREE_TIER: PlanPrice[] = [0, 0, false, false, false, false, false, false];
const ALL_CUSTOM: PlanPrice[] = [null, null, null, null, null, null, null, null];
const DEFAULT_PLANS: PricingPlan[] = [
{
id: 'free',
name: 'Free',
forLine: 'The basics to start your list and send your first emails.',
prices: { monthly: FREE_TIER, yearly: FREE_TIER },
limitNote: 'The free plan covers lists up to 1,000.',
cta: { label: 'Start for free', sublabel: 'No card required' },
ctaStyle: 'secondary',
featuresHeading: 'Everything to start your list:',
features: [{ label: 'Email sends' }, { label: 'Sign-up forms and pages' }, { label: 'Welcome email' }, { label: 'Open and click stats' }],
},
{
id: 'grow',
name: 'Grow',
forLine: 'For lists ready to sell, segment and automate.',
prices: { monthly: [15, 20, 30, 50, 80, 150, 250, null], yearly: [12, 16, 24, 40, 64, 120, 200, null] },
cta: { label: 'Start with Grow', sublabel: 'Review your plan at checkout' },
customCta: { label: 'Talk to us', sublabel: 'Pricing for large lists' },
featuresHeading: 'Everything in Free, plus:',
features: [{ label: 'Remove branding' }, { label: 'Automations' }, { label: 'Subscriber segments' }, { label: 'A/B subject lines' }],
},
{
id: 'scale',
name: 'Scale',
forLine: 'For growing businesses running launches from their list.',
prices: { monthly: [30, 40, 60, 90, 140, 250, 400, null], yearly: [24, 32, 48, 72, 112, 200, 320, null] },
cta: { label: 'Start with Scale', sublabel: 'Review your plan at checkout' },
customCta: { label: 'Talk to us', sublabel: 'Pricing for large lists' },
featuresHeading: 'Everything in Grow, plus:',
features: [{ label: 'Paid subscriptions' }, { label: 'Advanced analytics' }, { label: 'Webhooks and API' }, { label: 'Priority support' }],
},
{
id: 'enterprise',
name: 'Enterprise',
forLine: 'For teams that need custom volume, security and support.',
prices: { monthly: ALL_CUSTOM, yearly: ALL_CUSTOM },
cta: { label: 'Contact sales', sublabel: 'Priced around your list' },
ctaStyle: 'secondary',
featuresHeading: 'Everything in Scale, plus:',
features: [{ label: 'Dedicated sending IPs' }, { label: 'Single sign-on' }, { label: 'Onboarding help' }, { label: 'Custom contract' }],
},
];
const CSS = `
.cf-pricing-slider{--ps-g:clamp(16px,5vw,48px);--ps-shadow:var(--shadow,oklch(0.22 0.03 256));--ps-line:oklch(from var(--band-ink) l c h / .16);position:relative;background:var(--band);color:var(--band-ink);font-family:var(--font-body);padding-block:clamp(56px,8vw,112px) calc(clamp(64px,8.5vw,120px) + 56px)}
.cf-pricing-slider *,.cf-pricing-slider *::before,.cf-pricing-slider *::after{box-sizing:border-box}
.cf-ps-wrap{position:relative;z-index:1;max-width:calc(1120px + 2 * var(--ps-g));margin-inline:auto;padding-inline:var(--ps-g)}
.cf-ps-spread{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,.9fr);gap:clamp(32px,5vw,72px);align-items:start}
.cf-ps-h{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);font-size:clamp(2.5rem,5.4vw,4.875rem);line-height:1.04;text-wrap:balance;color:var(--band-ink)}
.cf-ps-side{padding-top:clamp(0px,1vw,12px)}
.cf-ps-lead{margin:0;font-size:clamp(1.125rem,1.5vw,1.375rem);font-weight:500;line-height:1.4;text-wrap:pretty}
.cf-ps-inc{margin-top:24px}
.cf-ps-inc-label{margin:0 0 12px;font-size:.9375rem;font-weight:800;line-height:1.4}
.cf-ps-chips{display:flex;flex-wrap:wrap;gap:8px;margin:0;padding:0;list-style:none}
.cf-ps-chip{display:inline-flex;align-items:center;gap:8px;min-height:32px;padding:4px 12px;border-radius:999px;background:oklch(from var(--band-ink) l c h / .12);font-size:.875rem;font-weight:800;line-height:1.2}
.cf-ps-chip svg{flex:0 0 auto}
.cf-ps-stage{margin-top:clamp(40px,5vw,64px)}
.cf-ps-bar{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:16px 32px;padding:20px 24px;border-radius:var(--radius,12px);background:oklch(from var(--band-ink) l c h / .07);border:1px solid var(--ps-line)}
.cf-ps-meter{min-width:0}
.cf-ps-meter-label{display:block;font-size:1.0625rem;font-weight:600;line-height:1.3;color:var(--band-ink)}
.cf-ps-count{margin-inline:.15em;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);letter-spacing:-0.01em;font-variant-numeric:tabular-nums}
.cf-ps-range{-webkit-appearance:none;appearance:none;display:block;width:100%;height:32px;margin:8px 0 0;background:transparent;cursor:pointer;border-radius:var(--field-radius,999px);--ps-thumb:var(--field,var(--band-ink));--ps-ring:oklch(from var(--field-focus,var(--accent)) l c h / .35);--ps-fill:calc(14px + (100% - 28px) * var(--frac,0))}
.cf-ps-range::-webkit-slider-runnable-track{height:8px;border-radius:999px;background:linear-gradient(to right,var(--accent-fill,var(--accent)) var(--ps-fill),oklch(from var(--band-ink) l c h / .22) var(--ps-fill))}
.cf-ps-range::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:28px;height:28px;margin-top:-10px;border-radius:50%;background:var(--ps-thumb);border:5px solid var(--accent-fill,var(--accent));box-shadow:0 1px 2px oklch(from var(--ps-shadow) l c h / .45),0 4px 10px -2px oklch(from var(--ps-shadow) l c h / .5);transition:transform .16s ease,box-shadow .16s ease}
.cf-ps-range:hover::-webkit-slider-thumb{transform:scale(1.06)}
.cf-ps-range:active::-webkit-slider-thumb{transform:scale(.96)}
.cf-ps-range::-moz-range-track{height:8px;border-radius:999px;background:oklch(from var(--band-ink) l c h / .22)}
.cf-ps-range::-moz-range-progress{height:8px;border-radius:999px;background:var(--accent-fill,var(--accent))}
.cf-ps-range::-moz-range-thumb{width:18px;height:18px;border-radius:50%;background:var(--ps-thumb);border:5px solid var(--accent-fill,var(--accent));box-shadow:0 1px 2px oklch(from var(--ps-shadow) l c h / .45),0 4px 10px -2px oklch(from var(--ps-shadow) l c h / .5)}
.cf-ps-range:focus{outline:none}
.cf-ps-range:focus-visible{outline:3px solid oklch(from var(--band-ink) l c h / .6);outline-offset:4px}
.cf-ps-range:focus-visible::-webkit-slider-thumb{box-shadow:0 0 0 4px var(--ps-ring),0 1px 2px oklch(from var(--ps-shadow) l c h / .45),0 4px 10px -2px oklch(from var(--ps-shadow) l c h / .5)}
.cf-ps-range:focus-visible::-moz-range-thumb{box-shadow:0 0 0 4px var(--ps-ring),0 1px 2px oklch(from var(--ps-shadow) l c h / .45),0 4px 10px -2px oklch(from var(--ps-shadow) l c h / .5)}
.cf-ps-range:disabled{cursor:not-allowed;opacity:.55}
.cf-ps-ticks{display:flex;justify-content:space-between;gap:16px;margin-top:4px;font-size:.875rem;font-weight:600;line-height:1.3;color:oklch(from var(--band-ink) l c h / .82);font-variant-numeric:tabular-nums}
.cf-ps-toggle{display:inline-flex;gap:4px;padding:4px;border-radius:calc(var(--button-radius,var(--radius,12px)) + 4px);background:oklch(from var(--band-ink) l c h / .1);border:1px solid var(--ps-line)}
.cf-ps-seg{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 18px;border:0;border-radius:var(--button-radius,var(--radius,12px));background:transparent;color:var(--band-ink);font:inherit;font-size:.9375rem;font-weight:var(--button-weight,800);line-height:1.2;white-space:nowrap;cursor:pointer;transition:background .16s ease,color .16s ease,transform .16s ease}
.cf-ps-seg:active:not(:disabled){transform:translateY(1px)}
.cf-ps-seg:hover:not([aria-checked=true]):not(:disabled){background:oklch(from var(--band-ink) l c h / .1)}
.cf-ps-seg[aria-checked=true]{background:var(--band-ink);color:var(--band);box-shadow:0 1px 2px oklch(from var(--ps-shadow) l c h / .3)}
.cf-ps-seg:focus-visible{outline:3px solid oklch(from var(--band-ink) l c h / .6);outline-offset:2px}
.cf-ps-seg:disabled{cursor:not-allowed;opacity:.6}
.cf-ps-save{display:inline-flex;align-items:center;min-height:24px;padding:2px 8px;border-radius:999px;background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card));font-size:.875rem;font-weight:800;line-height:1.2}
.cf-ps-pull{max-width:920px;margin:clamp(40px,5vw,56px) 0 0;font-family:var(--font-display);font-size:clamp(2rem,3.6vw,3.25rem);font-weight:500;line-height:1.08;letter-spacing:var(--display-tracking,-0.025em);text-wrap:balance;color:var(--band-ink)}
.cf-ps-pull b{font-weight:var(--display-weight,800);font-variant-numeric:tabular-nums}
.cf-ps-cards{position:relative;display:grid;grid-template-columns:repeat(var(--ps-n,4),minmax(0,1fr));gap:16px;margin-top:clamp(32px,4vw,48px);align-items:stretch}
.cf-ps-card>*{grid-column:1}
.cf-ps-card>.cf-ps-top{grid-row:1}.cf-ps-card>.cf-ps-for{grid-row:2}.cf-ps-card>.cf-ps-figure{grid-row:3}.cf-ps-card>.cf-ps-note{grid-row:4}.cf-ps-card>.cf-ps-cta{grid-row:5}.cf-ps-card>.cf-ps-feat{grid-row:6}
.cf-ps-card{position:relative;container-type:inline-size;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:subgrid;grid-row:span 6;row-gap:0;align-content:start;min-width:0;padding:clamp(20px,2.2vw,28px);background:var(--card);color:var(--ink);border:1px solid var(--card-border,oklch(from var(--ink) l c h / .12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-md,0 1px 2px oklch(from var(--ps-shadow) l c h / .22),0 4px 10px -2px oklch(from var(--ps-shadow) l c h / .2)));animation:cf-ps-rise .45s cubic-bezier(.2,.7,.2,1) both;animation-delay:calc(var(--i,0) * .07s)}
.cf-ps-card.is-popular{border-color:var(--accent-fill,var(--accent));box-shadow:0 0 0 1px var(--accent-fill,var(--accent)),var(--shadow-lg,0 2px 4px oklch(from var(--ps-shadow) l c h / .22),0 12px 24px -8px oklch(from var(--ps-shadow) l c h / .32))}
.cf-ps-top{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:8px 12px}
.cf-ps-name{margin:0;font-family:var(--font-display);font-size:clamp(1.3125rem,1.8vw,1.625rem);font-weight:var(--display-weight,800);letter-spacing:-0.01em;line-height:1.15;text-transform:var(--display-case,none);color:var(--ink)}
.cf-ps-badge{display:inline-flex;align-items:center;min-height:28px;padding:4px 12px;border-radius:999px;background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card));font-size:.875rem;font-weight:800;line-height:1.2;white-space:nowrap;animation:cf-ps-pop .3s ease-out .2s both}
.cf-ps-for{margin:8px 0 0;font-size:1rem;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-ps-figure{display:flex;align-items:flex-end;margin-top:24px;height:clamp(2.5rem,4.2vw,3.75rem);height:clamp(2.5rem,26cqi,3.75rem);font-size:clamp(2.5rem,4.2vw,3.75rem);font-size:clamp(2.5rem,26cqi,3.75rem);font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:-0.03em;line-height:1;font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--ink)}
.cf-ps-amount{display:inline-flex;align-items:flex-start}
.cf-ps-cur{margin:.12em .06em 0 0;font-size:.42em;line-height:1;letter-spacing:0}
.cf-ps-word{font-size:.8em}
.cf-ps-word.is-off{font-size:.5em;color:var(--muted)}
.cf-ps-note{margin:12px 0 0;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-ps-cta{margin-top:16px}
.cf-ps-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;width:100%;min-height:64px;padding:10px 16px;border:1px solid transparent;border-radius:var(--button-radius,var(--radius,12px));font-family:var(--button-font,var(--font-display));text-align:center;text-decoration:none;cursor:pointer;transition:background .16s ease,box-shadow .16s ease,transform .16s ease}
.cf-ps-btn-main{font-size:clamp(1rem,6.6cqi,1.125rem);font-weight:var(--button-weight,800);line-height:1.15;text-transform:var(--button-case,none);text-wrap:balance}
.cf-ps-btn-sub{font-family:var(--font-body);font-size:.875rem;font-weight:600;line-height:1.25;text-wrap:pretty}
.cf-ps-btn.is-primary{color:var(--button-ink,var(--cta-ink));text-shadow:var(--button-text-shadow,none);background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l + .04) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - .02) c h));box-shadow:inset 0 1px 0 oklch(from var(--button-bg,var(--cta)) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - .16) c h),0 1px 2px oklch(from var(--ps-shadow) l c h / .3),0 8px 16px -6px oklch(from var(--ps-shadow) l c h / .42)}
.cf-ps-btn.is-primary:hover:not(:disabled),.cf-ps-btn.is-primary.is-hover{background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l - .01) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - .07) c h));box-shadow:inset 0 1px 0 oklch(from var(--button-bg,var(--cta)) calc(l + .1) c h / .6),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - .18) c h),0 1px 2px oklch(from var(--ps-shadow) l c h / .34),0 10px 18px -6px oklch(from var(--ps-shadow) l c h / .5)}
.cf-ps-btn.is-primary:active:not(:disabled),.cf-ps-btn.is-primary.is-active{transform:translateY(1px);box-shadow:inset 0 2px 3px oklch(from var(--button-bg,var(--cta)) calc(l - .22) c h / .45),inset 0 -2px 0 oklch(from var(--button-bg,var(--cta)) calc(l - .16) c h),0 1px 2px oklch(from var(--ps-shadow) l c h / .3)}
.cf-ps-btn.is-secondary{color:var(--button-2-ink,var(--secondary-ink));background:var(--button-2-bg,var(--secondary));border-color:var(--button-2-border,transparent);box-shadow:var(--button-2-shadow,var(--shadow-sm,0 1px 2px oklch(from var(--ps-shadow) l c h / .2)))}
.cf-ps-btn.is-secondary:hover:not(:disabled){background:oklch(from var(--button-2-bg,var(--secondary)) calc(l - .04) c h)}
.cf-ps-btn.is-secondary:active:not(:disabled){transform:translateY(1px)}
.cf-ps-btn:focus-visible{outline:3px solid oklch(from var(--field-focus,var(--accent)) l c h / .6);outline-offset:3px}
.cf-ps-btn:disabled{cursor:not-allowed;color:var(--muted);background:color-mix(in oklch,var(--ink) 7%,var(--card));border-color:transparent;box-shadow:none;text-shadow:none}
.cf-ps-feat{margin-top:24px;padding-top:20px;border-top:1px solid oklch(from var(--ink) l c h / .12)}
.cf-ps-list-head{margin:0 0 12px;font-size:1rem;font-weight:800;line-height:1.35;color:var(--ink)}
.cf-ps-list{display:grid;gap:12px;margin:0;padding:0;list-style:none}
.cf-ps-list li{display:grid;grid-template-columns:18px minmax(0,1fr);gap:12px;align-items:start;font-size:1rem;line-height:1.4;color:var(--ink);text-wrap:pretty}
.cf-ps-list svg{margin-top:.12em;color:var(--success)}
.cf-ps-tag{display:inline-block;padding:2px 12px;border-radius:999px;background:color-mix(in oklch,var(--ink) 6%,var(--card));font-size:.875rem;font-weight:800;line-height:1.4;white-space:nowrap}
.cf-ps-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.cf-ps-dots{display:none;justify-content:center;margin-top:4px}
.cf-ps-dot{display:grid;place-items:center;width:44px;height:44px;padding:0;border:0;background:transparent;cursor:pointer}
.cf-ps-dot span{display:block;width:8px;height:8px;border-radius:999px;background:oklch(from var(--band-ink) l c h / .35);transition:width .16s ease,background .16s ease}
.cf-ps-dot[aria-current=true] span{width:22px;background:var(--band-ink)}
.cf-ps-dot:focus-visible{outline:3px solid oklch(from var(--band-ink) l c h / .6);outline-offset:-8px;border-radius:999px}
.cf-ps-ps{max-width:64ch;margin:clamp(32px,4vw,48px) auto 0;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;text-align:center;text-wrap:pretty;color:var(--band-ink)}
.cf-ps-ps strong{margin-inline-end:.35em;font-weight:800}
@keyframes cf-ps-rise{from{opacity:.82;transform:translateY(8px)}}
@keyframes cf-ps-pop{from{transform:scale(.9)}}
@media (max-width:1023px){.cf-ps-cards{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:760px){.cf-ps-spread{grid-template-columns:minmax(0,1fr);gap:20px}.cf-ps-side{padding-top:0}.cf-ps-bar{grid-template-columns:minmax(0,1fr)}.cf-ps-toggle{justify-self:start}}
@media (max-width:640px){
.cf-ps-bar{position:sticky;top:0;z-index:3;gap:10px;margin-inline:calc(var(--ps-g) * -1);padding:12px var(--ps-g);border:0;border-bottom:1px solid var(--ps-line);border-radius:0;background:var(--band)}
.cf-ps-ticks{display:none}
.cf-ps-toggle{display:flex;justify-self:stretch;width:100%}
.cf-ps-seg{flex:1 1 0}
.cf-ps-pull{display:none}
.cf-ps-cards{display:flex;gap:var(--ps-g);margin:16px calc(var(--ps-g) * -1) 0;padding:6px var(--ps-g) 12px;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x mandatory;scroll-padding-inline:var(--ps-g);scrollbar-width:none}
.cf-ps-cards::-webkit-scrollbar{display:none}
.cf-ps-card{flex:0 0 84%;scroll-snap-align:start}
.cf-ps-dots{display:flex}
}
@media (prefers-reduced-motion:reduce){.cf-ps-card,.cf-ps-badge{animation:none}.cf-ps-btn,.cf-ps-seg,.cf-ps-dot span,.cf-ps-range::-webkit-slider-thumb{transition:none}}
`;
pieces/content/pricing-slider/specimen.tsx 122 lines
// Specimen: Inkwell, a fictional email platform for authors, priced by the size of the reader list.
import React from 'react';
import { BookOpen, Mail, PenLine, TrendingUp, Workflow } from 'lucide-react';
import { PricingSlider, type PricingPlan, type PricingStop } from '../pricing-slider';
import defaults from '../../studio-defaults.json';
export const states = ['default', 'hover', 'active', 'disabled'];
type SpecimenState = 'default' | 'hover' | 'active' | 'disabled';
const guarantee = defaults.sample.guarantee;
const stops: PricingStop[] = [
{ value: 500 },
{ value: 1000 },
{ value: 2500 },
{ value: 5000 },
{ value: 10000 },
{ value: 25000 },
{ value: 50000 },
{ value: 100000, label: '100,000+' },
];
const draftPrices: (number | false)[] = [0, 0, false, false, false, false, false, false];
const custom = [null, null, null, null, null, null, null, null];
const bigList = { label: 'Talk to our team', sublabel: 'Pricing for 100,000+ readers' };
const plans: PricingPlan[] = [
{
id: 'draft',
name: 'Draft',
forLine: 'Your first readers, free while you find your voice.',
prices: { monthly: draftPrices, yearly: draftPrices },
freeNote: 'Free forever, up to 1,000 readers',
limitNote: 'Draft covers lists up to 1,000 readers.',
cta: { label: 'Start writing free', sublabel: 'No card needed' },
ctaStyle: 'secondary',
featuresHeading: 'Everything to start your list:',
features: [
{ label: 'Unlimited newsletter sends' },
{ label: 'Reader sign-up page' },
{ label: 'Import your existing list' },
{ label: 'Open and click stats' },
],
},
{
id: 'chapter',
name: 'Chapter',
forLine: 'For authors ready to sell books straight from their list.',
prices: { monthly: [15, 20, 30, 50, 80, 150, 250, null], yearly: [12, 16, 24, 40, 64, 120, 200, null] },
cta: { label: 'Start Chapter', sublabel: guarantee },
customCta: bigList,
featuresHeading: 'Everything in Draft, plus:',
features: [
{ label: 'Book launch sequences' },
{ label: 'Pre-order links in every email' },
{ label: 'Reader segments by genre' },
{ label: 'Remove Inkwell branding' },
],
},
{
id: 'series',
name: 'Series',
forLine: 'For authors running a series, a shop and a growing list.',
prices: { monthly: [30, 40, 60, 90, 140, 250, 400, null], yearly: [24, 32, 48, 72, 112, 200, 320, null] },
cta: { label: 'Start Series', sublabel: guarantee },
customCta: bigList,
featuresHeading: 'Everything in Chapter, plus:',
features: [
{ label: 'Paid newsletter tiers', tag: '0% fee' },
{ label: 'Advance reader team tools' },
{ label: 'Automations across launches' },
{ label: 'Advanced reader analytics' },
{ label: 'Priority support' },
],
},
{
id: 'imprint',
name: 'Imprint',
forLine: 'For small presses and author collectives.',
prices: { monthly: custom, yearly: custom },
cta: { label: 'Talk to our team', sublabel: 'We’ll price it around your list' },
ctaStyle: 'secondary',
featuresHeading: 'Everything in Series, plus:',
features: [
{ label: 'A workspace for every author' },
{ label: 'Dedicated sending domain' },
{ label: 'Done-for-you migration' },
{ label: 'Custom contract and invoicing' },
],
},
];
export default function PricingSliderSpecimen({ state = 'default' }: { state?: SpecimenState }) {
return (
<PricingSlider
state={state}
headline='A price that grows with your readers.'
lead='Slide to your list size and see exactly what Inkwell costs, from your first 500 readers to 100,000 and beyond.'
includes={[
{ label: 'Newsletters', icon: Mail },
{ label: 'Book pages', icon: BookOpen },
{ label: 'Sign-up forms', icon: PenLine },
{ label: 'Welcome sequence', icon: Workflow },
{ label: 'Reader stats', icon: TrendingUp },
]}
stops={stops}
defaultStop={1}
plans={plans}
popularPlan='series'
defaultBilling='yearly'
ps={'Every paid plan carries a ' + guarantee + '. If Inkwell doesn’t earn its place in your next launch, you get every cent back.'}
copy={{
sliderLabel: 'Pricing for {count} readers',
valueText: '{count} readers',
pull: 'At {count} readers, {plan} is {price} {per}.',
pullCustom: 'At {count} readers, {plan} is priced around your list.',
plansLabel: 'Inkwell plans',
}}
/>
);
}
| Name | Type | Details |
|---|---|---|
headline OptionalPricingSlider |
React.ReactNode |
|
lead OptionalPricingSlider |
React.ReactNode |
|
includesLabel OptionalPricingSlider |
string |
|
includes OptionalPricingSlider |
{ label: string; icon?: LucideIcon }[] |
|
stops OptionalPricingSlider |
PricingStop[] |
|
defaultStop OptionalPricingSlider |
number |
|
plans OptionalPricingSlider |
PricingPlan[] |
|
popularPlan OptionalPricingSlider |
string |
|
defaultBilling OptionalPricingSlider |
PricingBilling |
|
currency OptionalPricingSlider |
string |
|
locale OptionalPricingSlider |
string |
|
ps OptionalPricingSlider |
React.ReactNode |
|
copy OptionalPricingSlider |
Partial<PricingSliderCopy> |
|
state OptionalPricingSlider |
'default' | 'hover' | 'active' | 'disabled' |
|
onAction OptionalPricingSlider |
(planId: string, context: PricingContext) => void |
|
onChange OptionalPricingSlider |
(context: { stopIndex: number; subscribers: number; billing: PricingBilling }) => void |
|
className OptionalPricingSlider |
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-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-bg--button-2-border--button-2-ink--button-2-shadow- Secondary button.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field--field-focus--field-radius- Form inputs: background, ink, border, radius and focus colour.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
This piece reads no image slots.
-
2c539f422023a290.webp
image/webp · 115 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB