Counter Roll Hero 1
Counter Roll Hero: one supplied number rolls in like an odometer and locks digit by digit, the cutout pops forward,
Use it in a prompt
Use hero/counter-roll-hero 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/hero/counter-roll-hero.tsx. - Import it and pass your copy and images (Props tab):
import { CounterRollHero } from "@/components/funneldna/hero/counter-roll-hero"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/hero/counter-roll-hero/component.tsx 497 lines
// layout: fact-scoreboard
// Counter Roll Hero: one supplied number rolls in like an odometer and locks digit by digit, the cutout pops forward,
// then the promise slams in and a Belcher-weight button lands as the final beat, so the first screen plays like a motion ad.
import React from 'react';
import { Pause, Play, RotateCcw, ShieldCheck } from 'lucide-react';
import { Divider, FX_HOST, Glow } from '../fx/fx';
export type CounterRollReceipt = {
/** Product name printed at the top of the receipt */
title?: string;
items: { name: string; value: string }[];
subtotal?: string;
/** A real discount line only, e.g. { label: 'Founding price', value: '−$50' } */
discount?: { label: string; value: string };
total: string;
note?: string;
guarantee?: string;
};
export type CounterRollHeroProps = {
/** The supplied number that rolls, e.g. '12,480'. Leave it out and the hero opens on the headline. */
count?: string;
/** The line under the number, e.g. 'loaves baked by our students' */
unit?: string;
/** One entry per headline line; each line is one beat of the sequence (2–4 short lines) */
headline?: string[];
/** Index of the headline line set one step larger */
emphasisLine?: number;
/** 1 when this hero is the page's first screen */
headingLevel?: 1 | 2;
lead?: string;
label?: string;
href?: string;
onAction?: () => void;
/** The plain line under the button */
secondaryLabel?: string;
secondaryHref?: string;
/** presenter-cutout slot: a person or product on a transparent background */
presenterImage?: string;
presenterAlt?: string;
/** Till-receipt price block; shown only when supplied */
receipt?: CounterRollReceipt;
copy?: { pause?: string; resume?: string; replay?: string; subtotal?: string; total?: string };
/** Play the sequence when the block enters view (default true) */
autoPlay?: boolean;
state?: 'default' | 'hover' | 'active' | 'disabled';
className?: string;
};
type Phase = 'done' | 'idle' | 'play';
type Glyph = { kind: 'digit'; ch: string; d: number; i: number } | { kind: 'sep' | 'sym'; ch: string };
const DEFAULT_HEADLINE = ['Build your first', 'funnel with', 'a clear plan.'];
const STRIP = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
const ROLL_START = 150;
const ROLL_BASE = 600;
const ROLL_STEP = 140;
const LINE_BEAT = 240;
const useIsoLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
export function CounterRollHero(props: CounterRollHeroProps) {
const {
count,
unit = '',
headline = DEFAULT_HEADLINE,
emphasisLine,
headingLevel = 1,
lead = 'Plan your funnel, write your page copy, and check every step before you launch.',
label = 'Show Me the Plan',
href,
onAction,
secondaryLabel = 'or keep reading to see what’s inside',
secondaryHref,
presenterImage,
presenterAlt = '',
receipt,
copy,
autoPlay = true,
state = 'default',
className,
} = props;
const c = { pause: 'Pause animation', resume: 'Play animation', replay: 'Replay animation', subtotal: 'Subtotal', total: 'Total today', ...copy };
const glyphs = React.useMemo(() => parseCount(count), [count]);
const lines = headline.filter((line) => Boolean(line && line.trim()));
const digits = glyphs.filter((g) => g.kind === 'digit').length;
const hasCount = glyphs.length > 0;
const hasPhoto = Boolean(presenterImage);
const hasReceipt = Boolean(receipt && receipt.total);
const disabled = state === 'disabled';
const force = state === 'hover' || state === 'active' ? state : undefined;
const interactive = autoPlay && state === 'default';
const [phase, setPhase] = React.useState<Phase>('done');
const [paused, setPaused] = React.useState(false);
const [reduced, setReduced] = React.useState(false);
const rootRef = React.useRef<HTMLElement>(null);
const phaseRef = React.useRef<Phase>(phase);
phaseRef.current = phase;
const frame = React.useRef(0);
const cancel = React.useCallback(() => {
if (frame.current) cancelAnimationFrame(frame.current);
frame.current = 0;
}, []);
// Reset to the opening pose, then play on the next painted frame so every animation restarts cleanly.
const start = React.useCallback(() => {
cancel();
setPaused(false);
setPhase('idle');
frame.current = requestAnimationFrame(() => {
frame.current = requestAnimationFrame(() => {
frame.current = 0;
setPhase('play');
});
});
}, [cancel]);
useIsoLayoutEffect(() => {
if (!interactive || typeof window === 'undefined') {
setPhase('done');
return undefined;
}
const mq = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;
const sync = () => {
const r = Boolean(mq && mq.matches);
setReduced(r);
if (r) {
setPaused(false);
setPhase('done');
}
};
sync();
if (!(mq && mq.matches) && typeof IntersectionObserver !== 'undefined') setPhase('idle');
if (mq && mq.addEventListener) mq.addEventListener('change', sync);
return () => {
if (mq && mq.removeEventListener) mq.removeEventListener('change', sync);
};
}, [interactive]);
React.useEffect(() => {
const el = rootRef.current;
if (!interactive || reduced || !el || typeof IntersectionObserver === 'undefined') return undefined;
const io = new IntersectionObserver(
(entries) => {
for (const entry of entries) {
if (entry.isIntersecting && entry.intersectionRatio >= 0.2) {
if (phaseRef.current === 'idle') start();
} else if (!entry.isIntersecting) {
cancel();
setPaused(false);
setPhase('idle');
}
}
},
{ threshold: [0, 0.2] },
);
io.observe(el);
return () => {
io.disconnect();
cancel();
};
}, [interactive, reduced, start, cancel]);
// Timeline in ms: digits lock left to right, the cutout pops on the last lock, lines slam, the button lands last.
const lockAt = (i: number) => ROLL_START + ROLL_BASE + i * ROLL_STEP;
const lastLock = hasCount ? (digits ? lockAt(digits - 1) : 420) : 0;
const headAt = hasCount ? lastLock + 150 : 120;
const linesEnd = headAt + Math.max(lines.length, 1) * LINE_BEAT;
const popAt = hasCount ? lastLock : Math.max(headAt, linesEnd - LINE_BEAT);
const leadAt = linesEnd + 40;
const landAt = leadAt + 260;
const moreAt = landAt + 360;
const receiptAt = landAt + 180;
const endAt = Math.max(moreAt + 400, receiptAt + 460, popAt + 640) + 40;
const vars = {
'--t-thump': `${lastLock}ms`,
'--t-pop': `${popAt}ms`,
'--t-lead': `${leadAt}ms`,
'--t-land': `${landAt}ms`,
'--t-more': `${moreAt}ms`,
'--t-receipt': `${receiptAt}ms`,
'--t-end': `${endAt}ms`,
} as React.CSSProperties;
// Counter width in em so the digits fit their column at any width and in any display face.
const em = glyphs.reduce((w, g) => w + (g.kind === 'digit' ? 0.8 : g.kind === 'sep' ? 0.36 : 0.68), 0) - 0.02;
// Phones: number → promise → action first, then the cutout stands behind the price card.
const narrow = [hasCount ? 'count' : '', 'head', 'act', hasPhoto ? 'photo' : '', hasReceipt ? 'receipt' : '']
.filter(Boolean)
.map((a) => `'${a}'`)
.join(' ');
const rows: string[][] = [];
if (hasPhoto) {
if (hasCount) rows.push(['count', 'photo']);
rows.push(['head', 'photo']);
rows.push(['act', hasReceipt ? 'receipt' : 'photo']);
} else {
if (hasCount) rows.push(['count', 'count']);
rows.push(['head', 'head']);
rows.push(['act', hasReceipt ? 'receipt' : 'act']);
}
const wide = rows.map((r) => `'${r.join(' ')}'`).join(' ');
const onEnd = (e: React.AnimationEvent<HTMLElement>) => {
const t = e.target as HTMLElement;
if (t.classList && t.classList.contains('cr-clock')) {
setPaused(false);
setPhase('done');
}
};
const onControl = () => {
if (phase === 'play') setPaused((p) => !p);
else start();
};
const ctlLabel = phase === 'play' ? (paused ? c.resume : c.pause) : c.replay;
const CtlIcon = phase === 'play' ? (paused ? Play : Pause) : RotateCcw;
const Heading = headingLevel === 2 ? 'h2' : 'h1';
const button = disabled ? (
<button type="button" className="cr-btn" disabled>
{label}
</button>
) : href ? (
<a className="cr-btn" href={href} data-force={force} onClick={() => onAction?.()}>
{label}
</a>
) : (
<button type="button" className="cr-btn" data-force={force} onClick={() => onAction?.()}>
{label}
</button>
);
return (
<section
ref={rootRef}
className={['cf-counter-roll-hero', className].filter(Boolean).join(' ')}
data-state={phase}
data-paused={paused ? 'true' : undefined}
style={{ ...FX_HOST, ...vars }}
onAnimationEnd={onEnd}
>
<style>{CSS}</style>
{interactive && !reduced ? (
<button type="button" className="cr-ctl" onClick={onControl} aria-label={ctlLabel} title={ctlLabel}>
<CtlIcon size={18} strokeWidth={2.5} aria-hidden="true" />
</button>
) : null}
<div className="cr-inner">
<div
className="cr-grid"
data-overlap={hasPhoto && hasReceipt ? 'true' : undefined}
style={{ '--cr-narrow': narrow, '--cr-wide': wide } as React.CSSProperties}
>
{hasCount ? (
<div className="cr-count">
<p className="cr-sr">{unit ? `${count} ${unit}` : count}</p>
<div aria-hidden="true">
<div className="cr-digits" style={{ '--cr-em': em.toFixed(3) } as React.CSSProperties}>
{glyphs.map((g, k) =>
g.kind === 'digit' ? (
<span
key={k}
className="cr-slot"
style={
{
'--y': `${-(10 + g.d) * 5}%`,
'--dur': `${lockAt(g.i) - ROLL_START}ms`,
'--lock': `${lockAt(g.i)}ms`,
} as React.CSSProperties
}
>
<span className="cr-strip">
{STRIP.map((n, j) => (
<span key={j}>{n}</span>
))}
</span>
<span className="cr-lock" />
</span>
) : (
<span key={k} className={g.kind === 'sep' ? 'cr-sep' : 'cr-sym'}>
{g.ch}
</span>
),
)}
</div>
{unit ? <div className="cr-unit">{unit}</div> : null}
</div>
</div>
) : null}
{lines.length ? (
<div className="cr-head">
<Heading className="cr-hl">
<span className="cr-sr">{lines.join(' ')}</span>
<span aria-hidden="true">
{lines.map((line, k) => (
<span
key={k}
className={`cr-line cr-fx-${k % 3}${k === emphasisLine ? ' is-em' : ''}`}
style={{ '--d': `${headAt + k * LINE_BEAT}ms` } as React.CSSProperties}
>
{line}
</span>
))}
</span>
</Heading>
</div>
) : null}
<div className="cr-act">
{lead ? <p className="cr-lead">{lead}</p> : null}
<div className="cr-land">{button}</div>
{secondaryLabel ? (
<p className="cr-more">{secondaryHref ? <a href={secondaryHref}>{secondaryLabel}</a> : secondaryLabel}</p>
) : null}
</div>
{hasPhoto ? (
<figure className="cr-photo">
<div className="cr-glow" aria-hidden="true">
<Glow />
</div>
<span className="cr-floor" aria-hidden="true" />
<div className="cr-pop">
<img src={presenterImage} alt={presenterAlt} width={640} height={640} decoding="async" />
</div>
</figure>
) : null}
{hasReceipt && receipt ? (
<div className="cr-receipt">
{receipt.title ? <p className="cr-r-title">{receipt.title}</p> : null}
{receipt.items && receipt.items.length ? (
<ul className="cr-r-items">
{receipt.items.map((item, k) => (
<li key={k}>
<span className="cr-r-name">{item.name}</span>
<span className="cr-r-val">{item.value}</span>
</li>
))}
</ul>
) : null}
{receipt.subtotal || receipt.discount ? (
<div className="cr-r-sums">
{receipt.subtotal ? (
<div className="cr-r-row">
<span className="cr-r-name">{c.subtotal}</span>
<span className="cr-r-val">{receipt.subtotal}</span>
</div>
) : null}
{receipt.discount ? (
<div className="cr-r-row cr-r-off">
<span className="cr-r-name">{receipt.discount.label}</span>
<span className="cr-r-val">{receipt.discount.value}</span>
</div>
) : null}
</div>
) : null}
<div className="cr-r-total">
<span className="cr-r-tl">{c.total}</span>
<span className="cr-r-tv">{receipt.total}</span>
</div>
{receipt.note ? <p className="cr-r-note">{receipt.note}</p> : null}
{receipt.guarantee ? (
<p className="cr-r-g">
<ShieldCheck className="cr-ico" size={18} strokeWidth={2.5} aria-hidden="true" />
{receipt.guarantee}
</p>
) : null}
</div>
) : null}
</div>
</div>
<span className="cr-clock" aria-hidden="true" />
<Divider shape="angle" tone="surface" height={56} />
</section>
);
}
export default CounterRollHero;
function parseCount(count?: string): Glyph[] {
if (!count || !count.trim()) return [];
let i = 0;
return Array.from(count.trim()).map((ch): Glyph => {
if (ch >= '0' && ch <= '9') {
const g: Glyph = { kind: 'digit', ch, d: Number(ch), i };
i += 1;
return g;
}
const kind: 'sep' | 'sym' = ch === ',' || ch === '.' || ch === ' ' ? 'sep' : 'sym';
return { kind, ch };
});
}
const CSS = `
.cf-counter-roll-hero{--cr-ink:var(--band-ink,#ffffff);--cr-sh:var(--shadow,oklch(0.22 0.03 260));position:relative;isolation:isolate;overflow:clip;background:var(--band,#1b2a4a);color:var(--cr-ink);font-family:var(--font-body);padding-block:clamp(68px,8vw,112px) calc(clamp(64px,8.5vw,120px) + 56px);padding-inline:clamp(16px,5vw,48px)}
.cf-counter-roll-hero *,.cf-counter-roll-hero *::before,.cf-counter-roll-hero *::after{box-sizing:border-box}
.cf-counter-roll-hero .cr-sr{position:absolute;inline-size:1px;block-size:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.cf-counter-roll-hero .cr-inner{position:relative;z-index:1;max-inline-size:1120px;margin-inline:auto;container:crhero/inline-size}
.cf-counter-roll-hero .cr-grid{display:grid;grid-template-columns:minmax(0,1fr);grid-template-areas:var(--cr-narrow);row-gap:clamp(24px,4vw,40px)}
.cf-counter-roll-hero .cr-grid>*{min-width:0}
@container crhero (min-width:760px){.cf-counter-roll-hero .cr-grid{grid-template-columns:minmax(0,1.6fr) minmax(0,1fr);grid-template-areas:var(--cr-wide);column-gap:clamp(32px,5vw,72px);row-gap:clamp(24px,3vw,36px)}}
.cf-counter-roll-hero .cr-count{grid-area:count;container:crcount/inline-size}
.cf-counter-roll-hero .cr-digits{display:flex;align-items:flex-end;gap:.06em;font-family:var(--font-display);font-weight:var(--display-weight,800);line-height:1;font-variant-numeric:tabular-nums lining-nums;font-size:clamp(1.5rem,calc(84vw / var(--cr-em)),11rem);font-size:clamp(1.5rem,calc(100cqi / var(--cr-em)),11rem);transform-origin:0 100%}
.cf-counter-roll-hero .cr-slot{position:relative;flex:0 0 auto;display:block;inline-size:.74em;block-size:1.18em;overflow:clip;border-radius:.09em;background:oklch(from var(--cr-ink) l c h / .08);box-shadow:inset 0 0 0 1px oklch(from var(--cr-ink) l c h / .14),inset 0 .08em .12em oklch(from var(--cr-sh) l c h / .5)}
.cf-counter-roll-hero .cr-strip{display:flex;flex-direction:column;transform:translateY(var(--y))}
.cf-counter-roll-hero .cr-strip>span{display:block;block-size:1.18em;line-height:1.18em;text-align:center}
.cf-counter-roll-hero .cr-lock{position:absolute;inset-inline:.16em;inset-block-end:.06em;block-size:max(3px,.035em);border-radius:999px;background:var(--accent-fill,var(--accent,#2f6fdb));transform-origin:0 50%}
.cf-counter-roll-hero .cr-sep{flex:0 0 auto;inline-size:.3em;text-align:center;line-height:1.18}
.cf-counter-roll-hero .cr-sym{flex:0 0 auto;line-height:1.18;padding-inline:.03em}
.cf-counter-roll-hero .cr-unit{margin:16px 0 0;font-size:clamp(1.3125rem,1.8vw,1.625rem);font-weight:700;line-height:1.2;text-wrap:balance;overflow-wrap:anywhere}
.cf-counter-roll-hero .cr-head{grid-area:head;container:crhead/inline-size}
.cf-counter-roll-hero .cr-hl{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);letter-spacing:var(--display-tracking,-0.025em);line-height:1.02;font-size:clamp(2.25rem,9vw,7.25rem);font-size:clamp(2.25rem,12.5cqi,7.25rem);text-wrap:balance;overflow-wrap:anywhere;hyphens:auto}
.cf-counter-roll-hero .cr-line{display:block;transform-origin:0 60%}
.cf-counter-roll-hero .cr-line.is-em{font-size:1.14em}
.cf-counter-roll-hero .cr-act{grid-area:act;container:cract/inline-size;display:flex;flex-direction:column;align-items:stretch}
.cf-counter-roll-hero .cr-lead{margin:0 0 clamp(24px,3vw,32px);max-inline-size:56ch;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;text-wrap:pretty;overflow-wrap:anywhere}
.cf-counter-roll-hero .cr-land{display:flex;transform-origin:50% 50%}
.cf-counter-roll-hero .cr-btn{--cr-bb:var(--button-bg,var(--cta,#d63a2f));--cr-bb2:var(--button-bg-2,var(--cta-2,#b52d24));display:inline-flex;align-items:center;justify-content:center;inline-size:100%;max-inline-size:100%;min-block-size:72px;padding:14px 28px;padding:14px clamp(16px,4cqi,44px);border:0;border-radius:var(--button-radius,var(--radius,12px));font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:1.375rem;font-size:clamp(1.25rem,4.4cqi,1.75rem);line-height:1.15;letter-spacing:-.005em;text-align:center;text-wrap:balance;overflow-wrap:anywhere;text-decoration:none;color:var(--button-ink,var(--cta-ink,#ffffff));text-shadow:var(--button-text-shadow,none);background:linear-gradient(oklch(from var(--cr-bb) calc(l + .04) c h),oklch(from var(--cr-bb2) calc(l - .02) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--cr-bb) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--cr-bb) calc(l - .16) c h),0 1px 2px oklch(from var(--cr-sh) l c h / .4),0 8px 16px -6px oklch(from var(--cr-sh) l c h / .6));cursor:pointer;-webkit-tap-highlight-color:transparent;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
.cf-counter-roll-hero .cr-btn:hover:not(:disabled),.cf-counter-roll-hero .cr-btn[data-force='hover']{background:linear-gradient(oklch(from var(--cr-bb) calc(l - .01) c h),oklch(from var(--cr-bb2) calc(l - .07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--cr-bb) calc(l + .12) c h / .7),inset 0 -3px 0 oklch(from var(--cr-bb) calc(l - .2) c h),0 1px 2px oklch(from var(--cr-sh) l c h / .45),0 14px 24px -8px oklch(from var(--cr-sh) l c h / .7));transform:translateY(-2px)}
.cf-counter-roll-hero .cr-btn:active:not(:disabled),.cf-counter-roll-hero .cr-btn[data-force='active']{background:linear-gradient(oklch(from var(--cr-bb) calc(l - .06) c h),oklch(from var(--cr-bb2) calc(l - .08) c h));box-shadow:inset 0 2px 5px oklch(from var(--cr-bb) calc(l - .24) c h / .55),inset 0 -2px 0 oklch(from var(--cr-bb) calc(l - .16) c h),0 1px 1px oklch(from var(--cr-sh) l c h / .4);transform:translateY(1px)}
.cf-counter-roll-hero .cr-btn:focus-visible{outline:3px solid var(--cr-ink);outline-offset:4px}
.cf-counter-roll-hero .cr-btn:disabled{background:var(--button-2-bg,var(--secondary,#e4e8ef));color:var(--button-2-ink,var(--secondary-ink,#101828));box-shadow:var(--button-2-shadow,var(--shadow-sm,0 1px 2px oklch(0.22 0.03 260 / .2)));text-shadow:none;cursor:not-allowed;transform:none}
.cf-counter-roll-hero .cr-more{margin:16px 0 0;font-size:.9375rem;font-weight:600;line-height:1.4;text-align:center;text-wrap:pretty}
.cf-counter-roll-hero .cr-more a{color:var(--cr-ink);text-decoration:underline;text-decoration-thickness:1px;text-decoration-color:oklch(from var(--cr-ink) l c h / .5);text-underline-offset:.18em}
.cf-counter-roll-hero .cr-more a:hover{text-decoration-color:var(--cr-ink);text-decoration-thickness:2px}
.cf-counter-roll-hero .cr-more a:focus-visible{outline:3px solid var(--cr-ink);outline-offset:3px;border-radius:4px}
@container cract (min-width:520px){.cf-counter-roll-hero .cr-btn{inline-size:auto;min-inline-size:min(100%,24rem);min-block-size:84px}.cf-counter-roll-hero .cr-land{transform-origin:0 50%}.cf-counter-roll-hero .cr-more{text-align:start}}
.cf-counter-roll-hero .cr-photo{grid-area:photo;position:relative;isolation:isolate;margin:0;justify-self:center;align-self:start;inline-size:min(100%,21rem)}
@container crhero (min-width:760px){.cf-counter-roll-hero .cr-photo{inline-size:100%;justify-self:stretch;align-self:end}}
.cf-counter-roll-hero .cr-glow{position:absolute;inset:-18% -24%;z-index:0;pointer-events:none;-webkit-mask-image:radial-gradient(closest-side,black 30%,transparent 100%);mask-image:radial-gradient(closest-side,black 30%,transparent 100%)}
.cf-counter-roll-hero .cr-floor{position:absolute;z-index:0;inset-inline:14%;inset-block-end:-2%;block-size:9%;border-radius:50%;background:radial-gradient(closest-side,oklch(from var(--cr-sh) l c h / .6),oklch(from var(--cr-sh) l c h / 0));transform-origin:50% 50%}
.cf-counter-roll-hero .cr-pop{position:relative;z-index:1;transform-origin:50% 90%}
.cf-counter-roll-hero .cr-pop img{display:block;inline-size:100%;block-size:auto;aspect-ratio:1/1;object-fit:contain;object-position:50% 100%;-webkit-mask-image:linear-gradient(to bottom,black 84%,transparent 100%);mask-image:linear-gradient(to bottom,black 84%,transparent 100%);filter:drop-shadow(0 2px 3px oklch(from var(--cr-sh) l c h / .45)) drop-shadow(0 16px 20px oklch(from var(--cr-sh) l c h / .5))}
.cf-counter-roll-hero .cr-receipt{grid-area:receipt;align-self:start;justify-self:center;inline-size:100%;max-inline-size:30rem;background:var(--card,#ffffff);color:var(--ink,#101828);border:1px solid var(--card-border,oklch(from var(--ink,#101828) l c h / .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 / .22),0 12px 24px -8px oklch(0.22 0.03 260 / .32)));padding:clamp(20px,3vw,28px)}
@container crhero (min-width:760px){.cf-counter-roll-hero .cr-receipt{max-inline-size:none;justify-self:stretch}}
.cf-counter-roll-hero .cr-grid[data-overlap='true'] .cr-receipt{position:relative;z-index:2;margin-block-start:calc(-1 * clamp(72px,8cqi,96px))}
.cf-counter-roll-hero .cr-r-title{margin:0 0 12px;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-.01em;text-wrap:balance;overflow-wrap:anywhere}
.cf-counter-roll-hero .cr-r-items{list-style:none;margin:0;padding:0}
.cf-counter-roll-hero .cr-r-items li,.cf-counter-roll-hero .cr-r-row{display:flex;justify-content:space-between;align-items:baseline;gap:12px;padding-block:6px}
.cf-counter-roll-hero .cr-r-items li{font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.35}
.cf-counter-roll-hero .cr-r-name{min-width:0;text-wrap:pretty;overflow-wrap:anywhere}
.cf-counter-roll-hero .cr-r-val{flex:0 0 auto;white-space:nowrap;font-weight:700;font-variant-numeric:tabular-nums lining-nums}
.cf-counter-roll-hero .cr-r-sums{margin-top:8px;padding-top:8px;border-top:1px solid oklch(from var(--ink,#101828) l c h / .12)}
.cf-counter-roll-hero .cr-r-row{font-size:.9375rem;line-height:1.35;font-weight:600;color:var(--muted,#4a5568)}
.cf-counter-roll-hero .cr-r-off{color:var(--success,#1f7a3f)}
.cf-counter-roll-hero .cr-r-total{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:baseline;gap:4px 12px;margin-top:12px;padding:14px 16px;border-radius:10px;background:color-mix(in oklch,var(--ink,#101828) 5%,var(--card,#ffffff))}
.cf-counter-roll-hero .cr-r-tl{font-size:clamp(1.0625rem,1.25vw,1.125rem);font-weight:800}
.cf-counter-roll-hero .cr-r-tv{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:-.03em;font-variant-numeric:tabular-nums lining-nums}
.cf-counter-roll-hero .cr-r-note,.cf-counter-roll-hero .cr-r-g{margin:12px 0 0;font-size:.9375rem;line-height:1.4;font-weight:600;text-wrap:pretty}
.cf-counter-roll-hero .cr-r-note{color:var(--muted,#4a5568)}
.cf-counter-roll-hero .cr-r-g{color:var(--ink,#101828)}
.cf-counter-roll-hero .cr-r-g .cr-ico{display:inline-block;vertical-align:-.15em;margin-inline-end:.4em;color:var(--success,#1f7a3f)}
.cf-counter-roll-hero .cr-ctl{position:absolute;z-index:3;inset-block-start:clamp(12px,2vw,20px);inset-inline-end:clamp(12px,2vw,20px);display:grid;place-items:center;inline-size:44px;block-size:44px;padding:0;border-radius:999px;border:1px solid oklch(from var(--cr-ink) l c h / .24);background:oklch(from var(--cr-ink) l c h / .1);color:var(--cr-ink);cursor:pointer;transition:background .16s ease,transform .16s ease}
.cf-counter-roll-hero .cr-ctl:hover{background:oklch(from var(--cr-ink) l c h / .2)}
.cf-counter-roll-hero .cr-ctl:active{transform:scale(.94)}
.cf-counter-roll-hero .cr-ctl:focus-visible{outline:3px solid var(--cr-ink);outline-offset:3px}
.cf-counter-roll-hero .cr-clock{position:absolute;inset-block-start:0;inset-inline-start:0;inline-size:1px;block-size:1px;opacity:0;pointer-events:none}
@keyframes cfcr-roll{0%{transform:translateY(0)}84%{transform:translateY(calc(var(--y) - 1.4%))}100%{transform:translateY(var(--y))}}
@keyframes cfcr-lock{from{transform:scaleX(0)}to{transform:scaleX(1)}}
@keyframes cfcr-thump{0%{transform:none}40%{transform:scale(1.035)}100%{transform:none}}
@keyframes cfcr-unit{from{clip-path:inset(-20% 100% -20% -2%)}to{clip-path:inset(-20% -2% -20% -2%)}}
@keyframes cfcr-slam{0%{opacity:0;transform:scale(1.45)}55%{opacity:1;transform:scale(.97)}100%{opacity:1;transform:none}}
@keyframes cfcr-wipe{0%{opacity:1;clip-path:inset(-14% 100% -14% -4%);transform:translateX(-3%)}100%{opacity:1;clip-path:inset(-14% -4% -14% -4%);transform:none}}
@keyframes cfcr-drop{0%{opacity:0;transform:translateY(-50%)}65%{opacity:1;transform:translateY(5%)}100%{opacity:1;transform:none}}
@keyframes cfcr-fade{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes cfcr-land{0%{opacity:0;transform:translateY(28px) scale(.88)}60%{opacity:1;transform:translateY(-4px) scale(1.035)}100%{opacity:1;transform:none}}
@keyframes cfcr-pop{0%{transform:translateY(10px) scale(.94)}55%{transform:translateY(-8px) scale(1.05)}100%{transform:none}}
@keyframes cfcr-floor{0%{opacity:.35;transform:scaleX(.75)}55%{opacity:1;transform:scaleX(1.08)}100%{opacity:1;transform:none}}
@keyframes cfcr-clock{from{opacity:0}to{opacity:0}}
@media (prefers-reduced-motion:no-preference){
.cf-counter-roll-hero[data-state='idle'] .cr-strip{transform:translateY(0)}
.cf-counter-roll-hero[data-state='idle'] .cr-lock{transform:scaleX(0)}
.cf-counter-roll-hero[data-state='idle'] .cr-unit{clip-path:inset(-20% 100% -20% -2%)}
.cf-counter-roll-hero[data-state='idle'] :is(.cr-line,.cr-land){opacity:0}
.cf-counter-roll-hero[data-state='idle'] :is(.cr-lead,.cr-more,.cr-receipt){opacity:.82;transform:translateY(8px)}
.cf-counter-roll-hero[data-state='idle'] .cr-pop{transform:translateY(10px) scale(.94)}
.cf-counter-roll-hero[data-state='idle'] .cr-floor{opacity:.35;transform:scaleX(.75)}
.cf-counter-roll-hero[data-state='play'] .cr-strip{will-change:transform;animation:cfcr-roll var(--dur) cubic-bezier(.12,.72,.2,1) 150ms both}
.cf-counter-roll-hero[data-state='play'] .cr-lock{animation:cfcr-lock .2s cubic-bezier(.2,.8,.2,1) var(--lock) both}
.cf-counter-roll-hero[data-state='play'] .cr-digits{animation:cfcr-thump .28s cubic-bezier(.2,.8,.2,1) var(--t-thump) both}
.cf-counter-roll-hero[data-state='play'] .cr-unit{animation:cfcr-unit .56s cubic-bezier(.2,.7,.2,1) .26s both}
.cf-counter-roll-hero[data-state='play'] .cr-line.cr-fx-0{animation:cfcr-slam .44s cubic-bezier(.2,.8,.2,1) var(--d) both}
.cf-counter-roll-hero[data-state='play'] .cr-line.cr-fx-1{animation:cfcr-wipe .5s cubic-bezier(.65,0,.2,1) var(--d) both}
.cf-counter-roll-hero[data-state='play'] .cr-line.cr-fx-2{animation:cfcr-drop .46s cubic-bezier(.2,.8,.2,1) var(--d) both}
.cf-counter-roll-hero[data-state='play'] .cr-lead{animation:cfcr-fade .45s cubic-bezier(.2,.7,.2,1) var(--t-lead) both}
.cf-counter-roll-hero[data-state='play'] .cr-land{animation:cfcr-land .56s cubic-bezier(.2,.8,.2,1) var(--t-land) both}
.cf-counter-roll-hero[data-state='play'] .cr-more{animation:cfcr-fade .45s cubic-bezier(.2,.7,.2,1) var(--t-more) both}
.cf-counter-roll-hero[data-state='play'] .cr-receipt{animation:cfcr-fade .45s cubic-bezier(.2,.7,.2,1) var(--t-receipt) both}
.cf-counter-roll-hero[data-state='play'] .cr-pop{animation:cfcr-pop .64s cubic-bezier(.2,.8,.2,1) var(--t-pop) both}
.cf-counter-roll-hero[data-state='play'] .cr-floor{animation:cfcr-floor .64s cubic-bezier(.2,.8,.2,1) var(--t-pop) both}
.cf-counter-roll-hero[data-state='play'] .cr-clock{animation:cfcr-clock var(--t-end) linear both}
.cf-counter-roll-hero[data-state='play'][data-paused='true'] :is(.cr-strip,.cr-lock,.cr-digits,.cr-unit,.cr-line,.cr-lead,.cr-land,.cr-more,.cr-receipt,.cr-pop,.cr-floor,.cr-clock){animation-play-state:paused}
}
@media (prefers-reduced-motion:reduce){.cf-counter-roll-hero .cr-btn,.cf-counter-roll-hero .cr-ctl{transition:none}}
`;
pieces/hero/counter-roll-hero/specimen.tsx 42 lines
import __studioImage88de9d84 from "../assets/4edf37f7b2b3e7a9.webp";
import React from 'react';
import { CounterRollHero } from '../counter-roll-hero';
import { slot } from '../../slots';
import defaults from '../../studio-defaults.json';
export const states = ['default', 'hover', 'active', 'disabled'];
export default function CounterRollHeroSpecimen({ state = 'default' }: { state?: 'default' | 'hover' | 'active' | 'disabled' }) {
const s = defaults.sample;
return (
<CounterRollHero
state={state}
count="12,480"
unit="loaves baked by our students"
headline={['One starter.', 'Forty loaves.', 'Before 7am.']}
emphasisLine={1}
lead="Sourdough at Scale gives you the bake schedule, the dough math and the oven rotation that turn two Sunday loaves into a full market stall."
label="Get the Bake Schedule"
secondaryLabel="or keep reading to see what’s inside"
secondaryHref="#inside"
presenterImage={slot(
'presenter-cutout',
__studioImage88de9d84,
)}
presenterAlt="Smiling baker in a flour-dusted apron holding a basket of sourdough loaves"
receipt={{
title: 'Sourdough at Scale',
items: [
{ name: 'Starter-to-Stall video course', value: '$49' },
{ name: 'Bake Schedule workbook', value: '$29' },
{ name: 'Market Day checklist', value: '$19' },
],
subtotal: s.regularPrice,
discount: { label: 'Founding baker price', value: '−$50' },
total: s.price,
note: s.note,
guarantee: s.guarantee,
}}
/>
);
}
| Name | Type | Details |
|---|---|---|
count OptionalCounterRollHero |
string |
|
unit OptionalCounterRollHero |
string |
|
headline OptionalCounterRollHero |
string[] |
|
emphasisLine OptionalCounterRollHero |
number |
|
headingLevel OptionalCounterRollHero |
1 | 2 |
|
lead OptionalCounterRollHero |
string |
|
label OptionalCounterRollHero |
string |
|
href OptionalCounterRollHero |
string |
|
onAction OptionalCounterRollHero |
() => void |
|
secondaryLabel OptionalCounterRollHero |
string |
|
secondaryHref OptionalCounterRollHero |
string |
|
presenterImage OptionalCounterRollHero |
string |
|
presenterAlt OptionalCounterRollHero |
string |
|
receipt OptionalCounterRollHero |
CounterRollReceipt |
|
copy OptionalCounterRollHero |
{ pause?: string; resume?: string; replay?: string; subtotal?: string; total?: string } |
|
autoPlay OptionalCounterRollHero |
boolean |
|
state OptionalCounterRollHero |
'default' | 'hover' | 'active' | 'disabled' |
|
className OptionalCounterRollHero |
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.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
presenter-cutout- The presenter on a transparent background.
-
4edf37f7b2b3e7a9.webp
image/webp · 128 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB