Donation Picker 3
Donation slider: a big centred promise over a moving water band. A photo of the work crossfades as the slider
Use it in a prompt
Use offer/donation-picker-3 from the FunnelDNA library. Follow the skill and theme contract. Ask me for the copy, images, and brand details you need; do not invent proof.
Paste into Claude or ChatGPT with FunnelDNA connected (MCP setup), or alongside the skill.
Use it in code
- Save
component.tsx(Code tab) ascomponents/funneldna/offer/donation-picker-3.tsx. - Import it and pass your copy and images (Props tab):
import { DonationPicker3 } from "@/components/funneldna/offer/donation-picker-3"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/donation-picker-3/component.tsx 541 lines
// layout: classic-centred-stack
// Donation slider: a big centred promise over a moving water band. A photo of the work crossfades as the slider
// snaps to each supplied gift, the impact line updates with it, and one give button hands the gift to onSubmit.
import * as React from 'react';
import { AlertCircle, Receipt, Repeat } from 'lucide-react';
import { BackdropVideo, Divider, FX_HOST } from '../fx/fx';
import water from '../fx/loops/water';
export type DonationSliderFrequency = 'once' | 'monthly';
export type DonationStop = {
/** One-time amount, a plain number in the page currency */
amount: number;
/** What the gift does, written to follow the amount: ‘plants 20 native trees’ */
impact: string;
/** Monthly amount, when it differs from the one-time amount */
monthlyAmount?: number;
/** What the monthly gift does, written to follow the amount */
monthlyImpact?: string;
/** item-n slot: a photo of the work this gift pays for */
image?: string;
imageAlt?: string;
/** object-position for the photo’s focal point */
imagePosition?: string;
};
export type DonationSliderValues = {
amount: number;
frequency: DonationSliderFrequency;
/** Index of the chosen stop, or null for a typed amount */
stop: number | null;
};
export type DonationPicker3Copy = {
frequencyLabel: string;
once: string;
monthly: string;
sliderLabel: string;
perMonth: string;
customLabel: string;
customPlaceholder: string;
/** Follows a typed amount that reaches a stop. Placeholders: {tier}, {impact} */
customCovers: string;
/** Follows a typed amount below the first stop. Placeholders: {tier}, {impact} */
customBelow: string;
/** Follows a typed amount when no stops are supplied */
customThanks: string;
customEmpty: string;
/** Placeholder: {amount} */
give: string;
/** Placeholder: {amount} */
giveMonthly: string;
chooseAmount: string;
/** The plain instruction above the button */
instruction: string;
psLabel: string;
errorNumber: string;
errorEmpty: string;
/** Placeholder: {min} */
errorMin: string;
};
export type DonationPicker3Props = {
headline?: React.ReactNode;
lead?: React.ReactNode;
/** Gift stops on the slider, lowest first. Each one may carry its own photo */
stops?: DonationStop[];
defaultStop?: number;
defaultFrequency?: DonationSliderFrequency;
currency?: string;
minAmount?: number;
/** scene slot: shown for stops without their own photo */
image?: string;
imageAlt?: string;
imagePosition?: string;
/** Short line under the one-time / monthly switch */
monthlyNudge?: React.ReactNode;
/** Tax or receipt note under the button, shown only as supplied */
taxNote?: React.ReactNode;
/** P.S. line under the action */
ps?: React.ReactNode;
/** Looping fx backdrop behind the band. Set null for a flat band */
backdrop?: typeof water | null;
/** Curved hand-off into the next (surface) section */
edge?: boolean;
copy?: Partial<DonationPicker3Copy>;
state?: 'default' | 'hover' | 'active' | 'disabled' | 'error';
disabled?: boolean;
/** Receives the validated gift. The page wires checkout */
onSubmit?: (values: DonationSliderValues) => void;
className?: string;
};
export function DonationPicker3(props: DonationPicker3Props) {
const {
headline = 'See exactly what your gift does',
lead = 'Slide to an amount and watch the work it pays for.',
stops = DEFAULT_STOPS,
defaultStop = 1,
defaultFrequency = 'once',
currency = '$',
minAmount = 5,
image,
imageAlt = '',
imagePosition = '50% 40%',
monthlyNudge,
taxNote,
ps,
backdrop = water,
edge = true,
copy: copyProp,
state = 'default',
disabled = false,
onSubmit,
className,
} = props;
const copy: DonationPicker3Copy = { ...DEFAULT_COPY, ...copyProp };
const uid = React.useId();
const hasStops = stops.length > 0;
const hasSlider = stops.length > 1;
const startStop = hasStops ? Math.min(Math.max(0, Math.round(defaultStop)), stops.length - 1) : 0;
const [frequency, setFrequency] = React.useState<DonationSliderFrequency>(defaultFrequency);
const [stop, setStop] = React.useState(startStop);
const [custom, setCustom] = React.useState(state === 'error' ? ERROR_SAMPLE : '');
const [touched, setTouched] = React.useState(state === 'error');
const inputRef = React.useRef<HTMLInputElement>(null);
const firstRun = React.useRef(true);
React.useEffect(() => {
if (firstRun.current) {
firstRun.current = false;
return;
}
setStop(startStop);
setCustom(state === 'error' ? ERROR_SAMPLE : '');
setTouched(state === 'error');
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [state]);
const isOff = disabled || state === 'disabled';
const monthly = frequency === 'monthly';
const amountOf = (s: DonationStop) => (monthly ? s.monthlyAmount ?? s.amount : s.amount);
const impactOf = (s: DonationStop) => (monthly ? s.monthlyImpact ?? s.impact : s.impact);
const safeStop = Math.min(stop, Math.max(0, stops.length - 1));
const current = hasStops ? stops[safeStop] : undefined;
const customActive = !hasStops || custom.trim() !== '';
const parsed = parseAmount(custom, currency, minAmount);
const valid = customActive ? parsed.error === null : Boolean(current);
const amount: number | null = customActive ? (valid ? parsed.value : null) : current ? amountOf(current) : null;
let covered = -1;
if (customActive && amount !== null) {
stops.forEach((s, i) => {
if (amount >= amountOf(s)) covered = i;
});
}
let numeral = '';
let line = copy.customEmpty;
if (!customActive && current) {
numeral = money(amountOf(current), currency);
line = impactOf(current);
} else if (amount !== null) {
numeral = money(amount, currency);
if (covered >= 0) {
line = fill(copy.customCovers, { tier: money(amountOf(stops[covered]), currency), impact: impactOf(stops[covered]) });
} else if (hasStops) {
line = fill(copy.customBelow, { tier: money(amountOf(stops[0]), currency), impact: impactOf(stops[0]) });
} else {
line = copy.customThanks;
}
}
let errorText = '';
if (customActive) {
if (parsed.error === 'number') errorText = copy.errorNumber;
else if (parsed.error === 'min' && touched) errorText = fill(copy.errorMin, { min: money(minAmount, currency) });
else if (parsed.error === 'empty' && touched && !hasStops) errorText = copy.errorEmpty;
}
const label =
amount !== null
? fill(monthly ? copy.giveMonthly : copy.give, { amount: money(amount, currency) })
: copy.chooseAmount;
const layers = hasStops
? stops.map((s) => ({ src: s.image ?? image, alt: s.imageAlt ?? imageAlt, pos: s.imagePosition ?? imagePosition }))
: image
? [{ src: image, alt: imageAlt, pos: imagePosition }]
: [];
const hasPhoto = layers.some((l) => Boolean(l.src));
const activeLayer = hasStops ? (customActive && covered >= 0 ? covered : safeStop) : 0;
const frac = hasSlider ? safeStop / (stops.length - 1) : 0;
const pick = (i: number) => {
setStop(i);
setCustom('');
setTouched(false);
};
const submit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
if (isOff) return;
if (!valid || amount === null) {
setTouched(true);
inputRef.current?.focus();
return;
}
onSubmit?.({ amount, frequency, stop: customActive ? null : safeStop });
};
const hostStyle = { ...FX_HOST, ...(edge ? { '--dp3-edge': '56px' } : {}) } as React.CSSProperties;
const force = state === 'hover' || state === 'active' ? state : undefined;
const errorId = `${uid}-err`;
const tickOf = (i: number) => ({ '--f': String(hasSlider ? i / (stops.length - 1) : 0) }) as React.CSSProperties;
return (
<section
className={['cf-donation-picker-3', hasPhoto ? 'has-photo' : '', className].filter(Boolean).join(' ')}
style={hostStyle}
aria-labelledby={`${uid}-h`}
>
<style>{CSS}</style>
{backdrop ? <BackdropVideo video={backdrop} treatment='duotone' control='top-right' /> : null}
<div className='dp3-inner'>
<header className='dp3-head'>
<h2 id={`${uid}-h`}>{headline}</h2>
{lead ? <p className='dp3-lead'>{lead}</p> : null}
</header>
<div className='dp3-stage'>
{hasPhoto ? (
<div className='dp3-photo'>
{layers.map((l, i) =>
l.src ? (
<img
key={i}
src={l.src}
alt={i === activeLayer ? l.alt : ''}
aria-hidden={i === activeLayer ? undefined : true}
className={'dp3-shot' + (i === activeLayer ? ' is-on' : '')}
style={{ objectPosition: l.pos }}
decoding='async'
/>
) : null
)}
</div>
) : null}
<form className='dp3-card' onSubmit={submit} noValidate>
<fieldset className='dp3-controls' disabled={isOff}>
<div className='dp3-top'>
<fieldset className='dp3-freq'>
<legend className='dp3-sr'>{copy.frequencyLabel}</legend>
{(['once', 'monthly'] as const).map((f) => (
<label key={f} className={'dp3-seg' + (frequency === f ? ' is-on' : '')}>
<input
type='radio'
name={`${uid}-freq`}
value={f}
checked={frequency === f}
onChange={() => setFrequency(f)}
/>
{f === 'monthly' ? <Repeat size={16} strokeWidth={2.5} aria-hidden='true' className='dp3-seg-ico' /> : null}
{f === 'once' ? copy.once : copy.monthly}
</label>
))}
</fieldset>
{monthlyNudge ? <p className='dp3-nudge'>{monthlyNudge}</p> : null}
</div>
<div className='dp3-impact' aria-live='polite' aria-atomic='true'>
<p key={numeral + '|' + line} className='dp3-say'>
{numeral ? (
<>
<span className='dp3-num'>
{numeral}
{monthly ? <span className='dp3-per'>{copy.perMonth}</span> : null}
</span>{' '}
</>
) : null}
<span className='dp3-line'>{line}</span>
</p>
</div>
{hasSlider ? (
<>
<label className='dp3-sr' htmlFor={`${uid}-range`}>
{copy.sliderLabel}
</label>
<div
className={'dp3-slider' + (customActive ? ' is-custom' : '')}
style={{ '--frac': String(frac) } as React.CSSProperties}
>
<div className='dp3-rail' aria-hidden='true'>
<span className='dp3-fill' />
{stops.map((_, i) => (
<span
key={i}
className={'dp3-notch' + (!customActive && i <= safeStop ? ' is-past' : '')}
style={tickOf(i)}
/>
))}
</div>
<input
id={`${uid}-range`}
type='range'
className='dp3-range'
min={0}
max={stops.length - 1}
step={1}
value={safeStop}
onChange={(e) => pick(Number(e.target.value))}
aria-valuetext={current ? `${money(amountOf(current), currency)} ${impactOf(current)}` : undefined}
/>
</div>
<div className='dp3-ticks' aria-hidden='true'>
{stops.map((s, i) => (
<button
key={i}
type='button'
tabIndex={-1}
className={'dp3-tick' + (!customActive && i === safeStop ? ' is-on' : '')}
style={tickOf(i)}
onClick={() => pick(i)}
>
{money(amountOf(s), currency)}
{monthly ? <span className='dp3-tick-per'>{copy.perMonth}</span> : null}
</button>
))}
</div>
</>
) : null}
<div className='dp3-custom'>
<label htmlFor={`${uid}-amt`}>{copy.customLabel}</label>
<div className='dp3-field'>
<span className='dp3-cur' aria-hidden='true'>
{currency}
</span>
<input
ref={inputRef}
id={`${uid}-amt`}
type='text'
inputMode='decimal'
autoComplete='off'
placeholder={copy.customPlaceholder}
value={custom}
onChange={(e) => setCustom(e.target.value)}
onBlur={() => {
if (custom.trim() !== '') setTouched(true);
}}
className={(custom.trim() !== '' ? 'is-active' : '') + (errorText ? ' is-error' : '')}
style={{ paddingLeft: `calc(24px + ${Math.max(1, currency.length)}ch)` }}
aria-invalid={errorText ? true : undefined}
aria-describedby={errorText ? errorId : undefined}
/>
</div>
{errorText ? (
<p id={errorId} className='dp3-error' role='alert'>
<AlertCircle size={16} strokeWidth={2.5} aria-hidden='true' className='dp3-inline-ico' />
{errorText}
</p>
) : null}
</div>
<p className='dp3-instruction'>{copy.instruction}</p>
<button type='submit' className='dp3-give' data-force={force}>
{label}
</button>
{taxNote ? (
<p className='dp3-tax'>
<Receipt size={16} strokeWidth={2.5} aria-hidden='true' className='dp3-inline-ico' />
{taxNote}
</p>
) : null}
{ps ? (
<p className='dp3-ps'>
<strong>{copy.psLabel}</strong> {ps}
</p>
) : null}
</fieldset>
</form>
</div>
</div>
{edge ? <Divider shape='curve' tone='surface' height={56} /> : null}
</section>
);
}
export default DonationPicker3;
const ERROR_SAMPLE = '3';
const DEFAULT_STOPS: DonationStop[] = [
{ amount: 25, impact: 'gets the work started' },
{ amount: 50, impact: 'carries the work further' },
{ amount: 100, impact: 'goes furthest of all' },
];
const DEFAULT_COPY: DonationPicker3Copy = {
frequencyLabel: 'How often would you like to give?',
once: 'Give once',
monthly: 'Monthly',
sliderLabel: 'Choose your gift',
perMonth: '/mo',
customLabel: 'Or type your own amount',
customPlaceholder: '75',
customCovers: 'is enough for the {tier} gift, which {impact}.',
customBelow: 'helps. At {tier}, a gift {impact}.',
customThanks: 'helps keep this work going.',
customEmpty: 'Type an amount to see what it does.',
give: 'Give {amount} now',
giveMonthly: 'Give {amount} a month',
chooseAmount: 'Choose an amount',
instruction: 'Slide to your gift, then click the button below to give.',
psLabel: 'P.S.',
errorNumber: 'Enter an amount in numbers, like 75.',
errorEmpty: 'Enter the amount you’d like to give.',
errorMin: 'The smallest gift is {min}.',
};
type ParseError = 'empty' | 'number' | 'min' | null;
function parseAmount(raw: string, currency: string, min: number): { value: number | null; error: ParseError } {
const text = (currency ? raw.split(currency).join('') : raw).replace(/[, ]/g, '').trim();
if (!text) return { value: null, error: 'empty' };
if (!/^[0-9]+([.][0-9]{1,2})?$/.test(text)) return { value: null, error: 'number' };
const value = Number.parseFloat(text);
if (value < min) return { value, error: 'min' };
return { value, error: null };
}
function money(n: number, currency: string) {
const whole = Math.round(n * 100) % 100 === 0;
return currency + n.toLocaleString('en-US', { minimumFractionDigits: whole ? 0 : 2, maximumFractionDigits: 2 });
}
function fill(template: string, values: Record<string, string>) {
return template.replace(/[{]([a-z]+)[}]/gi, (match, key: string) => values[key] ?? match);
}
const CSS = `
.cf-donation-picker-3{position:relative;isolation:isolate;overflow:hidden;box-sizing:border-box;background:var(--band);color:var(--band-ink);font-family:var(--font-body);padding:clamp(56px,8vw,112px) clamp(16px,5vw,48px) calc(clamp(64px,8.5vw,120px) + var(--dp3-edge,0px))}
.cf-donation-picker-3 *,.cf-donation-picker-3 *::before,.cf-donation-picker-3 *::after{box-sizing:border-box}
.cf-donation-picker-3 .dp3-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-donation-picker-3 .dp3-inner{position:relative;z-index:1;max-width:1120px;margin:0 auto;display:flex;flex-direction:column;align-items:center;text-align:center}
.cf-donation-picker-3 .dp3-head{max-width:54rem;margin:0 0 clamp(32px,4vw,48px)}
.cf-donation-picker-3 .dp3-head h2{margin:0;font-family:var(--font-display);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);color:var(--band-ink);text-wrap:balance}
.cf-donation-picker-3 .dp3-lead{margin:clamp(16px,1.8vw,24px) auto 0;max-width:40rem;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:color-mix(in oklch,var(--band-ink) 90%,var(--band));text-wrap:pretty}
.cf-donation-picker-3 .dp3-stage{width:100%;max-width:1040px;display:flex;flex-direction:column;align-items:center}
.cf-donation-picker-3 .dp3-photo{position:relative;width:100%;aspect-ratio:21/9;border-radius:var(--radius,12px);overflow:hidden;background:oklch(from var(--band) calc(l + 0.06) c h)}
.cf-donation-picker-3 .dp3-shot{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:0;transform:scale(1.04);transition:opacity .6s cubic-bezier(.2,.7,.2,1),transform 1.4s cubic-bezier(.2,.7,.2,1)}
.cf-donation-picker-3 .dp3-shot.is-on{opacity:1;transform:none}
.cf-donation-picker-3 .dp3-card{position:relative;width:min(46rem,100%);margin:0;padding:clamp(20px,3vw,32px);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(--card-shadow,var(--shadow-lg,0 2px 4px oklch(0.22 0.03 260 / 0.22),0 12px 24px -8px oklch(0.22 0.03 260 / 0.32)));text-align:center}
.cf-donation-picker-3.has-photo .dp3-card{width:min(46rem,calc(100% - 16px));margin-top:calc(-1 * clamp(40px,6vw,88px))}
.cf-donation-picker-3 .dp3-controls{border:0;margin:0;padding:0;min-width:0}
.cf-donation-picker-3 .dp3-top{display:flex;flex-direction:column;align-items:center;gap:8px}
.cf-donation-picker-3 .dp3-freq{position:relative;display:inline-flex;gap:4px;margin:0;padding:4px;border:0;border-radius:999px;background:color-mix(in oklch,var(--ink) 6%,var(--card))}
.cf-donation-picker-3 .dp3-seg{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 20px;border-radius:999px;font-size:.9375rem;font-weight:800;line-height:1.2;color:var(--muted);cursor:pointer;transition:background .16s ease,color .16s ease,box-shadow .16s ease}
.cf-donation-picker-3 .dp3-seg input{position:absolute;width:1px;height:1px;margin:0;opacity:0;pointer-events:none}
.cf-donation-picker-3 .dp3-seg:hover{color:var(--ink)}
.cf-donation-picker-3 .dp3-seg.is-on{background:var(--card);color:var(--ink);box-shadow:inset 0 0 0 1px oklch(from var(--ink) l c h / 0.12),var(--shadow-sm,0 1px 1px oklch(0.22 0.03 260 / 0.18),0 1px 3px oklch(0.22 0.03 260 / 0.14))}
.cf-donation-picker-3 .dp3-seg:has(input:focus-visible){outline:3px solid oklch(from var(--field-focus,var(--accent)) l c h / 0.5);outline-offset:2px}
.cf-donation-picker-3 .dp3-seg-ico{flex:0 0 auto}
.cf-donation-picker-3 .dp3-nudge{margin:0;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
.cf-donation-picker-3 .dp3-impact{display:flex;align-items:center;justify-content:center;min-height:calc(2 * 1.2 * clamp(2.5rem,4.2vw,3.75rem));margin:clamp(16px,2.5vw,24px) 0 12px}
.cf-donation-picker-3 .dp3-say{margin:0;font-family:var(--font-display);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.2;text-wrap:balance;animation:dp3-in .45s cubic-bezier(.2,.7,.2,1) both}
.cf-donation-picker-3 .dp3-num{display:inline-block;font-size:clamp(2.5rem,4.2vw,3.75rem);font-weight:var(--display-weight,800);letter-spacing:-0.03em;line-height:1;font-variant-numeric:tabular-nums;color:var(--accent);animation:dp3-pop .3s cubic-bezier(.2,.7,.2,1) both}
.cf-donation-picker-3 .dp3-per{margin-left:2px;font-family:var(--font-body);font-size:.875rem;font-weight:800;letter-spacing:0;color:var(--muted)}
.cf-donation-picker-3 .dp3-line{font-weight:var(--display-weight,800);letter-spacing:-0.01em;color:var(--ink)}
.cf-donation-picker-3 .dp3-slider{position:relative;height:44px}
.cf-donation-picker-3 .dp3-rail{position:absolute;left:0;right:0;top:50%;height:10px;margin-top:-5px;border-radius:999px;background:color-mix(in oklch,var(--ink) 12%,var(--card));pointer-events:none}
.cf-donation-picker-3 .dp3-fill{position:absolute;left:0;top:0;bottom:0;width:calc(16px + (100% - 32px) * var(--frac,0));border-radius:inherit;background:var(--accent-fill,var(--accent));transition:width .25s cubic-bezier(.2,.7,.2,1),background .16s ease}
.cf-donation-picker-3 .dp3-notch{position:absolute;top:50%;left:calc(16px + (100% - 32px) * var(--f,0));width:6px;height:6px;margin:-3px 0 0 -3px;border-radius:50%;background:oklch(from var(--ink) l c h / 0.35)}
.cf-donation-picker-3 .dp3-notch.is-past{background:var(--accent-fill-ink,var(--card))}
.cf-donation-picker-3 .dp3-slider.is-custom .dp3-fill{background:color-mix(in oklch,var(--ink) 28%,var(--card))}
.cf-donation-picker-3 .dp3-range{-webkit-appearance:none;appearance:none;position:absolute;inset:0;width:100%;height:44px;margin:0;padding:0;background:transparent;cursor:pointer}
.cf-donation-picker-3 .dp3-range:focus{outline:none}
.cf-donation-picker-3 .dp3-range::-webkit-slider-runnable-track{height:44px;background:transparent;border:0}
.cf-donation-picker-3 .dp3-range::-moz-range-track{height:44px;background:transparent;border:0}
.cf-donation-picker-3 .dp3-range::-webkit-slider-thumb{-webkit-appearance:none;width:32px;height:32px;margin-top:6px;border-radius:50%;background:var(--card);border:4px solid var(--accent-fill,var(--accent));box-shadow:var(--shadow-md,0 1px 2px oklch(0.22 0.03 260 / 0.22),0 4px 10px -2px oklch(0.22 0.03 260 / 0.2));transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease}
.cf-donation-picker-3 .dp3-range::-moz-range-thumb{box-sizing:border-box;width:32px;height:32px;border-radius:50%;background:var(--card);border:4px solid var(--accent-fill,var(--accent));box-shadow:var(--shadow-md,0 1px 2px oklch(0.22 0.03 260 / 0.22),0 4px 10px -2px oklch(0.22 0.03 260 / 0.2));transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease}
.cf-donation-picker-3 .dp3-range:hover::-webkit-slider-thumb{transform:scale(1.08)}
.cf-donation-picker-3 .dp3-range:hover::-moz-range-thumb{transform:scale(1.08)}
.cf-donation-picker-3 .dp3-range:active{cursor:grabbing}
.cf-donation-picker-3 .dp3-range:active::-webkit-slider-thumb{transform:scale(.96)}
.cf-donation-picker-3 .dp3-range:active::-moz-range-thumb{transform:scale(.96)}
.cf-donation-picker-3 .dp3-range:focus-visible::-webkit-slider-thumb{box-shadow:0 0 0 4px oklch(from var(--field-focus,var(--accent)) l c h / 0.4),var(--shadow-sm,0 1px 1px oklch(0.22 0.03 260 / 0.18),0 1px 3px oklch(0.22 0.03 260 / 0.14))}
.cf-donation-picker-3 .dp3-range:focus-visible::-moz-range-thumb{box-shadow:0 0 0 4px oklch(from var(--field-focus,var(--accent)) l c h / 0.4),var(--shadow-sm,0 1px 1px oklch(0.22 0.03 260 / 0.18),0 1px 3px oklch(0.22 0.03 260 / 0.14))}
.cf-donation-picker-3 .dp3-slider.is-custom .dp3-range::-webkit-slider-thumb{border-color:color-mix(in oklch,var(--ink) 28%,var(--card))}
.cf-donation-picker-3 .dp3-slider.is-custom .dp3-range::-moz-range-thumb{border-color:color-mix(in oklch,var(--ink) 28%,var(--card))}
.cf-donation-picker-3 .dp3-range:disabled{cursor:not-allowed}
.cf-donation-picker-3 .dp3-range:disabled::-webkit-slider-thumb{border-color:color-mix(in oklch,var(--ink) 28%,var(--card));transform:none}
.cf-donation-picker-3 .dp3-range:disabled::-moz-range-thumb{border-color:color-mix(in oklch,var(--ink) 28%,var(--card));transform:none}
.cf-donation-picker-3 .dp3-ticks{position:relative;height:44px;margin:0 0 clamp(20px,3vw,28px)}
.cf-donation-picker-3 .dp3-tick{position:absolute;top:0;left:calc(16px + (100% - 32px) * var(--f,0));transform:translateX(-50%);display:inline-flex;align-items:center;min-height:44px;padding:0 8px;border:0;border-radius:8px;background:transparent;font-family:var(--font-body);font-size:.9375rem;font-weight:800;line-height:1;font-variant-numeric:tabular-nums;color:var(--muted);white-space:nowrap;cursor:pointer;transition:color .16s ease}
.cf-donation-picker-3 .dp3-tick:hover{color:var(--ink)}
.cf-donation-picker-3 .dp3-tick.is-on{color:var(--accent)}
.cf-donation-picker-3 .dp3-tick:disabled{cursor:not-allowed;color:var(--muted)}
.cf-donation-picker-3 .dp3-tick-per{margin-left:1px;font-size:.8125em;font-weight:700}
.cf-donation-picker-3 .dp3-custom{max-width:20rem;margin:0 auto;text-align:left}
.cf-donation-picker-3 .dp3-custom label{display:block;margin:0 0 8px;font-size:1rem;font-weight:700;line-height:1.3;text-align:center;color:var(--label-ink,var(--ink))}
.cf-donation-picker-3 .dp3-field{position:relative}
.cf-donation-picker-3 .dp3-cur{position:absolute;left:16px;top:50%;transform:translateY(-50%);font-size:1.0625rem;font-weight:800;color:var(--field-ink);pointer-events:none}
.cf-donation-picker-3 .dp3-field input{width:100%;height:56px;padding:0 16px;border:1px solid var(--field-border,color-mix(in oklch,var(--ink) 22%,transparent));border-radius:var(--field-radius,var(--radius,12px));background:var(--field);color:var(--field-ink);font-family:var(--font-body);font-size:1.0625rem;font-weight:700;font-variant-numeric:tabular-nums;transition:border-color .16s ease,box-shadow .16s ease}
.cf-donation-picker-3 .dp3-field input::placeholder{color:color-mix(in oklch,var(--field-ink) 65%,var(--field));opacity:1;font-weight:500}
.cf-donation-picker-3 .dp3-field input:hover:not(:disabled){border-color:color-mix(in oklch,var(--ink) 40%,transparent)}
.cf-donation-picker-3 .dp3-field input.is-active{border-color:var(--accent)}
.cf-donation-picker-3 .dp3-field input:focus{outline:none;border-color:var(--field-focus,var(--accent));box-shadow:0 0 0 3px oklch(from var(--field-focus,var(--accent)) l c h / 0.35)}
.cf-donation-picker-3 .dp3-field input.is-error{border-color:var(--danger)}
.cf-donation-picker-3 .dp3-field input.is-error:focus{box-shadow:0 0 0 3px oklch(from var(--danger) l c h / 0.3)}
.cf-donation-picker-3 .dp3-field input:disabled{cursor:not-allowed;background:color-mix(in oklch,var(--ink) 4%,var(--field))}
.cf-donation-picker-3 .dp3-error{margin:8px 0 0;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--danger);text-wrap:pretty}
.cf-donation-picker-3 .dp3-inline-ico{display:inline-block;vertical-align:-0.15em;margin-inline-end:.4em}
.cf-donation-picker-3 .dp3-instruction{margin:clamp(24px,3vw,32px) 0 16px;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;font-weight:600;color:var(--ink);text-wrap:pretty}
.cf-donation-picker-3 .dp3-give{display:flex;align-items:center;justify-content:center;width:100%;min-height:64px;padding:12px 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l + 0.04) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - 0.02) c h));color:var(--button-ink,var(--cta-ink));font-family:var(--button-font,var(--font-display));font-size:clamp(1.125rem,1.55vw,1.375rem);font-weight:var(--button-weight,800);line-height:1.15;text-transform:var(--button-case,none);text-shadow:var(--button-text-shadow,none);text-wrap:balance;cursor:pointer;box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta)) calc(l + 0.14) c h / 0.7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.16) c h),0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0.3),0 8px 16px -6px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0.4));transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
.cf-donation-picker-3 .dp3-give:hover:not(:disabled),.cf-donation-picker-3 .dp3-give[data-force=hover]:not(:disabled){background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l - 0.01) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - 0.07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta)) calc(l + 0.12) c h / 0.6),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.2) c h),0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0.32),0 10px 20px -6px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0.48))}
.cf-donation-picker-3 .dp3-give:active:not(:disabled),.cf-donation-picker-3 .dp3-give[data-force=active]:not(:disabled){transform:translateY(1px);background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l - 0.04) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - 0.08) c h));box-shadow:inset 0 2px 4px oklch(from var(--button-bg,var(--cta)) calc(l - 0.24) c h / 0.5),inset 0 -2px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.16) c h),0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0.3)}
.cf-donation-picker-3 .dp3-give:focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:3px}
.cf-donation-picker-3 .dp3-give:disabled{cursor:not-allowed;background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));text-shadow:none;box-shadow:var(--button-2-shadow,var(--shadow-sm))}
.cf-donation-picker-3 .dp3-tax{margin:12px 0 0;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
.cf-donation-picker-3 .dp3-ps{margin:24px 0 0;padding-top:20px;border-top:1px solid oklch(from var(--ink) l c h / 0.12);font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;color:var(--ink);text-wrap:pretty}
.cf-donation-picker-3 .dp3-ps strong{font-weight:800}
@keyframes dp3-in{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes dp3-pop{from{transform:scale(.9)}to{transform:none}}
@media (max-width:640px){
.cf-donation-picker-3 .dp3-photo{aspect-ratio:4/3}
.cf-donation-picker-3 .dp3-seg{padding:0 16px}
.cf-donation-picker-3 .dp3-impact{min-height:7rem}
}
@media (prefers-reduced-motion:reduce){
.cf-donation-picker-3 .dp3-shot,.cf-donation-picker-3 .dp3-fill,.cf-donation-picker-3 .dp3-seg,.cf-donation-picker-3 .dp3-tick,.cf-donation-picker-3 .dp3-give,.cf-donation-picker-3 .dp3-field input{transition:none}
.cf-donation-picker-3 .dp3-range::-webkit-slider-thumb{transition:none}
.cf-donation-picker-3 .dp3-range::-moz-range-thumb{transition:none}
.cf-donation-picker-3 .dp3-shot{transform:none}
.cf-donation-picker-3 .dp3-say,.cf-donation-picker-3 .dp3-num{animation:none}
}
`;
pieces/offer/donation-picker-3/specimen.tsx 51 lines
import __studioImage104e2504 from "../assets/68d5706cb8ea8823.webp";
import __studioImagea36cd61c from "../assets/9e6b66b4ef3d0549.webp";
import __studioImage283a274f from "../assets/4d85b91aa46221e6.webp";
// Specimen: Riverkeep Collective’s donation band, three gift stops with a photo each (fictional charity).
import { DonationPicker3, type DonationPicker3Props } from '../donation-picker-3';
import { slot } from '../../slots';
export const states = ['default', 'hover', 'active', 'disabled', 'error'];
export default function DonationPicker3Specimen({ state = 'default' }: { state?: DonationPicker3Props['state'] }) {
return (
<DonationPicker3
state={state}
headline='See what your gift does for the river'
lead='Slide to an amount and watch the work it pays for, from the first bag of litter to a full season of water tests.'
stops={[
{
amount: 20,
impact: 'pulls 15 kg of litter off the riverbank',
monthlyAmount: 10,
monthlyImpact: 'pulls 10 kg of litter off the bank every month',
image: slot('item-1', __studioImage104e2504),
imageAlt: 'Volunteers pulling litter from a muddy riverbank',
imagePosition: '50% 35%',
},
{
amount: 40,
impact: 'plants 20 native trees along the bank',
monthlyAmount: 20,
monthlyImpact: 'plants 10 native trees every month',
image: slot('item-2', __studioImagea36cd61c),
imageAlt: 'Volunteers planting young native trees along a riverbank',
imagePosition: '50% 35%',
},
{
amount: 100,
impact: 'tests the water at 5 river sites for a season',
monthlyAmount: 50,
monthlyImpact: 'funds water tests at 3 river sites every month',
image: slot('item-3', __studioImage283a274f),
imageAlt: 'A volunteer in waders taking a water sample in the river',
imagePosition: '50% 35%',
},
]}
defaultStop={1}
monthlyNudge='Monthly gifts let our crews plan the whole season.'
taxNote='Riverkeep Collective is a registered charity. Your gift is tax-deductible as allowed by law.'
ps='Choose monthly and the clean-ups, the planting and the water tests keep going all year.'
/>
);
}
| Name | Type | Details |
|---|---|---|
headline OptionalDonationPicker3 |
React.ReactNode |
|
lead OptionalDonationPicker3 |
React.ReactNode |
|
stops OptionalDonationPicker3 |
DonationStop[] |
|
defaultStop OptionalDonationPicker3 |
number |
|
defaultFrequency OptionalDonationPicker3 |
DonationSliderFrequency |
|
currency OptionalDonationPicker3 |
string |
|
minAmount OptionalDonationPicker3 |
number |
|
image OptionalDonationPicker3 |
string |
|
imageAlt OptionalDonationPicker3 |
string |
|
imagePosition OptionalDonationPicker3 |
string |
|
monthlyNudge OptionalDonationPicker3 |
React.ReactNode |
|
taxNote OptionalDonationPicker3 |
React.ReactNode |
|
ps OptionalDonationPicker3 |
React.ReactNode |
|
backdrop OptionalDonationPicker3 |
typeof water | null |
|
edge OptionalDonationPicker3 |
boolean |
|
copy OptionalDonationPicker3 |
Partial<DonationPicker3Copy> |
|
state OptionalDonationPicker3 |
'default' | 'hover' | 'active' | 'disabled' | 'error' |
|
disabled OptionalDonationPicker3 |
boolean |
|
onSubmit OptionalDonationPicker3 |
(values: DonationSliderValues) => void |
|
className OptionalDonationPicker3 |
string |
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-bg--button-2-ink--button-2-shadow- Secondary button.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field--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.
item-1- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-2- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-3- One image per offer item (item-1, item-2…), shown in stacks and lists.
- 3d53cce7e02aaec2.mp4 video/mp4 · 703 KB
-
4d85b91aa46221e6.webp
image/webp · 133 KB
-
68d5706cb8ea8823.webp
image/webp · 134 KB
-
9e6b66b4ef3d0549.webp
image/webp · 216 KB
-
d5990b92a498e43d.webp
image/webp · 31.7 KB