Impact Stats 1
Where-your-gift-goes ledger: the visitor types any amount and watches it split live into the supplied allocation lines, then gives. Reason-why transparency for 'where does my money actually go'.
Use it in a prompt
Use proof/impact-stats 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/proof/impact-stats.tsx. - Import it and pass your copy and images (Props tab):
import { ImpactStats } from "@/components/funneldna/proof/impact-stats"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/proof/impact-stats/component.tsx 750 lines
// layout: photo-overlap-card
// Where-your-gift-goes ledger: the visitor types any amount and watches it split live into the supplied allocation lines, then gives. Reason-why transparency for 'where does my money actually go'.
import * as React from 'react';
import { AlertCircle, FileText, ShieldCheck } from 'lucide-react';
export type ImpactAllocation = {
/** Ledger line, e.g. 'Meals for local families'. */
label: string;
/** Share of every gift as supplied, e.g. 84 for 84%. */
percent: number;
/** Short name in the bar legend; falls back to label. */
short?: string;
/** One short line under the ledger label. */
detail?: string;
/** Optional colour for this line's bar segment (a token recipe). */
tone?: string;
};
export type ImpactGift = {
/** Gift in major units, e.g. 50 for $50. */
amount: number;
currency: string;
lines: { label: string; percent: number; amount: number }[];
};
export type ImpactStatsCopy = {
amountLabel: string;
amountPlaceholder: string;
presetsLabel: string;
/** Card title; {amount} is the typed gift. */
title: string;
titleEmpty: string;
totalLabel: string;
barLabel: string;
/** Line above the bar; {percent}, {amount} and {label} of the highlighted segment. */
readout: string;
readoutEmpty: string;
/** Accessible segment name; {label}, {percent}, {amount}. */
segmentLabel: string;
segmentLabelEmpty: string;
/** Button label; {amount} is the typed gift. */
actionLabel: string;
actionLabelEmpty: string;
errorEmpty: string;
errorInvalid: string;
/** {min} is the smallest gift. */
errorMin: string;
/** {max} is the largest gift. */
errorMax: string;
};
const DEFAULT_COPY: ImpactStatsCopy = {
amountLabel: 'Type any gift amount',
amountPlaceholder: '50',
presetsLabel: 'Quick amounts',
title: 'Your {amount} gift, line by line',
titleEmpty: 'Your gift, line by line',
totalLabel: 'Total gift',
barLabel: 'How your gift is split',
readout: '{percent} · {amount} to {label}',
readoutEmpty: '{percent} of every gift to {label}',
segmentLabel: '{label}: {percent} of your gift, {amount}',
segmentLabelEmpty: '{label}: {percent} of every gift',
actionLabel: 'Give {amount} today',
actionLabelEmpty: 'Enter an amount to give',
errorEmpty: 'Enter the amount you would like to give.',
errorInvalid: 'Enter the amount in numbers, like 50.',
errorMin: 'Enter {min} or more.',
errorMax: 'Enter {max} or less.',
};
export type ImpactStatsProps = {
/** The supplied split of every gift. The whole block hides when this is empty. */
allocations?: ImpactAllocation[];
headline?: string;
/** One phrase inside the headline that gets the marker stroke. */
highlight?: string;
lead?: string;
/** scene slot: photo of the work the gift pays for. */
photoImage?: string;
photoAlt?: string;
/** Caption under the photo. */
photoCaption?: string;
/** Short reason-why paragraph beside the ledger. */
reason?: string;
/** Source line under the bar, e.g. the annual report. */
source?: { prefix?: string; label: string; href?: string };
/** Sample gift the ledger opens on. */
defaultAmount?: number;
presets?: number[];
min?: number;
max?: number;
currency?: string;
locale?: string;
copy?: Partial<ImpactStatsCopy>;
/** Risk-reversal line set right above the button. */
assurance?: string;
/** One short line under the button. */
note?: string;
/** Give destination; renders the action as a link. */
href?: string;
/** Called with the typed gift and its split when the visitor gives. */
onAction?: (gift: ImpactGift) => void;
state?: 'default' | 'hover' | 'active' | 'disabled' | 'error';
className?: string;
};
const TONES = [
'var(--accent-fill, var(--accent))',
'var(--ink)',
'color-mix(in oklch, var(--ink) 52%, var(--card))',
'color-mix(in oklch, var(--ink) 30%, var(--card))',
'oklch(from var(--accent-fill, var(--accent)) calc(l - 0.16) c h)',
'color-mix(in oklch, var(--accent-fill, var(--accent)) 45%, var(--card))',
];
const LEADER = '.'.repeat(160);
export function ImpactStats({
allocations = [],
headline = 'See where every dollar of your gift goes',
highlight = 'every dollar',
lead = 'Type any amount and watch it split, line by line, the same way every gift is spent.',
photoImage,
photoAlt = '',
photoCaption,
reason,
source,
defaultAmount = 50,
presets = [25, 50, 100, 250],
min = 1,
max = 100000,
currency = 'USD',
locale = 'en-US',
copy: copyOverrides,
assurance,
note,
href,
onAction,
state = 'default',
className,
}: ImpactStatsProps) {
const copy: ImpactStatsCopy = { ...DEFAULT_COPY, ...copyOverrides };
const uid = React.useId().replace(/[^a-zA-Z0-9]/g, '');
const startRaw = state === 'error' ? '' : defaultAmount > 0 ? String(defaultAmount) : '';
const [raw, setRaw] = React.useState(startRaw);
const [touched, setTouched] = React.useState(state === 'error');
const [active, setActive] = React.useState<number | null>(null);
const money = React.useMemo(() => makeMoney(locale, currency), [locale, currency]);
React.useEffect(() => {
setRaw(state === 'error' ? '' : defaultAmount > 0 ? String(defaultAmount) : '');
setTouched(state === 'error');
setActive(null);
}, [state, defaultAmount]);
const items = allocations.filter((a) => a && a.label && Number.isFinite(a.percent) && a.percent > 0);
if (items.length === 0) return null;
const disabled = state === 'disabled';
const minC = Math.round(min * 100);
const maxC = Math.round(max * 100);
const parsed = parseCents(raw);
let error = '';
if (parsed === null) error = raw.trim() ? copy.errorInvalid : copy.errorEmpty;
else if (parsed < minC) error = fill(copy.errorMin, { min: money.short(minC) });
else if (parsed > maxC) error = fill(copy.errorMax, { max: money.short(maxC) });
const valid = error === '';
const cents = valid && parsed !== null ? parsed : 0;
const shares = splitCents(cents, items.map((a) => a.percent));
const showError = touched && !valid;
const canGive = valid && !disabled;
const top = items.reduce((best, a, i) => (a.percent > items[best].percent ? i : best), 0);
const lit = state === 'hover' ? top : active;
const shown = lit === null ? top : lit;
const force = state === 'hover' || state === 'active' ? state : undefined;
const headId = 'cf-is-h-' + uid;
const titleId = 'cf-is-t-' + uid;
const inputId = 'cf-is-i-' + uid;
const errId = 'cf-is-e-' + uid;
const gift: ImpactGift = {
amount: cents / 100,
currency,
lines: items.map((a, i) => ({ label: a.label, percent: a.percent, amount: shares[i] / 100 })),
};
const title = valid ? fill(copy.title, { amount: money.short(cents) }) : copy.titleEmpty;
const actionText = valid ? fill(copy.actionLabel, { amount: money.short(cents) }) : copy.actionLabelEmpty;
const readoutText = valid
? fill(copy.readout, { amount: money.full(shares[shown]), label: items[shown].label })
: fill(copy.readoutEmpty, { label: items[shown].label });
function change(e: React.ChangeEvent<HTMLInputElement>) {
const next = e.target.value.replace(/[^0-9.]/g, '');
if (/^[0-9]{0,7}([.][0-9]{0,2})?$/.test(next)) setRaw(next);
setTouched(true);
}
function submit(e: React.FormEvent<HTMLFormElement>) {
e.preventDefault();
if (!canGive) {
setTouched(true);
return;
}
onAction?.(gift);
}
function linkClick(e: React.MouseEvent<HTMLAnchorElement>) {
if (!canGive) {
e.preventDefault();
setTouched(true);
return;
}
onAction?.(gift);
}
return (
<section className={['cf-impact-stats', className].filter(Boolean).join(' ')} aria-labelledby={headId}>
<style>{CSS}</style>
<div className='cf-is-wrap'>
<header className='cf-is-head'>
<h2 id={headId} className='cf-is-h2'>{renderHeadline(headline, highlight)}</h2>
{lead ? <p className='cf-is-lead'>{lead}</p> : null}
</header>
</div>
<div className='cf-is-stage' data-photo={photoImage ? 'true' : 'false'}>
{photoImage ? (
<figure className='cf-is-photo'>
<img src={photoImage} alt={photoAlt} width={1600} height={900} loading='lazy' decoding='async' />
</figure>
) : null}
<div className='cf-is-wrap cf-is-grid'>
<form className='cf-is-card' aria-labelledby={titleId} onSubmit={submit} noValidate>
<h3 id={titleId} className='cf-is-title'>{title}</h3>
<label className='cf-is-label' htmlFor={inputId}>{copy.amountLabel}</label>
<div className='cf-is-fieldrow'>
<div className='cf-is-inputwrap' style={{ ['--is-sym' as string]: money.symbol.length } as React.CSSProperties}>
<span className='cf-is-cur' aria-hidden='true'>{money.symbol}</span>
<input
id={inputId}
className='cf-is-input'
type='text'
inputMode='decimal'
autoComplete='off'
placeholder={copy.amountPlaceholder}
value={raw}
onChange={change}
onBlur={() => setTouched(true)}
aria-invalid={showError}
aria-describedby={showError ? errId : undefined}
disabled={disabled}
/>
</div>
{presets.length ? (
<div className='cf-is-presets' role='group' aria-label={copy.presetsLabel}>
{presets.map((p) => {
const pc = Math.round(p * 100);
const on = valid && pc === cents;
return (
<button
key={p}
type='button'
className='cf-is-chip'
aria-pressed={on}
disabled={disabled}
onClick={() => {
setRaw(String(p));
setTouched(true);
}}
>
{money.short(pc)}
</button>
);
})}
</div>
) : null}
</div>
{showError ? (
<p id={errId} className='cf-is-error' role='alert'>
<AlertCircle aria-hidden='true' size={16} strokeWidth={2.5} />
{error}
</p>
) : null}
<ol className='cf-is-lines'>
{items.map((a, i) => (
<li
key={a.label + i}
data-active={lit === i ? 'true' : undefined}
onMouseEnter={() => setActive(i)}
onMouseLeave={() => setActive(null)}
>
<div className='cf-is-line'>
<span className='cf-is-name'>{a.label}</span>
<span className='cf-is-leader' aria-hidden='true'>{LEADER}</span>
<span key={valid ? shares[i] : 'none'} className='cf-is-amt cf-is-tick'>
{valid ? money.full(shares[i]) : '—'}
</span>
</div>
<p className='cf-is-detail'>
<span className='cf-is-pct'>{pct(a.percent)}</span>
{a.detail ? ' · ' + a.detail : ''}
</p>
</li>
))}
</ol>
<div className='cf-is-total'>
<span className='cf-is-total-label'>{copy.totalLabel}</span>
<span key={valid ? cents : 'none'} className='cf-is-total-amt cf-is-tick' aria-live='polite'>
{valid ? money.full(cents) : '—'}
</span>
</div>
<div className='cf-is-split'>
<p className='cf-is-readout' aria-hidden='true'>{withBold(readoutText, '{percent}', pct(items[shown].percent))}</p>
<div className='cf-is-bar' role='group' aria-label={copy.barLabel} data-lit={lit !== null ? 'true' : undefined}>
{items.map((a, i) => (
<span
key={a.label + i}
className='cf-is-seg'
role='img'
tabIndex={disabled ? -1 : 0}
aria-label={
valid
? fill(copy.segmentLabel, { label: a.label, percent: pct(a.percent), amount: money.full(shares[i]) })
: fill(copy.segmentLabelEmpty, { label: a.label, percent: pct(a.percent) })
}
data-active={lit === i ? 'true' : undefined}
style={{ ['--is-tone' as string]: a.tone || TONES[i % TONES.length], ['--is-grow' as string]: a.percent } as React.CSSProperties}
onFocus={() => setActive(i)}
onBlur={() => setActive(null)}
onMouseEnter={() => setActive(i)}
onMouseLeave={() => setActive(null)}
/>
))}
</div>
<ul className='cf-is-legend' aria-hidden='true'>
{items.map((a, i) => (
<li
key={a.label + i}
data-active={lit === i ? 'true' : undefined}
onMouseEnter={() => setActive(i)}
onMouseLeave={() => setActive(null)}
>
<span className='cf-is-sw' style={{ ['--is-tone' as string]: a.tone || TONES[i % TONES.length] } as React.CSSProperties} />
<span className='cf-is-legend-name'>{a.short || a.label}</span>
<b>{pct(a.percent)}</b>
</li>
))}
</ul>
{source && source.label ? (
<p className='cf-is-source'>
<FileText aria-hidden='true' size={16} strokeWidth={2.5} />
{source.prefix ? source.prefix + ' ' : ''}
{source.href ? <a href={source.href}>{source.label}</a> : source.label}
</p>
) : null}
</div>
<div className='cf-is-act'>
{assurance ? (
<p className='cf-is-assure'>
<ShieldCheck aria-hidden='true' size={18} strokeWidth={2.5} />
{assurance}
</p>
) : null}
{href ? (
<a className='cf-is-btn' href={href} onClick={linkClick} aria-disabled={canGive ? undefined : true} data-force={force}>
{actionText}
</a>
) : (
<button type='submit' className='cf-is-btn' disabled={!canGive} data-force={force}>
{actionText}
</button>
)}
{note ? <p className='cf-is-note'>{note}</p> : null}
</div>
</form>
{photoCaption || reason ? (
<div className='cf-is-aside'>
{photoCaption ? <p className='cf-is-caption'>{photoCaption}</p> : null}
{reason ? <p className='cf-is-reason'>{reason}</p> : null}
</div>
) : null}
</div>
</div>
</section>
);
}
export default ImpactStats;
function renderHeadline(text: string, phrase?: string): React.ReactNode {
if (!phrase) return text;
const at = text.indexOf(phrase);
if (at < 0) return text;
return (
<>
{text.slice(0, at)}
<span className='cf-is-mark'>{phrase}</span>
{text.slice(at + phrase.length)}
</>
);
}
function fill(template: string, vars: Record<string, string>): string {
return template.replace(/[{]([a-zA-Z]+)[}]/g, (whole, key: string) => (key in vars ? vars[key] : whole));
}
function withBold(text: string, token: string, bold: string): React.ReactNode[] {
const parts = text.split(token);
const out: React.ReactNode[] = [];
parts.forEach((part, i) => {
if (i > 0) out.push(<b key={'b' + i}>{bold}</b>);
if (part) out.push(<React.Fragment key={'t' + i}>{part}</React.Fragment>);
});
return out;
}
function pct(n: number): string {
return String(Math.round(n * 10) / 10) + '%';
}
function parseCents(raw: string): number | null {
const cleaned = raw.replace(/[^0-9.]/g, '');
if (!cleaned || cleaned === '.') return null;
const n = Number(cleaned);
if (!Number.isFinite(n)) return null;
return Math.round(n * 100);
}
// Largest-remainder split so the lines always add up to the typed total.
function splitCents(cents: number, percents: number[]): number[] {
const sum = percents.reduce((s, p) => s + p, 0) || 1;
const exact = percents.map((p) => (cents * p) / sum);
const base = exact.map((v) => Math.floor(v));
let left = cents - base.reduce((s, v) => s + v, 0);
const order = exact.map((v, i) => [v - base[i], i]).sort((a, b) => b[0] - a[0]);
let k = 0;
while (left > 0 && order.length) {
base[order[k % order.length][1]] += 1;
left -= 1;
k += 1;
}
return base;
}
function makeMoney(locale: string, currency: string) {
let full: Intl.NumberFormat;
let whole: Intl.NumberFormat;
try {
full = new Intl.NumberFormat(locale, { style: 'currency', currency, minimumFractionDigits: 2, maximumFractionDigits: 2 });
whole = new Intl.NumberFormat(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 });
} catch {
full = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', minimumFractionDigits: 2, maximumFractionDigits: 2 });
whole = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', minimumFractionDigits: 0, maximumFractionDigits: 0 });
}
const symbol = full.formatToParts(0).find((p) => p.type === 'currency')?.value || '$';
return {
symbol,
full: (c: number) => full.format(c / 100),
short: (c: number) => (c % 100 === 0 ? whole : full).format(c / 100),
};
}
const CSS = `
.cf-impact-stats {
--is-gutter: clamp(16px, 5vw, 48px);
--is-photo-h: clamp(360px, 38vw, 520px);
--is-overlap: 56px;
--is-sh: var(--shadow, oklch(0.22 0.03 260));
--is-focus: var(--field-focus, var(--accent));
--is-marker: var(--marker, #fae37c);
position: relative;
overflow-x: clip;
background: var(--surface);
color: var(--ink);
font-family: var(--font-body);
padding: clamp(56px, 8vw, 112px) 0 clamp(64px, 8.5vw, 120px);
}
.cf-impact-stats *, .cf-impact-stats *::before, .cf-impact-stats *::after { box-sizing: border-box; }
.cf-impact-stats .cf-is-wrap { width: 100%; max-width: calc(1120px + 2 * var(--is-gutter)); margin: 0 auto; padding: 0 var(--is-gutter); }
.cf-impact-stats .cf-is-head { max-width: 46rem; margin-bottom: clamp(32px, 4vw, 48px); animation: cf-is-rise .45s cubic-bezier(.2,.7,.2,1) both; }
.cf-impact-stats .cf-is-h2 {
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(2rem, 3.6vw, 3.25rem);
line-height: 1.06;
color: var(--ink);
text-wrap: balance;
}
.cf-impact-stats .cf-is-mark {
color: var(--marker-ink, var(--ink));
background-image: linear-gradient(transparent 42%, oklch(from var(--is-marker) l c h / 0.85) 42%, oklch(from var(--is-marker) l c h / 0.85) 94%, transparent 94%);
padding: 0 0.08em;
margin: 0 -0.04em;
-webkit-box-decoration-break: clone;
box-decoration-break: clone;
}
.cf-impact-stats .cf-is-lead { margin: 16px 0 0; max-width: 60ch; font-size: clamp(1.125rem, 1.5vw, 1.375rem); line-height: 1.4; font-weight: 500; color: var(--muted); text-wrap: pretty; }
.cf-impact-stats .cf-is-stage { position: relative; }
.cf-impact-stats .cf-is-photo { position: absolute; top: 0; left: 0; right: 0; height: var(--is-photo-h); margin: 0; background: color-mix(in oklch, var(--ink) 8%, var(--surface)); }
.cf-impact-stats .cf-is-photo img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 55%; }
.cf-impact-stats .cf-is-grid { position: relative; display: grid; grid-template-columns: minmax(0, 36rem) minmax(0, 1fr); column-gap: clamp(32px, 5vw, 72px); align-items: start; }
.cf-impact-stats .cf-is-stage[data-photo='true'] .cf-is-card { margin-top: var(--is-overlap); }
.cf-impact-stats .cf-is-stage[data-photo='true'] .cf-is-aside { padding-top: calc(var(--is-photo-h) + 24px); }
.cf-impact-stats .cf-is-card {
position: relative;
z-index: 1;
margin: 0;
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(from var(--is-sh) l c h / 0.22), 0 12px 24px -8px oklch(from var(--is-sh) l c h / 0.32)));
padding: clamp(20px, 3vw, 32px);
animation: cf-is-rise .45s cubic-bezier(.2,.7,.2,1) .07s both;
}
.cf-impact-stats .cf-is-title {
margin: 0 0 20px;
font-family: var(--font-display);
font-weight: var(--display-weight, 800);
text-transform: var(--display-case, none);
font-size: clamp(1.3125rem, 1.8vw, 1.625rem);
line-height: 1.15;
letter-spacing: -0.01em;
font-variant-numeric: tabular-nums;
text-wrap: balance;
}
.cf-impact-stats .cf-is-label { display: block; margin: 0 0 8px; font-size: clamp(1.0625rem, 1.25vw, 1.125rem); line-height: 1.3; font-weight: 700; color: var(--label-ink, var(--ink)); }
.cf-impact-stats .cf-is-fieldrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.cf-impact-stats .cf-is-inputwrap { position: relative; flex: 1 1 170px; max-width: 220px; font-size: clamp(1.3125rem, 1.8vw, 1.625rem); }
.cf-impact-stats .cf-is-cur {
position: absolute;
left: 16px;
top: 50%;
transform: translateY(-50%);
font-family: var(--font-display);
font-weight: var(--display-weight, 800);
font-size: 1em;
line-height: 1;
color: var(--field-ink);
pointer-events: none;
}
.cf-impact-stats .cf-is-input {
display: block;
width: 100%;
height: 64px;
margin: 0;
padding: 0 16px 0 calc(16px + var(--is-sym, 1) * 0.62em + 4px);
background: var(--field);
color: var(--field-ink);
border: 1px solid var(--field-border, color-mix(in oklch, var(--ink) 22%, transparent));
border-radius: var(--field-radius, var(--radius, 12px));
font-family: var(--font-display);
font-weight: var(--display-weight, 800);
font-size: 1em;
line-height: 1;
letter-spacing: -0.02em;
font-variant-numeric: tabular-nums;
box-shadow: inset 0 1px 2px oklch(from var(--is-sh) l c h / 0.08);
transition: border-color .16s ease, box-shadow .16s ease;
}
.cf-impact-stats .cf-is-input::placeholder { color: color-mix(in oklch, var(--field-ink) 65%, var(--field)); opacity: 1; }
.cf-impact-stats .cf-is-input:hover:not(:disabled) { border-color: color-mix(in oklch, var(--ink) 40%, transparent); }
.cf-impact-stats .cf-is-input:focus-visible { outline: none; border-color: var(--is-focus); box-shadow: 0 0 0 3px oklch(from var(--is-focus) l c h / 0.35); }
.cf-impact-stats .cf-is-input[aria-invalid='true'] { border-color: var(--danger); }
.cf-impact-stats .cf-is-input[aria-invalid='true']:focus-visible { border-color: var(--danger); box-shadow: 0 0 0 3px oklch(from var(--danger) l c h / 0.3); }
.cf-impact-stats .cf-is-input:disabled { cursor: not-allowed; background: color-mix(in oklch, var(--ink) 5%, var(--field)); }
.cf-impact-stats .cf-is-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.cf-impact-stats .cf-is-chip {
min-height: 44px;
padding: 0 16px;
border-radius: 999px;
border: 1px solid oklch(from var(--ink) l c h / 0.12);
background: color-mix(in oklch, var(--ink) 6%, var(--card));
color: var(--ink);
font-family: var(--font-body);
font-size: 0.9375rem;
font-weight: 800;
line-height: 1;
font-variant-numeric: tabular-nums;
cursor: pointer;
transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.cf-impact-stats .cf-is-chip:hover:not(:disabled) { background: color-mix(in oklch, var(--ink) 11%, var(--card)); }
.cf-impact-stats .cf-is-chip:active:not(:disabled) { transform: translateY(1px); }
.cf-impact-stats .cf-is-chip[aria-pressed='true'] { background: color-mix(in oklch, var(--accent) 12%, var(--card)); border-color: var(--accent); }
.cf-impact-stats .cf-is-chip:focus-visible { outline: 3px solid oklch(from var(--is-focus) l c h / 0.6); outline-offset: 2px; }
.cf-impact-stats .cf-is-chip:disabled { cursor: not-allowed; color: var(--muted); }
.cf-impact-stats .cf-is-error { margin: 10px 0 0; font-size: 0.9375rem; line-height: 1.4; font-weight: 600; color: var(--danger); text-wrap: pretty; }
.cf-impact-stats .cf-is-error svg { display: inline-block; vertical-align: -0.15em; margin-inline-end: 0.4em; }
.cf-impact-stats .cf-is-lines { list-style: none; margin: 20px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.cf-impact-stats .cf-is-lines li { min-width: 0; margin: 0 -12px; padding: 10px 12px; border-radius: 10px; transition: background .16s ease; }
.cf-impact-stats .cf-is-lines li[data-active='true'] { background: color-mix(in oklch, var(--ink) 5%, var(--card)); }
.cf-impact-stats .cf-is-line { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.cf-impact-stats .cf-is-name { flex: 0 1 auto; min-width: 0; font-size: clamp(1.0625rem, 1.25vw, 1.125rem); line-height: 1.3; font-weight: 700; color: var(--ink); text-wrap: pretty; }
.cf-impact-stats .cf-is-leader { flex: 1 1 24px; min-width: 16px; contain: inline-size; overflow: clip; white-space: nowrap; font-size: clamp(1.0625rem, 1.25vw, 1.125rem); line-height: 1.3; font-weight: 700; letter-spacing: 0.28em; color: var(--muted); }
.cf-impact-stats .cf-is-amt { flex: none; font-family: var(--font-display); font-weight: var(--display-weight, 800); font-size: clamp(1.125rem, 1.5vw, 1.375rem); line-height: 1.15; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--ink); }
.cf-impact-stats .cf-is-detail { margin: 4px 0 0; font-size: 0.9375rem; line-height: 1.4; font-weight: 500; color: var(--muted); text-wrap: pretty; }
.cf-impact-stats .cf-is-pct { font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.cf-impact-stats .cf-is-total {
margin-top: 12px;
display: flex;
flex-wrap: wrap;
align-items: baseline;
justify-content: space-between;
gap: 6px 16px;
padding: 16px 20px;
border-radius: 10px;
background: color-mix(in oklch, var(--ink) 4%, var(--card));
}
.cf-impact-stats .cf-is-total-label { font-size: clamp(1.0625rem, 1.25vw, 1.125rem); line-height: 1.2; font-weight: 800; color: var(--ink); }
.cf-impact-stats .cf-is-total-amt {
font-family: var(--font-display);
font-weight: var(--display-weight, 800);
font-size: clamp(2.5rem, 4.2vw, 3.75rem);
line-height: 1;
letter-spacing: -0.03em;
font-variant-numeric: tabular-nums;
color: var(--ink);
padding-bottom: 6px;
border-bottom: 4px double var(--ink);
}
.cf-impact-stats .cf-is-split { margin-top: 24px; }
.cf-impact-stats .cf-is-readout { margin: 0 0 10px; min-height: 1.4em; font-size: 0.9375rem; line-height: 1.4; font-weight: 600; color: var(--ink); text-wrap: pretty; }
.cf-impact-stats .cf-is-readout b { font-weight: 800; font-variant-numeric: tabular-nums; }
.cf-impact-stats .cf-is-bar { display: flex; gap: 3px; height: 20px; }
.cf-impact-stats .cf-is-seg {
flex: var(--is-grow) 1 0;
min-width: 8px;
border-radius: 4px;
background: var(--is-tone);
cursor: default;
transition: opacity .16s ease, transform .16s ease;
}
.cf-impact-stats .cf-is-seg:first-child { border-radius: 999px 4px 4px 999px; }
.cf-impact-stats .cf-is-seg:last-child { border-radius: 4px 999px 999px 4px; }
.cf-impact-stats .cf-is-seg:only-child { border-radius: 999px; }
.cf-impact-stats .cf-is-bar[data-lit='true'] .cf-is-seg:not([data-active='true']) { opacity: 0.42; }
.cf-impact-stats .cf-is-seg[data-active='true'] { transform: scaleY(1.2); }
.cf-impact-stats .cf-is-seg:focus-visible { outline: 3px solid var(--is-focus); outline-offset: 3px; }
.cf-impact-stats .cf-is-legend { list-style: none; margin: 12px 0 0 -10px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.cf-impact-stats .cf-is-legend li { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 999px; font-size: 0.9375rem; line-height: 1.3; font-weight: 600; color: var(--ink); transition: background .16s ease; }
.cf-impact-stats .cf-is-legend li[data-active='true'] { background: color-mix(in oklch, var(--ink) 6%, var(--card)); }
.cf-impact-stats .cf-is-legend b { font-weight: 800; font-variant-numeric: tabular-nums; }
.cf-impact-stats .cf-is-sw { flex: none; width: 12px; height: 12px; border-radius: 3px; background: var(--is-tone); }
.cf-impact-stats .cf-is-source { margin: 14px 0 0; font-size: 0.9375rem; line-height: 1.4; font-weight: 500; color: var(--muted); text-wrap: pretty; }
.cf-impact-stats .cf-is-source svg { display: inline-block; vertical-align: -0.15em; margin-inline-end: 0.4em; color: var(--muted); }
.cf-impact-stats .cf-is-source a { color: var(--link, var(--accent)); font-weight: 600; text-decoration: underline; text-decoration-color: oklch(from var(--link, var(--accent)) l c h / 0.45); text-underline-offset: 0.18em; }
.cf-impact-stats .cf-is-source a:hover { color: oklch(from var(--link, var(--accent)) calc(l - 0.08) c h); text-decoration-color: currentColor; }
.cf-impact-stats .cf-is-source a:focus-visible { outline: 3px solid oklch(from var(--is-focus) l c h / 0.6); outline-offset: 2px; border-radius: 4px; }
.cf-impact-stats .cf-is-act { margin-top: 28px; }
.cf-impact-stats .cf-is-assure { margin: 0 0 12px; text-align: center; font-size: clamp(1.0625rem, 1.25vw, 1.125rem); line-height: 1.4; font-weight: 700; color: var(--ink); text-wrap: pretty; }
.cf-impact-stats .cf-is-assure svg { display: inline-block; vertical-align: -0.18em; margin-inline-end: 0.4em; color: var(--success); }
.cf-impact-stats .cf-is-btn {
--is-b: var(--button-bg, var(--cta));
--is-b2: var(--button-bg-2, var(--cta-2));
display: flex;
width: 100%;
min-height: 64px;
margin: 0;
padding: 12px 28px;
align-items: center;
justify-content: center;
text-align: center;
border: 0;
border-radius: var(--button-radius, var(--radius, 12px));
background: linear-gradient(oklch(from var(--is-b) calc(l + 0.04) c h), oklch(from var(--is-b2) calc(l - 0.02) c h));
color: var(--button-ink, var(--cta-ink));
font-family: var(--button-font, var(--font-display));
font-weight: var(--button-weight, 800);
font-size: clamp(1.125rem, 1.55vw, 1.375rem);
line-height: 1.15;
text-transform: var(--button-case, none);
text-decoration: none;
text-shadow: var(--button-text-shadow, none);
font-variant-numeric: tabular-nums;
text-wrap: balance;
cursor: pointer;
box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--is-b) calc(l + 0.14) c h / 0.7), inset 0 -3px 0 oklch(from var(--is-b) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--is-sh) l c h / 0.3), 0 8px 16px -6px oklch(from var(--is-sh) l c h / 0.45));
transition: background .16s ease, box-shadow .16s ease, transform .16s ease;
}
.cf-impact-stats .cf-is-btn:hover:not(:disabled):not([aria-disabled='true']), .cf-impact-stats .cf-is-btn[data-force='hover'] {
background: linear-gradient(oklch(from var(--is-b) calc(l - 0.01) c h), oklch(from var(--is-b2) calc(l - 0.07) c h));
box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--is-b) calc(l + 0.1) c h / 0.7), inset 0 -3px 0 oklch(from var(--is-b) calc(l - 0.2) c h), 0 1px 2px oklch(from var(--is-sh) l c h / 0.32), 0 10px 18px -6px oklch(from var(--is-sh) l c h / 0.55));
}
.cf-impact-stats .cf-is-btn:active:not(:disabled):not([aria-disabled='true']), .cf-impact-stats .cf-is-btn[data-force='active'] {
transform: translateY(1px);
background: linear-gradient(oklch(from var(--is-b) calc(l - 0.04) c h), oklch(from var(--is-b2) calc(l - 0.1) c h));
box-shadow: var(--button-shadow, inset 0 2px 4px oklch(from var(--is-b) calc(l - 0.22) c h / 0.45), inset 0 -2px 0 oklch(from var(--is-b) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--is-sh) l c h / 0.3));
}
.cf-impact-stats .cf-is-btn:focus-visible { outline: 3px solid var(--is-focus); outline-offset: 3px; }
.cf-impact-stats .cf-is-btn:disabled, .cf-impact-stats .cf-is-btn[aria-disabled='true'] {
cursor: not-allowed;
transform: none;
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-impact-stats .cf-is-note { margin: 10px 0 0; text-align: center; font-size: 0.9375rem; line-height: 1.4; font-weight: 500; color: var(--muted); text-wrap: pretty; }
.cf-impact-stats .cf-is-aside { animation: cf-is-rise .45s cubic-bezier(.2,.7,.2,1) .14s both; }
.cf-impact-stats .cf-is-caption { margin: 0; font-size: 0.9375rem; line-height: 1.45; font-weight: 600; color: var(--ink); text-wrap: pretty; }
.cf-impact-stats .cf-is-reason { margin: 12px 0 0; max-width: 52ch; font-size: clamp(1.0625rem, 1.25vw, 1.125rem); line-height: 1.5; font-weight: 400; color: var(--muted); text-wrap: pretty; }
.cf-impact-stats .cf-is-tick { display: inline-block; animation: cf-is-tick .3s cubic-bezier(.2,.7,.2,1) both; }
@keyframes cf-is-rise { from { opacity: .82; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes cf-is-tick { from { opacity: .55; transform: translateY(2px); } to { opacity: 1; transform: none; } }
@media (max-width: 959px) {
.cf-impact-stats .cf-is-photo { position: relative; height: clamp(220px, 56vw, 400px); }
.cf-impact-stats .cf-is-grid { grid-template-columns: minmax(0, 1fr); row-gap: 28px; }
.cf-impact-stats .cf-is-card, .cf-impact-stats .cf-is-aside { width: 100%; max-width: 40rem; }
.cf-impact-stats .cf-is-stage[data-photo='true'] .cf-is-card { margin-top: -48px; }
.cf-impact-stats .cf-is-stage[data-photo='true'] .cf-is-aside { padding-top: 0; }
}
@media (max-width: 560px) {
.cf-impact-stats .cf-is-inputwrap { flex: 1 1 100%; max-width: none; }
.cf-impact-stats .cf-is-presets { flex: 1 1 100%; flex-wrap: nowrap; }
.cf-impact-stats .cf-is-chip { flex: 1 1 0; min-width: 0; padding: 0 8px; }
.cf-impact-stats .cf-is-readout { min-height: 2.8em; }
.cf-impact-stats .cf-is-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 6px; margin-left: -10px; margin-right: -10px; }
.cf-impact-stats .cf-is-legend li { display: flex; width: 100%; }
.cf-impact-stats .cf-is-legend b { margin-left: auto; }
.cf-impact-stats .cf-is-total { padding: 14px 16px; }
}
@media (prefers-reduced-motion: reduce) {
.cf-impact-stats *, .cf-impact-stats *::before, .cf-impact-stats *::after { animation: none !important; transition: none !important; }
}
`;
pieces/proof/impact-stats/specimen.tsx 31 lines
import __studioImage78878868 from "../assets/0ff5235ceb7a3690.webp";
import { ImpactStats, type ImpactStatsProps } from '../impact-stats';
import { slot } from '../../slots';
export const states = ['default', 'hover', 'active', 'disabled', 'error'];
export default function ImpactStatsSpecimen({ state = 'default' }: { state?: ImpactStatsProps['state'] }) {
return (
<ImpactStats
state={state}
headline='See where every dollar of your gift goes'
highlight='every dollar'
lead='Type any amount. Northfield Food Bank splits it line by line, the same way every gift is spent.'
photoImage={slot('scene', __studioImage78878868)}
photoAlt='Warehouse shelves at Northfield Food Bank stocked with canned goods, pasta, rice and fresh produce'
photoCaption='Your gift restocks shelves like these at the Northfield warehouse.'
reason='Nobody should have to guess what happens after they give. These are the same percentages in our annual report, applied to your gift before you give it.'
allocations={[
{ label: 'Meals for local families', short: 'Meals', percent: 84, detail: 'Groceries, fresh produce and hot meals' },
{ label: 'Delivery to partner pantries', short: 'Delivery', percent: 7, detail: 'Trucks and fuel to 40 neighbourhood pantries' },
{ label: 'Cold storage and warehouse', short: 'Storage', percent: 5, detail: 'Keeping food fresh until it ships' },
{ label: 'Admin and fundraising', short: 'Admin', percent: 4, detail: 'Audits, payroll and the systems behind your receipt' },
]}
source={{ prefix: 'Percentages from the', label: 'Northfield 2025 Annual Report', href: '#annual-report' }}
defaultAmount={50}
presets={[25, 50, 100, 250]}
assurance='Every gift is tax-deductible. Your receipt arrives by email.'
note='Secure donation · Takes about a minute'
/>
);
}
| Name | Type | Details |
|---|---|---|
allocations OptionalImpactStats |
ImpactAllocation[] |
Default []
|
headline OptionalImpactStats |
string |
Default 'See where every dollar of your gift goes'
|
highlight OptionalImpactStats |
string |
Default 'every dollar'
|
lead OptionalImpactStats |
string |
Default 'Type any amount and watch it split, line by line, the same way every gift is spent.'
|
photoImage OptionalImpactStats |
string |
|
photoAlt OptionalImpactStats |
string |
Default ''
|
photoCaption OptionalImpactStats |
string |
|
reason OptionalImpactStats |
string |
|
source OptionalImpactStats |
{ prefix?: string; label: string; href?: string } |
|
defaultAmount OptionalImpactStats |
number |
Default 50
|
presets OptionalImpactStats |
number[] |
Default [25, 50, 100, 250]
|
min OptionalImpactStats |
number |
Default 1
|
max OptionalImpactStats |
number |
Default 100000
|
currency OptionalImpactStats |
string |
Default 'USD'
|
locale OptionalImpactStats |
string |
Default 'en-US'
|
copy OptionalImpactStats |
Partial<ImpactStatsCopy> |
|
assurance OptionalImpactStats |
string |
|
note OptionalImpactStats |
string |
|
href OptionalImpactStats |
string |
|
onAction OptionalImpactStats |
(gift: ImpactGift) => void |
|
state OptionalImpactStats |
'default' | 'hover' | 'active' | 'disabled' | 'error' |
Default 'default'
|
className OptionalImpactStats |
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.
--marker- The highlighter colour behind key phrases.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
scene- A wide atmosphere photo behind or beside the copy.
-
0ff5235ceb7a3690.webp
image/webp · 148 KB