Funding Progress 1
Funding progress: a stretch-goal route that turns a campaign's real pledges into momentum and makes the next unlock the reason to back now.
Use it in a prompt
Use urgency/funding-progress 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/urgency/funding-progress.tsx. - Import it and pass your copy and images (Props tab):
import { FundingProgress } from "@/components/funneldna/urgency/funding-progress"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/urgency/funding-progress/component.tsx 610 lines
// layout: route-map
// Funding progress: a stretch-goal route that turns a campaign's real pledges into momentum and makes the next unlock the reason to back now.
import * as React from 'react';
import { Check, Flag, Lock } from 'lucide-react';
import { Spot } from '../fx/fx';
import star from '../fx/spots/star';
export type FundingStretchGoal = {
/** Pledge total that unlocks this goal, in whole currency units. */
amount: number;
name: string;
/** What every backer gets when it unlocks. */
detail?: React.ReactNode;
/** Unlock panel thumbnail (item-n slot); a Spot illustration shows when absent. */
image?: string;
imageAlt?: string;
};
export type FundingProgressCopy = {
raised: string;
/** Placeholders: {percent}, {goal} */
raisedOfGoal: string;
backer: string;
backers: string;
day: string;
days: string;
goalName: string;
unlocked: string;
/** Placeholder: {amount} */
toGo: string;
/** Placeholder: {amount} */
unlocksAt: string;
/** Placeholder: {amount} */
unlockedAt: string;
/** Placeholders: {amount}, {name} */
nextLine: string;
/** Placeholder: {amount} */
goalLine: string;
allLine: string;
fundedLine: string;
barLabel: string;
/** Placeholders: {raised}, {goal} */
barText: string;
/** Placeholder: {raised} */
barTextNoGoal: string;
stopsLabel: string;
};
export type FundingProgressProps = {
headline?: React.ReactNode;
lead?: React.ReactNode;
/** Amount pledged so far; numeral and fill are hidden when not supplied. */
raised?: number;
/** Funding goal, marked on the route. */
goal?: number;
/** Backer count; hidden when not supplied. */
backers?: number;
/** Days left in the campaign; hidden when not supplied. Never invent one. */
daysLeft?: number;
/** ISO currency code used to format amounts. */
currency?: string;
locale?: string;
stretchGoals?: FundingStretchGoal[];
label?: string;
/** Button second line: the pledge price sits here. */
sublabel?: string;
href?: string;
onAction?: (event: React.MouseEvent<HTMLElement>) => void;
disabled?: boolean;
state?: 'default' | 'hover' | 'active' | 'disabled';
/** fx spot module shown for goals without an image. */
fallbackSpot?: string;
copy?: Partial<FundingProgressCopy>;
className?: string;
};
const DEFAULT_COPY: FundingProgressCopy = {
raised: 'pledged so far',
raisedOfGoal: '{percent}% of the {goal} goal',
backer: 'backer',
backers: 'backers',
day: 'day to go',
days: 'days to go',
goalName: 'Funding goal',
unlocked: 'Unlocked',
toGo: '{amount} to go',
unlocksAt: 'Unlocks at {amount}',
unlockedAt: 'Unlocked at {amount}',
nextLine: 'Only {amount} more unlocks {name}',
goalLine: 'Only {amount} more to hit the goal',
allLine: 'Every stretch goal is unlocked',
fundedLine: 'Fully funded. You can still back it today',
barLabel: 'Funding progress',
barText: '{raised} raised toward a {goal} goal',
barTextNoGoal: '{raised} raised',
stopsLabel: 'Stretch goals',
};
const LABEL_W = 156;
const LABEL_GAP = 12;
// Labels hang from their stem: the stem sits this far in from the label's text edge.
const STEM_IN = 13;
const DOT_GAP = 34;
const FIT_MIN = 440;
const useIsoLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
export function FundingProgress(props: FundingProgressProps) {
const {
headline = 'Every pledge pushes the next unlock closer',
lead = 'Tap a stop on the road to see what it adds for every backer.',
raised,
goal,
backers,
daysLeft,
currency = 'USD',
locale = 'en-US',
stretchGoals = [],
label = 'Send me my copy',
sublabel = '',
href,
onAction,
disabled = false,
state = 'default',
fallbackSpot = star,
copy,
className,
} = props;
const c: FundingProgressCopy = { ...DEFAULT_COPY, ...copy };
const uid = React.useId();
const titleId = uid + '-title';
const panelId = uid + '-panel';
const money = React.useMemo(() => {
try {
return new Intl.NumberFormat(locale, { style: 'currency', currency, maximumFractionDigits: 0 });
} catch {
return new Intl.NumberFormat(locale, { maximumFractionDigits: 0 });
}
}, [locale, currency]);
const counts = React.useMemo(() => new Intl.NumberFormat(locale), [locale]);
const fmt = (n: number) => money.format(n);
const raisedN = isNum(raised) ? raised : null;
const goalN = isNum(goal) && goal > 0 ? goal : null;
const goals = stretchGoals.filter((g) => isNum(g.amount)).slice().sort((a, b) => a.amount - b.amount);
const scaleMax = Math.max(goalN ?? 0, raisedN ?? 0, ...goals.map((g) => g.amount)) || 1;
const frac = (n: number) => Math.min(1, Math.max(0, n / scaleMax));
const isOn = (amount: number) => raisedN !== null && raisedN >= amount;
const nextIdx = goals.findIndex((g) => !isOn(g.amount));
const [selected, setSelected] = React.useState(() => (nextIdx >= 0 ? nextIdx : goals.length - 1));
const [hover, setHover] = React.useState<number | null>(null);
const sel = Math.min(selected, goals.length - 1);
const hoverIdx = hover ?? (state === 'hover' ? sel : null);
const stopRefs = React.useRef<(HTMLButtonElement | null)[]>([]);
// The progress fill grows once, when the route scrolls into view.
const rootRef = React.useRef<HTMLElement>(null);
const [inView, setInView] = React.useState(false);
React.useEffect(() => {
const el = rootRef.current;
if (!el) return;
if (typeof IntersectionObserver === 'undefined') {
setInView(true);
return;
}
const io = new IntersectionObserver(
(entries) => {
if (entries.some((e) => e.isIntersecting)) {
setInView(true);
io.disconnect();
}
},
{ threshold: 0.15 },
);
io.observe(el);
return () => io.disconnect();
}, []);
const markers: Marker[] = [
...(goalN !== null ? [{ kind: 'goal' as const, amount: goalN, index: -1 }] : []),
...goals.map((g, index) => ({ kind: 'stop' as const, amount: g.amount, index })),
].sort((a, b) => a.amount - b.amount || (a.kind === 'goal' ? 0 : 1) - (b.kind === 'goal' ? 0 : 1));
const showRoute = markers.length > 0;
const routeRef = React.useRef<HTMLDivElement>(null);
const [width, setWidth] = React.useState(0);
useIsoLayoutEffect(() => {
const el = routeRef.current;
if (!el) return;
const read = () => {
const cs = window.getComputedStyle(el);
const w = el.clientWidth - parseFloat(cs.paddingLeft) - parseFloat(cs.paddingRight);
setWidth(Math.max(0, Math.round(w)));
};
read();
if (typeof ResizeObserver === 'undefined') {
window.addEventListener('resize', read);
return () => window.removeEventListener('resize', read);
}
const ro = new ResizeObserver(read);
ro.observe(el);
return () => ro.disconnect();
}, [showRoute]);
const plan = planLabels(width, markers.map((m) => frac(m.amount)));
const choose = (i: number) => setSelected(i);
const onStopKey = (e: React.KeyboardEvent, i: number) => {
let n = -1;
if (e.key === 'ArrowRight' || e.key === 'ArrowDown') n = Math.min(goals.length - 1, i + 1);
else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') n = Math.max(0, i - 1);
else if (e.key === 'Home') n = 0;
else if (e.key === 'End') n = goals.length - 1;
if (n < 0) return;
e.preventDefault();
setSelected(n);
stopRefs.current[n]?.focus();
};
let push: string | null = null;
if (raisedN !== null) {
if (goalN !== null && raisedN < goalN) push = fill(c.goalLine, { amount: fmt(goalN - raisedN) });
else if (nextIdx >= 0) push = fill(c.nextLine, { amount: fmt(goals[nextIdx].amount - raisedN), name: goals[nextIdx].name });
else if (goals.length > 0) push = c.allLine;
else if (goalN !== null) push = c.fundedLine;
}
const valueText = raisedN === null ? undefined : fill(goalN !== null ? c.barText : c.barTextNoGoal, { raised: fmt(raisedN), goal: goalN !== null ? fmt(goalN) : '' });
const stats: React.ReactNode[] = [];
if (raisedN !== null) {
const pct = goalN !== null ? Math.floor((raisedN / goalN) * 100) : 0;
stats.push(
<div key='raised' className='cf-fp-stat is-raised' style={{ '--d': '0s' } as React.CSSProperties}>
<span className='cf-fp-num'>{fmt(raisedN)}</span>
<span className='cf-fp-cap'>
{goalN !== null && pct >= 100 ? <Check className='cf-fp-inline' size={16} strokeWidth={2.5} aria-hidden='true' /> : null}
{goalN !== null ? fill(c.raisedOfGoal, { percent: counts.format(pct), goal: fmt(goalN) }) : c.raised}
</span>
</div>,
);
}
if (isNum(backers)) {
stats.push(
<div key='backers' className='cf-fp-stat' style={{ '--d': stats.length * 0.07 + 's' } as React.CSSProperties}>
<span className='cf-fp-num'>{counts.format(backers)}</span>
<span className='cf-fp-cap'>{backers === 1 ? c.backer : c.backers}</span>
</div>,
);
}
if (isNum(daysLeft)) {
stats.push(
<div key='days' className='cf-fp-stat' style={{ '--d': stats.length * 0.07 + 's' } as React.CSSProperties}>
<span className='cf-fp-num'>{counts.format(daysLeft)}</span>
<span className='cf-fp-cap'>{daysLeft === 1 ? c.day : c.days}</span>
</div>,
);
}
const chip = (amount: number) =>
raisedN === null ? null : isOn(amount) ? (
<span className='cf-fp-chip is-on'>
<Check size={16} strokeWidth={2.5} aria-hidden='true' />
{c.unlocked}
</span>
) : (
<span className='cf-fp-chip'>
<Lock size={16} strokeWidth={2.5} aria-hidden='true' />
{fill(c.toGo, { amount: fmt(amount - raisedN) })}
</span>
);
const srStatus = (amount: number) =>
raisedN === null ? '' : isOn(amount) ? ', ' + c.unlocked : ', ' + fill(c.toGo, { amount: fmt(amount - raisedN) });
const g = sel >= 0 ? goals[sel] : undefined;
const panel = (list: boolean) =>
g ? (
<div key={sel} className={'cf-fp-panel' + (list ? ' is-list' : '')}>
<div className={'cf-fp-thumb' + (g.image ? '' : ' is-spot')}>
{g.image ? <img src={g.image} alt={g.imageAlt ?? ''} loading='lazy' decoding='async' /> : <Spot src={fallbackSpot} size={96} />}
</div>
<div className='cf-fp-panel-body'>
{chip(g.amount)}
<h3 className='cf-fp-red'>{g.name}</h3>
{g.detail ? <p className='cf-fp-detail'>{g.detail}</p> : null}
<p className='cf-fp-meta'>{fill(isOn(g.amount) ? c.unlockedAt : c.unlocksAt, { amount: fmt(g.amount) })}</p>
</div>
</div>
) : null;
const dot = (m: Marker, inList: boolean) => {
const on = isOn(m.amount);
const isStop = m.kind === 'stop';
const cls = [
'cf-fp-dot',
on && 'is-on',
!isStop && 'is-goal',
isStop && m.index === nextIdx && 'is-next',
isStop && !inList && m.index === sel && 'is-sel',
isStop && m.index === hoverIdx && 'is-hover',
inList && 'is-static',
]
.filter(Boolean)
.join(' ');
return (
<span
key={m.kind + m.index}
className={cls}
aria-hidden='true'
style={inList ? undefined : { left: frac(m.amount) * 100 + '%' }}
onClick={isStop ? () => choose(m.index) : undefined}
onPointerEnter={isStop && !inList ? () => setHover(m.index) : undefined}
onPointerLeave={isStop && !inList ? () => setHover(null) : undefined}
>
{!isStop ? <Flag size={16} strokeWidth={2.5} /> : on ? <Check size={16} strokeWidth={3} /> : <Lock size={16} strokeWidth={2.5} />}
</span>
);
};
const routeLabel = (m: Marker, p: Placement) => {
const on = isOn(m.amount);
const style = { gridRow: p.side === 'top' ? 1 : 3, marginInlineStart: p.left + 'px', '--stem': p.x - p.left + 'px' } as React.CSSProperties;
const side = p.side === 'top' ? ' is-top' : ' is-bottom';
if (m.kind === 'goal') {
return (
<div key='goal' className={'cf-fp-stop is-goal' + side + (on ? ' is-on' : '')} data-align={p.align} style={style}>
<span className='cf-fp-stop-amt'>{fmt(m.amount)}</span>
<span className='cf-fp-stop-name'>{c.goalName}</span>
</div>
);
}
const item = goals[m.index];
const isSel = m.index === sel;
const cls = 'cf-fp-stop' + side + (on ? ' is-on' : '') + (isSel ? ' is-sel' : '') + (m.index === hoverIdx ? ' is-hover' : '');
return (
<button
key={'s' + m.index}
ref={(el) => {
stopRefs.current[m.index] = el;
}}
type='button'
className={cls}
data-align={p.align}
style={style}
aria-pressed={isSel}
aria-controls={panelId}
onClick={() => choose(m.index)}
onKeyDown={(e) => onStopKey(e, m.index)}
onPointerEnter={() => setHover(m.index)}
onPointerLeave={() => setHover(null)}
>
<span className='cf-fp-stop-amt'>{fmt(item.amount)}</span>
<span className='cf-fp-stop-name'>{item.name}</span>
<span className='cf-fp-sr'>{srStatus(item.amount)}</span>
</button>
);
};
const isDisabled = disabled || state === 'disabled';
const btnCls = 'cf-fp-btn' + (state === 'hover' ? ' is-hover' : '') + (state === 'active' ? ' is-active' : '');
const btnInner = (
<>
<span className='cf-fp-btn-label'>{label}</span>
{sublabel ? <span className='cf-fp-btn-sub'>{sublabel}</span> : null}
</>
);
const button =
href && !isDisabled ? (
<a className={btnCls} href={href} onClick={onAction}>
{btnInner}
</a>
) : (
<button type='button' className={btnCls} disabled={isDisabled} onClick={onAction}>
{btnInner}
</button>
);
const panelInFoot = !!g && plan !== null;
return (
<section
ref={rootRef}
className={['cf-funding-progress', className].filter(Boolean).join(' ')}
data-state={state}
data-in={inView ? '' : undefined}
aria-labelledby={headline ? titleId : undefined}
>
<style>{CSS}</style>
{headline || lead ? (
<header className='cf-fp-head'>
{headline ? (
<h2 className='cf-fp-title' id={titleId}>
{headline}
</h2>
) : null}
{lead ? <p className='cf-fp-lead'>{lead}</p> : null}
</header>
) : null}
{stats.length ? <div className='cf-fp-stats'>{stats}</div> : null}
{showRoute ? (
<div className={'cf-fp-route' + (plan ? '' : ' is-compact')} ref={routeRef}>
<div
className='cf-fp-track'
role='progressbar'
aria-label={c.barLabel}
aria-valuemin={0}
aria-valuemax={scaleMax}
aria-valuenow={raisedN ?? undefined}
aria-valuetext={valueText}
>
{raisedN !== null && raisedN > 0 ? <span className='cf-fp-fill' style={{ width: frac(raisedN) * 100 + '%' }} /> : null}
{markers.map((m) => dot(m, false))}
</div>
{plan ? markers.map((m, i) => routeLabel(m, plan[i])) : null}
</div>
) : null}
{showRoute && !plan ? (
<ol className='cf-fp-list' aria-label={c.stopsLabel}>
{markers.map((m) => {
if (m.kind === 'goal') {
return (
<li key='goal'>
<div className={'cf-fp-row is-goal'}>
{dot(m, true)}
<span className='cf-fp-row-text'>
<span className='cf-fp-row-name'>{c.goalName}</span>
<span className='cf-fp-row-amt'>{fmt(m.amount)}</span>
</span>
{chip(m.amount)}
</div>
</li>
);
}
const item = goals[m.index];
const isSel = m.index === sel;
const rowCls = 'cf-fp-row' + (isSel ? ' is-sel' : '') + (m.index === hoverIdx ? ' is-hover' : '');
return (
<li key={'s' + m.index}>
<button
ref={(el) => {
stopRefs.current[m.index] = el;
}}
type='button'
className={rowCls}
aria-expanded={isSel}
aria-controls={isSel ? panelId : undefined}
onClick={() => choose(m.index)}
onKeyDown={(e) => onStopKey(e, m.index)}
>
{dot(m, true)}
<span className='cf-fp-row-text'>
<span className='cf-fp-row-name'>{item.name}</span>
<span className='cf-fp-row-amt'>{fmt(item.amount)}</span>
</span>
{chip(item.amount)}
</button>
{isSel ? <div id={panelId}>{panel(true)}</div> : null}
</li>
);
})}
</ol>
) : null}
<div className={'cf-fp-foot' + (panelInFoot ? '' : ' is-solo')}>
{panelInFoot ? (
<div id={panelId} className='cf-fp-live' aria-live='polite'>
{panel(false)}
</div>
) : null}
<div className={'cf-fp-cta' + (push ? '' : ' is-bare')}>
{push ? <p className='cf-fp-push'>{push}</p> : null}
{button}
</div>
</div>
</section>
);
}
export default FundingProgress;
type Marker = { kind: 'goal' | 'stop'; amount: number; index: number };
type Placement = { x: number; left: number; side: 'top' | 'bottom'; align: 'start' | 'center' | 'end' };
function isNum(n: unknown): n is number {
return typeof n === 'number' && Number.isFinite(n);
}
function fill(template: string, vars: Record<string, string>) {
return Object.keys(vars).reduce((s, k) => s.split('{' + k + '}').join(vars[k]), template);
}
// Labels alternate below and above the route and hang from a stem at their text edge (start-aligned,
// end-aligned near the finish); if any two would touch, the stops become a list under the bar.
function planLabels(width: number, fracs: number[]): Placement[] | null {
if (width < FIT_MIN || fracs.length === 0) return null;
const out: Placement[] = [];
const lastRight = { top: -Infinity, bottom: -Infinity };
for (let i = 0; i < fracs.length; i++) {
const x = fracs[i] * width;
if (i > 0 && x - out[i - 1].x < DOT_GAP) return null;
const side: Placement['side'] = i % 2 === 0 ? 'bottom' : 'top';
let left = x - STEM_IN;
let align: Placement['align'] = 'start';
if (left + LABEL_W > width + STEM_IN) {
left = x - LABEL_W + STEM_IN;
align = 'end';
}
if (left < lastRight[side] + LABEL_GAP) return null;
lastRight[side] = left + LABEL_W;
out.push({ x, left, side, align });
}
return out;
}
const CSS = `
.cf-funding-progress{--fp-red:color-mix(in oklab, var(--cta) 50%, var(--ink));--fp-line:oklch(from var(--ink) l c h / 0.14);--fp-fill:var(--accent-fill, var(--accent));--fp-shadow:var(--shadow, oklch(0.22 0.03 260));box-sizing:border-box;width:100%;max-width:1120px;margin-inline:auto;padding-inline:clamp(16px,3vw,24px);color:var(--ink);font-family:var(--font-body);}
.cf-funding-progress *,.cf-funding-progress *::before,.cf-funding-progress *::after{box-sizing:border-box;}
.cf-funding-progress .cf-fp-title{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;text-wrap:balance;color:var(--ink);}
.cf-funding-progress .cf-fp-title em{font-style:normal;color:var(--fp-red);}
.cf-funding-progress .cf-fp-lead{margin:16px 0 0;max-width:64ch;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty;}
.cf-funding-progress .cf-fp-stats{margin-top:32px;display:grid;grid-auto-flow:column;justify-content:start;}
.cf-funding-progress .cf-fp-stat{padding-inline-end:clamp(24px,4vw,56px);animation:cf-fp-rise .45s cubic-bezier(.2,.7,.2,1) both;animation-delay:var(--d,0s);}
.cf-funding-progress .cf-fp-stat + .cf-fp-stat{border-inline-start:1px solid var(--fp-line);padding-inline-start:clamp(24px,4vw,56px);}
.cf-funding-progress .cf-fp-num{display:block;font-family:var(--font-display);font-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);white-space:nowrap;}
.cf-funding-progress .cf-fp-cap{display:block;margin-top:20px;font-size:0.9375rem;line-height:1.4;font-weight:600;color:var(--muted);text-wrap:pretty;}
.cf-funding-progress .cf-fp-inline{display:inline-block;vertical-align:-0.15em;margin-inline-end:.4em;color:var(--success);}
.cf-funding-progress .cf-fp-route{margin-top:40px;display:grid;grid-template-columns:minmax(0,1fr);padding-inline:15px;}
.cf-funding-progress .cf-fp-track{grid-row:2;grid-column:1;position:relative;height:16px;margin-block:8px;border-radius:999px;background:repeating-linear-gradient(135deg, oklch(from var(--ink) l c h / 0.06) 0 6px, transparent 6px 12px), color-mix(in oklch, var(--ink) 8%, var(--card));box-shadow:inset 0 1px 2px oklch(from var(--fp-shadow) l c h / 0.28);}
.cf-funding-progress .cf-fp-fill{position:absolute;inset:0 auto 0 0;border-radius:inherit;background:linear-gradient(90deg, oklch(from var(--fp-fill) calc(l - 0.05) c h), oklch(from var(--fp-fill) calc(l + 0.03) c h));box-shadow:inset 0 1px 0 oklch(from var(--fp-fill) calc(l + 0.14) c h / 0.6), inset 0 -2px 0 oklch(from var(--fp-fill) calc(l - 0.12) c h);transform-origin:left center;animation:cf-fp-grow .9s cubic-bezier(.2,.7,.2,1) both;}
.cf-funding-progress .cf-fp-dot{position:absolute;top:50%;z-index:1;width:30px;height:30px;margin:-15px 0 0 -15px;padding:0;display:grid;place-items:center;border-radius:50%;background:var(--card);color:var(--muted);border:3px solid oklch(from var(--ink) l c h / 0.22);box-shadow:var(--shadow-sm, 0 1px 2px oklch(from var(--fp-shadow) l c h / 0.25));cursor:pointer;transition:transform .16s ease;}
.cf-funding-progress .cf-fp-dot.is-goal{color:var(--ink);cursor:default;}
.cf-funding-progress .cf-fp-dot.is-next{border-color:var(--fp-fill);}
.cf-funding-progress .cf-fp-dot.is-on{background:var(--fp-fill);border-color:oklch(from var(--fp-fill) calc(l - 0.1) c h);color:var(--accent-fill-ink, var(--card));}
.cf-funding-progress .cf-fp-dot.is-hover{transform:scale(1.12);}
.cf-funding-progress .cf-fp-dot.is-sel{outline:3px solid var(--accent);outline-offset:3px;}
.cf-funding-progress .cf-fp-dot.is-static{position:relative;top:auto;left:auto;margin:0;z-index:auto;}
.cf-funding-progress .cf-fp-stop{grid-column:1;justify-self:start;position:relative;width:156px;padding:8px 12px;display:flex;flex-direction:column;gap:2px;border:0;border-radius:10px;background:transparent;color:var(--ink);font:inherit;text-align:left;cursor:pointer;transition:background-color .16s ease, transform .16s ease;}
.cf-funding-progress .cf-fp-stop[data-align='end']{text-align:right;}
.cf-funding-progress .cf-fp-stop.is-top{align-self:end;margin-bottom:8px;}
.cf-funding-progress .cf-fp-stop.is-bottom{align-self:start;margin-top:8px;}
.cf-funding-progress .cf-fp-stop::before{content:'';position:absolute;left:var(--stem,50%);width:2px;height:16px;margin-left:-1px;border-radius:2px;background:oklch(from var(--ink) l c h / 0.22);}
.cf-funding-progress .cf-fp-stop.is-top::before{bottom:-16px;}
.cf-funding-progress .cf-fp-stop.is-bottom::before{top:-16px;}
.cf-funding-progress .cf-fp-stop.is-on::before{background:var(--fp-fill);}
.cf-funding-progress .cf-fp-stop.is-goal{cursor:default;}
.cf-funding-progress button.cf-fp-stop:hover,.cf-funding-progress .cf-fp-stop.is-hover{background:color-mix(in oklch, var(--ink) 5%, var(--surface));}
.cf-funding-progress .cf-fp-stop.is-sel{background:color-mix(in oklch, var(--accent) 11%, var(--surface));}
.cf-funding-progress .cf-fp-stop.is-sel:hover,.cf-funding-progress .cf-fp-stop.is-sel.is-hover{background:color-mix(in oklch, var(--accent) 15%, var(--surface));}
.cf-funding-progress button.cf-fp-stop:active{transform:scale(.98);}
.cf-funding-progress .cf-fp-stop:focus-visible{outline:3px solid var(--accent);outline-offset:2px;}
.cf-funding-progress .cf-fp-stop-amt{font-family:var(--font-display);font-weight:800;font-size:1.0625rem;line-height:1.2;font-variant-numeric:tabular-nums;}
.cf-funding-progress .cf-fp-stop-name{font-size:0.9375rem;font-weight:600;line-height:1.3;color:var(--muted);text-wrap:balance;}
.cf-funding-progress .cf-fp-stop.is-sel .cf-fp-stop-name,.cf-funding-progress .cf-fp-stop.is-hover .cf-fp-stop-name,.cf-funding-progress button.cf-fp-stop:hover .cf-fp-stop-name{color:var(--ink);}
.cf-funding-progress .cf-fp-list{list-style:none;margin:24px 0 0;padding:0;display:grid;gap:4px;}
.cf-funding-progress .cf-fp-row{width:100%;display:grid;grid-template-columns:30px minmax(0,1fr) auto;align-items:center;gap:12px;padding:12px;border:0;border-radius:12px;background:transparent;color:var(--ink);font:inherit;text-align:left;cursor:pointer;transition:background-color .16s ease, transform .16s ease;}
.cf-funding-progress .cf-fp-row.is-goal{cursor:default;}
.cf-funding-progress button.cf-fp-row:hover,.cf-funding-progress .cf-fp-row.is-hover{background:color-mix(in oklch, var(--ink) 5%, var(--surface));}
.cf-funding-progress .cf-fp-row.is-sel{background:color-mix(in oklch, var(--accent) 11%, var(--surface));}
.cf-funding-progress button.cf-fp-row:active{transform:scale(.99);}
.cf-funding-progress .cf-fp-row:focus-visible{outline:3px solid var(--accent);outline-offset:2px;}
.cf-funding-progress .cf-fp-row-text{display:grid;gap:2px;min-width:0;}
.cf-funding-progress .cf-fp-row-name{font-weight:700;font-size:1.0625rem;line-height:1.25;text-wrap:pretty;}
.cf-funding-progress .cf-fp-row-amt{font-size:0.9375rem;font-weight:600;line-height:1.3;color:var(--muted);font-variant-numeric:tabular-nums;}
.cf-funding-progress .cf-fp-row.is-sel .cf-fp-row-amt{color:var(--ink);}
.cf-funding-progress .cf-fp-list .cf-fp-panel{margin:8px 0 12px;}
.cf-funding-progress .cf-fp-chip{display:inline-flex;align-items:center;gap:6px;min-height:28px;padding:4px 12px;border-radius:999px;font-size:0.875rem;font-weight:800;line-height:1.2;white-space:nowrap;background:color-mix(in oklch, var(--ink) 6%, var(--card));color:var(--ink);justify-self:start;}
.cf-funding-progress .cf-fp-chip.is-on{background:var(--success-soft);color:var(--success);}
.cf-funding-progress .cf-fp-foot{margin-top:32px;display:grid;grid-template-columns:minmax(0,1fr) minmax(18rem,23rem);gap:clamp(24px,4vw,48px);align-items:start;}
.cf-funding-progress .cf-fp-foot.is-solo{grid-template-columns:minmax(0,1fr);}
.cf-funding-progress .cf-fp-cta{display:grid;gap:16px;align-content:start;}
.cf-funding-progress .cf-fp-foot.is-solo .cf-fp-cta{grid-template-columns:minmax(0,1fr) minmax(18rem,23rem);align-items:center;column-gap:clamp(24px,4vw,48px);}
.cf-funding-progress .cf-fp-foot.is-solo .cf-fp-cta.is-bare{grid-template-columns:minmax(0,23rem);}
.cf-funding-progress .cf-fp-push{margin:0;font-family:var(--font-display);font-weight:800;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-0.01em;color:var(--fp-red);text-wrap:balance;}
.cf-funding-progress .cf-fp-panel{display:grid;grid-template-columns:minmax(0,14rem) minmax(0,1fr);gap:clamp(16px,2.5vw,28px);align-items:start;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(from var(--fp-shadow) l c h / 0.22), 0 12px 24px -8px oklch(from var(--fp-shadow) l c h / 0.32)));animation:cf-fp-rise .45s cubic-bezier(.2,.7,.2,1) both;}
.cf-funding-progress .cf-fp-panel.is-list{grid-template-columns:minmax(0,9rem) minmax(0,1fr);}
.cf-funding-progress .cf-fp-thumb{aspect-ratio:4/3;border-radius:12px;overflow:hidden;background:color-mix(in oklch, var(--ink) 4%, var(--card));}
.cf-funding-progress .cf-fp-thumb img{display:block;width:100%;height:100%;object-fit:cover;object-position:center;}
.cf-funding-progress .cf-fp-thumb.is-spot{display:grid;place-items:center;background:transparent;overflow:visible;}
.cf-funding-progress .cf-fp-panel-body{display:grid;gap:0;min-width:0;}
.cf-funding-progress .cf-fp-red{margin:12px 0 0;font-family:var(--font-display);font-weight:800;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-0.01em;color:var(--fp-red);text-wrap:balance;}
.cf-funding-progress .cf-fp-panel-body > .cf-fp-red:first-child{margin-top:0;}
.cf-funding-progress .cf-fp-detail{margin:8px 0 0;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;color:var(--ink);text-wrap:pretty;}
.cf-funding-progress .cf-fp-meta{margin:12px 0 0;font-size:0.9375rem;line-height:1.4;font-weight:600;color:var(--muted);}
.cf-funding-progress .cf-fp-btn{--fp-bg:var(--button-bg, var(--cta));--fp-bg2:var(--button-bg-2, var(--cta-2));display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;width:100%;min-height:72px;padding:12px 28px;border:0;border-radius:var(--button-radius, var(--radius, 12px));font-family:var(--button-font, var(--font-display));color:var(--button-ink, var(--cta-ink));text-transform:var(--button-case, none);text-align:center;text-decoration:none;text-shadow:var(--button-text-shadow, none);cursor:pointer;background:linear-gradient(oklch(from var(--fp-bg) calc(l + 0.04) c h), oklch(from var(--fp-bg2) calc(l - 0.02) c h));box-shadow:var(--button-shadow, inset 0 1px 0 oklch(from var(--fp-bg) calc(l + 0.14) c h / 0.7), inset 0 -3px 0 oklch(from var(--fp-bg) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--fp-shadow) l c h / 0.3), 0 8px 16px -6px oklch(from var(--fp-shadow) l c h / 0.4));transition:transform .16s ease, box-shadow .16s ease, background .16s ease;}
.cf-funding-progress .cf-fp-btn:hover,.cf-funding-progress .cf-fp-btn.is-hover{transform:translateY(-1px);background:linear-gradient(oklch(from var(--fp-bg) calc(l - 0.01) c h), oklch(from var(--fp-bg2) calc(l - 0.07) c h));box-shadow:var(--button-shadow, inset 0 1px 0 oklch(from var(--fp-bg) calc(l + 0.1) c h / 0.7), inset 0 -3px 0 oklch(from var(--fp-bg) calc(l - 0.2) c h), 0 1px 2px oklch(from var(--fp-shadow) l c h / 0.32), 0 10px 18px -6px oklch(from var(--fp-shadow) l c h / 0.48));}
.cf-funding-progress .cf-fp-btn:active,.cf-funding-progress .cf-fp-btn.is-active{transform:translateY(1px);background:linear-gradient(oklch(from var(--fp-bg) calc(l - 0.04) c h), oklch(from var(--fp-bg2) calc(l - 0.08) c h));box-shadow:inset 0 2px 3px oklch(from var(--fp-bg) calc(l - 0.22) c h / 0.55), inset 0 -2px 0 oklch(from var(--fp-bg) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--fp-shadow) l c h / 0.28);}
.cf-funding-progress .cf-fp-btn:focus-visible{outline:3px solid var(--accent);outline-offset:3px;}
.cf-funding-progress .cf-fp-btn:disabled,.cf-funding-progress .cf-fp-btn:disabled:hover{transform:none;cursor:not-allowed;background:var(--button-2-bg, var(--secondary));color:var(--button-2-ink, var(--secondary-ink));text-shadow:none;box-shadow:none;}
.cf-funding-progress .cf-fp-btn-label{font-size:clamp(1.125rem,1.55vw,1.375rem);line-height:1.15;font-weight:var(--button-weight, 800);text-wrap:balance;}
.cf-funding-progress .cf-fp-btn-sub{font-family:var(--font-body);font-size:0.9375rem;line-height:1.35;font-weight:600;text-transform:none;text-wrap:pretty;}
.cf-funding-progress .cf-fp-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;}
.cf-funding-progress:not([data-in]) .cf-fp-fill{animation-play-state:paused;}
.cf-funding-progress .cf-fp-route.is-compact{padding-inline:12px;}
.cf-funding-progress .cf-fp-route.is-compact .cf-fp-track .cf-fp-dot{width:24px;height:24px;margin:-12px 0 0 -12px;border-width:2px;}
.cf-funding-progress .cf-fp-route.is-compact .cf-fp-track .cf-fp-dot svg{width:12px;height:12px;}
.cf-funding-progress .cf-fp-route.is-compact .cf-fp-track .cf-fp-dot.is-sel{outline-width:2px;outline-offset:2px;}
@keyframes cf-fp-grow{from{transform:scaleX(0);}}
@keyframes cf-fp-rise{from{opacity:.82;transform:translateY(8px);}}
@media (max-width:860px){.cf-funding-progress .cf-fp-foot,.cf-funding-progress .cf-fp-foot.is-solo .cf-fp-cta,.cf-funding-progress .cf-fp-foot.is-solo .cf-fp-cta.is-bare{grid-template-columns:minmax(0,1fr);}}
@media (max-width:640px){.cf-funding-progress .cf-fp-stats{grid-auto-flow:row;grid-template-columns:1fr 1fr;}.cf-funding-progress .cf-fp-stat,.cf-funding-progress .cf-fp-stat + .cf-fp-stat{padding:0;border:0;}.cf-funding-progress .cf-fp-stat.is-raised{grid-column:1/-1;padding-bottom:16px;}.cf-funding-progress .cf-fp-stat.is-raised ~ .cf-fp-stat{padding-top:16px;border-top:1px solid var(--fp-line);}.cf-funding-progress .cf-fp-stat:not(.is-raised) + .cf-fp-stat:not(.is-raised){border-inline-start:1px solid var(--fp-line);padding-inline-start:16px;}}
@media (max-width:480px){.cf-funding-progress .cf-fp-row{grid-template-columns:30px minmax(0,1fr);row-gap:8px;}.cf-funding-progress .cf-fp-row > .cf-fp-chip{grid-column:2;}}
@media (max-width:560px){.cf-funding-progress .cf-fp-panel,.cf-funding-progress .cf-fp-panel.is-list{grid-template-columns:minmax(0,1fr);}.cf-funding-progress .cf-fp-thumb{aspect-ratio:16/9;}.cf-funding-progress .cf-fp-thumb.is-spot{aspect-ratio:auto;justify-items:start;}}
@media (prefers-reduced-motion: reduce){.cf-funding-progress .cf-fp-fill,.cf-funding-progress .cf-fp-stat,.cf-funding-progress .cf-fp-panel{animation:none;}.cf-funding-progress .cf-fp-btn,.cf-funding-progress .cf-fp-dot,.cf-funding-progress .cf-fp-stop,.cf-funding-progress .cf-fp-row{transition:none;}.cf-funding-progress .cf-fp-btn:hover,.cf-funding-progress .cf-fp-btn.is-hover,.cf-funding-progress .cf-fp-dot.is-hover{transform:none;}}
`;
pieces/urgency/funding-progress/specimen.tsx 57 lines
import __studioImage8a3fc3b0 from "../assets/ddf6ab72fb61f2a8.webp";
import __studioImagea3efe09d from "../assets/4e41aeea67c57acd.webp";
import __studioImageb1d87466 from "../assets/c5ff2eb417be8741.webp";
import { FundingProgress } from '../funding-progress';
import { slot } from '../../slots';
export const states = ['default', 'hover', 'active', 'disabled'];
type SpecimenState = 'default' | 'hover' | 'active' | 'disabled';
export default function FundingProgressSpecimen({ state = 'default' }: { state?: SpecimenState }) {
return (
<FundingProgress
state={state}
headline={
<>
Lanternfall is funded. <em>Now light up the whole coast.</em>
</>
}
lead='Every pledge carries the lantern further down the road. Tap a stop to see what lands in every box.'
raised={84210}
goal={50000}
backers={1312}
daysLeft={9}
stretchGoals={[
{
amount: 60000,
name: 'Linen-finish cards',
detail: 'Every card gets a linen finish that shuffles smooth and stands up to a hundred game nights.',
},
{
amount: 75000,
name: 'Metal lantern tokens',
detail: 'The 24 cardboard lantern tokens become weighty cast-metal pieces you can feel on the table.',
image: slot('item-1', __studioImage8a3fc3b0),
imageAlt: 'Cast-metal lantern tokens in brass and iron',
},
{
amount: 90000,
name: 'Ember Guard miniatures',
detail: 'Four sculpted Ember Guard minis replace the cardboard standees, one for every player.',
image: slot('item-2', __studioImagea3efe09d),
imageAlt: 'Four unpainted Ember Guard miniatures holding lanterns',
},
{
amount: 110000,
name: 'The Drowned Coast expansion',
detail: 'A full expansion in the box: 12 new coastline tiles, a tide deck and a fifth hero.',
image: slot('item-3', __studioImageb1d87466),
imageAlt: 'Drowned Coast expansion tiles, boats and tide cards',
},
]}
label='Rush my copy of Lanternfall'
sublabel='$49 core pledge · every unlocked goal included'
/>
);
}
| Name | Type | Details |
|---|---|---|
headline OptionalFundingProgress |
React.ReactNode |
|
lead OptionalFundingProgress |
React.ReactNode |
|
raised OptionalFundingProgress |
number |
|
goal OptionalFundingProgress |
number |
|
backers OptionalFundingProgress |
number |
|
daysLeft OptionalFundingProgress |
number |
|
currency OptionalFundingProgress |
string |
|
locale OptionalFundingProgress |
string |
|
stretchGoals OptionalFundingProgress |
FundingStretchGoal[] |
|
label OptionalFundingProgress |
string |
|
sublabel OptionalFundingProgress |
string |
|
href OptionalFundingProgress |
string |
|
onAction OptionalFundingProgress |
(event: React.MouseEvent<HTMLElement>) => void |
|
disabled OptionalFundingProgress |
boolean |
|
state OptionalFundingProgress |
'default' | 'hover' | 'active' | 'disabled' |
|
fallbackSpot OptionalFundingProgress |
string |
|
copy OptionalFundingProgress |
Partial<FundingProgressCopy> |
|
className OptionalFundingProgress |
string |
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-bg--button-2-ink- Secondary button.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
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.
-
4e41aeea67c57acd.webp
image/webp · 62.3 KB
-
c5ff2eb417be8741.webp
image/webp · 252 KB
-
ddf6ab72fb61f2a8.webp
image/webp · 113 KB
-
f6a8de367400456e.webp
image/webp · 14.6 KB