Cohort Staircase 1
Cohort staircase: proves results climb run after run. A centred headline with the grand total marked, a to-scale
Use it in a prompt
Use proof/cohort-staircase 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/cohort-staircase.tsx. - Import it and pass your copy and images (Props tab):
import { CohortStaircase } from "@/components/funneldna/proof/cohort-staircase"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/proof/cohort-staircase/component.tsx 579 lines
// layout: classic-centred-stack
// Cohort staircase: proves results climb run after run. A centred headline with the grand total marked, a to-scale
// bar chart that rises cohort by cohort, a method note, evidence tiles that open larger, then one action.
import React, { useEffect, useId, useMemo, useRef, useState } from "react";
import { X, ZoomIn } from "lucide-react";
import { Backdrop, Divider, FX_HOST } from "../fx/fx";
export type CohortStaircaseCohort = {
/** Short name under the value, e.g. "Cohort 3". */
label: string;
/** Raw number that sets the bar height, to scale against the largest value. */
value: number;
/** Short figure set large above the bar, e.g. "1.6M+". Keep it to about five characters. */
display: string;
/** Exact figure shown on hover and focus, e.g. "1,604,230 words". Falls back to display. */
exact?: string;
/** Caption after the label on the proof tile and in the dialog. */
caption?: React.ReactNode;
/** Evidence image (dashboard screenshot). No image, no tile. */
image?: string;
imageAlt?: string;
/** object-position for the tile crop, e.g. "50% 0%". */
imagePosition?: string;
};
export type CohortStaircaseCopy = {
/** Accessible name of the chart list. */
chartLabel: string;
/** Screen-reader text on each proof tile; "{label}" becomes the cohort label. */
expandLabel: string;
/** Accessible label of the dialog's close button. */
closeLabel: string;
};
export type CohortStaircaseProps = {
/** The grand total, swiped with the marker as the headline's key phrase. */
total?: React.ReactNode;
/** Headline text after the total. */
headline?: React.ReactNode;
lead?: React.ReactNode;
/** One entry per past cohort, in order. With none, the block renders nothing. */
cohorts?: CohortStaircaseCohort[];
/** One-line method note under the chart: what was counted, over what window. */
note?: React.ReactNode;
ctaLabel?: string;
href?: string;
onAction?: () => void;
disabled?: boolean;
/** Quiet line under the button. */
secondaryLabel?: React.ReactNode;
secondaryHref?: string;
/** Background scene photo (scene slot); a band scrim keeps the copy readable. */
sceneImage?: string;
/** Stepped edge handing off to the next (surface) section. */
showEdge?: boolean;
copy?: Partial<CohortStaircaseCopy>;
state?: "default" | "hover";
className?: string;
};
export function CohortStaircase(props: CohortStaircaseProps) {
const {
total,
headline = "Results that climb, run after run",
lead = "Each run produced more than the last, because the method keeps getting simpler.",
cohorts = [],
note,
ctaLabel = "Save my free spot",
href,
onAction,
disabled = false,
secondaryLabel = "or keep reading to see how it works",
secondaryHref,
sceneImage,
showEdge = true,
state = "default",
className,
} = props;
const copy: CohortStaircaseCopy = { ...DEFAULT_COPY, ...props.copy };
const titleId = useId();
const dialogTitleId = useId();
const data = useMemo(
() =>
(cohorts ?? []).filter(
(c) => c && Number.isFinite(c.value) && c.value > 0 && String(c.display ?? "").trim() !== "",
),
[cohorts],
);
const max = data.reduce((m, c) => Math.max(m, c.value), 0);
const tallest = data.findIndex((c) => c.value === max);
const tiles = data.flatMap((c, i) => (c.image ? [{ c, i }] : []));
// The staircase always renders at its final height. The rise plays only as an enhancement: when motion is
// allowed and the chart was below the fold at load, it starts just before the chart scrolls into view.
const chartRef = useRef<HTMLElement>(null);
const [rise, setRise] = useState(false);
const hasData = data.length > 0;
useEffect(() => {
const el = chartRef.current;
if (!el || typeof window === "undefined" || typeof IntersectionObserver === "undefined") return;
if (typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
let first = true;
const io = new IntersectionObserver(
(entries) => {
const hit = entries.some((e) => e.isIntersecting);
if (first) {
first = false;
if (hit) io.disconnect();
return;
}
if (hit) {
setRise(true);
io.disconnect();
}
},
{ rootMargin: "0px 0px 80px 0px" },
);
io.observe(el);
return () => io.disconnect();
}, [hasData]);
const [openIndex, setOpenIndex] = useState<number | null>(null);
const dialogRef = useRef<HTMLDialogElement>(null);
const returnRef = useRef<HTMLElement | null>(null);
useEffect(() => {
const d = dialogRef.current;
if (!d || openIndex === null || d.open) return;
if (typeof d.showModal === "function") d.showModal();
else d.setAttribute("open", "");
}, [openIndex]);
const handleClosed = () => {
setOpenIndex(null);
returnRef.current?.focus();
};
const closeDialog = () => {
const d = dialogRef.current;
if (!d) return;
if (typeof d.close === "function" && d.open) d.close();
else {
d.removeAttribute("open");
handleClosed();
}
};
if (!hasData) return null;
const active = openIndex !== null ? data[openIndex] : undefined;
const n = data.length;
const cta = ctaLabel ? (
href && !disabled ? (
<a className="cs-cta" href={href} onClick={onAction ? () => onAction() : undefined}>
{ctaLabel}
</a>
) : (
<button type="button" className="cs-cta" disabled={disabled} onClick={onAction ? () => onAction() : undefined}>
{ctaLabel}
</button>
)
) : null;
return (
<section
className={["cf-cohort-staircase", className].filter(Boolean).join(" ")}
style={FX_HOST}
aria-labelledby={titleId}
data-rise={rise ? "true" : undefined}
data-edge={showEdge ? "true" : undefined}
>
<style>{CSS}</style>
{sceneImage ? <Backdrop src={sceneImage} /> : null}
{sceneImage ? <div className="cs-scrim" aria-hidden="true" /> : null}
<div className="cs-inner">
<h2 id={titleId} className="cs-title">
{total ? (
<>
<mark className="cs-mark">{total}</mark>{" "}
</>
) : null}
{headline}
</h2>
{lead ? <p className="cs-lead">{lead}</p> : null}
<figure className="cs-chart" ref={chartRef}>
<ul className="cs-plot" aria-label={copy.chartLabel}>
{data.map((c, i) => {
const h = Math.max(c.value / max, 0.03);
const edge = n > 1 && i === 0 ? "start" : n > 1 && i === n - 1 ? "end" : "mid";
const exact = c.exact ?? c.display;
return (
<li
key={`${c.label}-${i}`}
className={"cs-col" + (state === "hover" && i === tallest ? " is-forced" : "")}
tabIndex={0}
data-edge={edge}
style={{ "--h": h.toFixed(4), "--i": i } as React.CSSProperties}
>
<span className="cs-sr">
{c.label}: {exact}
</span>
<span className="cs-label" aria-hidden="true">
<span className="cs-tip">{exact}</span>
<span className="cs-value">{c.display}</span>
<span className="cs-name">{c.label}</span>
</span>
<span className="cs-bar" aria-hidden="true" />
</li>
);
})}
</ul>
{note ? <figcaption className="cs-note">{note}</figcaption> : null}
</figure>
{tiles.length ? (
<ul
className="cs-tiles"
style={{ "--cols": Math.min(tiles.length, 4), "--cols-sm": Math.min(tiles.length, 2) } as React.CSSProperties}
>
{tiles.map(({ c, i }) => (
<li key={`${c.label}-tile-${i}`}>
<div className="cs-tile">
<div className="cs-shot">
<img
src={c.image}
alt=""
loading="lazy"
decoding="async"
style={{ objectPosition: c.imagePosition ?? "50% 0%" }}
/>
</div>
<div className="cs-cap">
<p className="cs-cap-text">
<strong>{c.label}</strong>
{c.caption ? <> · {c.caption}</> : null}
</p>
<button
type="button"
className="cs-zoom"
aria-haspopup="dialog"
aria-label={copy.expandLabel.split("{label}").join(c.label)}
onClick={(e) => {
returnRef.current = e.currentTarget;
setOpenIndex(i);
}}
>
<ZoomIn size={18} strokeWidth={2.5} aria-hidden="true" />
</button>
</div>
</div>
</li>
))}
</ul>
) : null}
{cta || secondaryLabel ? (
<div className="cs-action">
{cta}
{secondaryLabel ? (
<p className="cs-alt">{secondaryHref ? <a href={secondaryHref}>{secondaryLabel}</a> : secondaryLabel}</p>
) : null}
</div>
) : null}
</div>
{tiles.length ? (
<dialog
ref={dialogRef}
className="cs-dialog"
aria-labelledby={dialogTitleId}
onClose={handleClosed}
onClick={(e) => {
if (e.target === e.currentTarget) closeDialog();
}}
>
{active ? (
<div className="cs-panel">
<div className="cs-panel-head">
<p id={dialogTitleId} className="cs-panel-title">
<strong>{active.label}</strong>
{active.caption ? <> · {active.caption}</> : null}
</p>
<button type="button" className="cs-close" onClick={closeDialog} aria-label={copy.closeLabel}>
<X size={20} strokeWidth={2.5} aria-hidden="true" />
</button>
</div>
<img className="cs-panel-img" src={active.image} alt={active.imageAlt ?? active.label} />
</div>
) : null}
</dialog>
) : null}
{showEdge ? <Divider shape="step" tone="surface" height={56} /> : null}
</section>
);
}
export default CohortStaircase;
const DEFAULT_COPY: CohortStaircaseCopy = {
chartLabel: "Results by cohort",
expandLabel: "View larger: {label}",
closeLabel: "Close",
};
const CSS = `
.cf-cohort-staircase{
--cs-ink-soft: color-mix(in oklch, var(--band-ink) 82%, var(--band));
--cs-hair: oklch(from var(--band-ink) l c h / .22);
--cs-fill: var(--accent-fill, var(--accent));
--cs-shadow: var(--shadow, oklch(0.22 0.03 256));
--staircase-marker: var(--accent-fill, var(--accent));
--staircase-marker-ink: var(--accent-fill-ink, var(--card));
--plot: clamp(190px, 24vw, 320px);
--label-space: 104px;
position: relative;
isolation: isolate;
overflow: hidden;
background: var(--band);
color: var(--band-ink);
font-family: var(--font-body);
padding: clamp(56px, 8vw, 112px) clamp(16px, 5vw, 48px) clamp(64px, 8.5vw, 120px);
}
.cf-cohort-staircase[data-edge="true"]{ padding-bottom: calc(clamp(64px, 8.5vw, 120px) + 56px); }
.cf-cohort-staircase *, .cf-cohort-staircase *::before, .cf-cohort-staircase *::after{ box-sizing: border-box; }
.cf-cohort-staircase .cs-scrim{
position: absolute; inset: 0; z-index: 0; pointer-events: none;
background: linear-gradient(180deg, oklch(from var(--band) l c h / .8) 0%, oklch(from var(--band) l c h / .9) 45%, var(--band) 100%);
}
.cf-cohort-staircase .cs-inner{ position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; text-align: center; }
.cf-cohort-staircase .cs-title{
margin: 0 auto; max-width: 50rem;
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(--band-ink);
}
.cf-cohort-staircase .cs-mark{
color: var(--staircase-marker-ink); background: var(--staircase-marker);
padding: .03em .14em .04em; margin: 0 -.02em;
border-radius: .06em .3em .1em .34em / .42em .18em .3em .2em;
-webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.cf-cohort-staircase .cs-lead{
margin: 16px auto 0; max-width: 40rem;
font-size: clamp(1.125rem, 1.5vw, 1.375rem); line-height: 1.4; font-weight: 500;
color: var(--cs-ink-soft); text-wrap: pretty;
}
.cf-cohort-staircase .cs-chart{ margin: clamp(32px, 4vw, 48px) 0 0; }
.cf-cohort-staircase .cs-plot{
list-style: none; margin: 0; padding: 16px 0 0;
display: flex; align-items: flex-end; gap: clamp(8px, 2vw, 24px);
border-bottom: 1px solid var(--cs-hair);
}
.cf-cohort-staircase .cs-col{
position: relative; flex: 1 1 0; min-width: 0;
height: calc(var(--plot) + var(--label-space));
display: flex; flex-direction: column; justify-content: flex-end;
border-radius: 12px 12px 0 0; outline: none; cursor: default;
}
.cf-cohort-staircase .cs-col:focus-visible{ outline: 3px solid oklch(from var(--band-ink) l c h / .6); outline-offset: 4px; }
.cf-cohort-staircase .cs-label{ position: relative; display: block; padding-bottom: 12px; }
.cf-cohort-staircase .cs-value{
display: block; font-family: var(--font-display); font-weight: var(--display-weight, 800);
font-size: clamp(1.5rem, 4.2vw, 3.75rem); line-height: 1; letter-spacing: -0.03em;
font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--band-ink);
}
.cf-cohort-staircase .cs-name{
display: block; margin-top: 8px; font-size: 15px; line-height: 1.4; font-weight: 600;
color: var(--cs-ink-soft); text-wrap: balance;
}
.cf-cohort-staircase .cs-tip{
--tx: -50%;
position: absolute; bottom: calc(100% + 8px); left: 50%; z-index: 2;
transform: translate(var(--tx), 4px); opacity: 0; pointer-events: none; white-space: nowrap;
padding: 8px 12px; border-radius: 999px; background: var(--card); color: var(--ink);
font-size: 14px; line-height: 1.2; font-weight: 800; font-variant-numeric: tabular-nums;
box-shadow: var(--shadow-md, 0 1px 2px oklch(0.22 0.03 256 / .22), 0 4px 10px -2px oklch(0.22 0.03 256 / .2));
transition: opacity .16s ease, transform .16s ease;
}
.cf-cohort-staircase .cs-col[data-edge="start"] .cs-tip{ --tx: 0%; left: 0; }
.cf-cohort-staircase .cs-col[data-edge="end"] .cs-tip{ --tx: 0%; left: auto; right: 0; }
.cf-cohort-staircase .cs-col:hover .cs-tip,
.cf-cohort-staircase .cs-col:focus-visible .cs-tip,
.cf-cohort-staircase .cs-col.is-forced .cs-tip{ opacity: 1; transform: translate(var(--tx), 0); }
.cf-cohort-staircase .cs-bar{
display: block; height: calc(var(--plot) * var(--h)); min-height: 6px;
border-radius: 12px 12px 0 0; transform-origin: 50% 100%;
background: linear-gradient(180deg, oklch(from var(--cs-fill) calc(l + .06) c h) 0%, var(--cs-fill) 55%, oklch(from var(--cs-fill) calc(l - .1) c h) 100%);
box-shadow:
inset 0 1px 0 oklch(from var(--cs-fill) calc(l + .2) c h / .9),
inset 0 -1px 0 oklch(from var(--cs-fill) calc(l - .18) c h / .6);
transition: filter .16s ease;
}
.cf-cohort-staircase .cs-col:hover .cs-bar,
.cf-cohort-staircase .cs-col:focus-visible .cs-bar,
.cf-cohort-staircase .cs-col.is-forced .cs-bar{ filter: brightness(1.12) saturate(1.05); }
.cf-cohort-staircase[data-rise="true"] .cs-bar{
animation: cs-rise .8s cubic-bezier(.2,.7,.2,1) calc(var(--i) * 140ms) both;
}
.cf-cohort-staircase[data-rise="true"] .cs-value,
.cf-cohort-staircase[data-rise="true"] .cs-name{
animation: cs-in .45s cubic-bezier(.2,.7,.2,1) calc(var(--i) * 140ms + 300ms) both;
}
.cf-cohort-staircase .cs-note{
margin: 16px auto 0; max-width: 64ch; font-size: 15px; line-height: 1.4; font-weight: 500;
color: var(--cs-ink-soft); text-wrap: pretty;
}
.cf-cohort-staircase .cs-tiles{
list-style: none; margin: clamp(32px, 4vw, 48px) 0 0; padding: 0;
display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: clamp(12px, 2vw, 24px);
text-align: left;
}
.cf-cohort-staircase .cs-tiles > li{ min-width: 0; display: flex; }
.cf-cohort-staircase .cs-tile{
position: relative; display: flex; flex-direction: column; width: 100%;
padding: 12px 12px 16px; color: var(--ink);
background: var(--card);
border: 1px solid var(--card-border, oklch(from var(--ink) l c h / .12));
border-radius: var(--card-radius, var(--radius, 14px));
box-shadow: var(--card-shadow, var(--shadow-md, 0 1px 2px oklch(0.22 0.03 256 / .22), 0 4px 10px -2px oklch(0.22 0.03 256 / .2)));
transition: transform .16s ease, box-shadow .16s ease;
}
.cf-cohort-staircase .cs-tile:hover{
transform: translateY(-2px);
box-shadow: var(--shadow-lg, 0 2px 4px oklch(0.22 0.03 256 / .22), 0 12px 24px -8px oklch(0.22 0.03 256 / .32));
}
.cf-cohort-staircase .cs-tile:active{
transform: translateY(0);
box-shadow: var(--shadow-sm, 0 1px 1px oklch(0.22 0.03 256 / .18), 0 1px 3px oklch(0.22 0.03 256 / .14));
}
.cf-cohort-staircase .cs-tile:has(.cs-zoom:focus-visible){ outline: 3px solid oklch(from var(--band-ink) l c h / .65); outline-offset: 3px; }
.cf-cohort-staircase .cs-shot{
display: block; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden;
background: color-mix(in oklch, var(--ink) 6%, var(--card));
}
.cf-cohort-staircase .cs-shot img{
display: block; width: 100%; height: 100%; object-fit: cover;
transition: transform .3s cubic-bezier(.2,.7,.2,1);
}
.cf-cohort-staircase .cs-tile:hover .cs-shot img{ transform: scale(1.03); }
.cf-cohort-staircase .cs-cap{
display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
margin-top: 12px; padding: 0 4px; font-size: 15px; line-height: 1.4; font-weight: 500; color: var(--ink);
}
.cf-cohort-staircase .cs-cap strong{ font-weight: 800; }
.cf-cohort-staircase .cs-cap-text{ margin: 0; min-width: 0; text-wrap: pretty; }
.cf-cohort-staircase .cs-zoom{
flex: none; display: inline-flex; align-items: center; justify-content: center;
width: 36px; height: 36px; margin: -4px -4px 0 0; padding: 0; font: inherit; cursor: zoom-in;
border-radius: var(--button-radius, var(--radius, 12px));
border: 1px solid var(--button-2-border, transparent);
background: var(--button-2-bg, var(--secondary)); color: var(--button-2-ink, var(--secondary-ink));
box-shadow: var(--button-2-shadow, var(--shadow-sm));
transition: background .16s ease, transform .16s ease;
}
.cf-cohort-staircase .cs-zoom::after{
content: ""; position: absolute; inset: 0; z-index: 1;
border-radius: var(--card-radius, var(--radius, 14px)); cursor: zoom-in;
}
.cf-cohort-staircase .cs-tile:hover .cs-zoom{ background: oklch(from var(--button-2-bg, var(--secondary)) calc(l - .05) c h); }
.cf-cohort-staircase .cs-zoom:active{ transform: translateY(1px); }
.cf-cohort-staircase .cs-zoom:focus-visible{ outline: 3px solid oklch(from var(--field-focus, var(--accent)) l c h / .45); outline-offset: 2px; }
.cf-cohort-staircase .cs-action{
margin-top: clamp(40px, 5vw, 56px); display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.cf-cohort-staircase .cs-cta{
display: inline-flex; align-items: center; justify-content: center;
min-height: 72px; min-width: min(100%, 22rem); max-width: 100%; padding: 12px 32px; 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: clamp(1.125rem, 1.55vw, 1.375rem); line-height: 1.15;
text-align: center; text-decoration: none; text-wrap: balance;
color: var(--button-ink, var(--cta-ink)); text-shadow: var(--button-text-shadow, none);
background: linear-gradient(180deg, oklch(from var(--button-bg, var(--cta)) calc(l + .04) c h), oklch(from var(--button-bg-2, var(--cta-2)) calc(l - .02) c h));
box-shadow: var(--button-shadow,
inset 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l + .14) c h / .7),
inset 0 -3px 0 oklch(from var(--button-bg, var(--cta)) calc(l - .16) c h),
0 1px 2px oklch(from var(--cs-shadow) l c h / .35),
0 8px 16px -6px oklch(from var(--cs-shadow) l c h / .5));
cursor: pointer; -webkit-tap-highlight-color: transparent;
transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.cf-cohort-staircase .cs-cta:hover{
background: linear-gradient(180deg, oklch(from var(--button-bg, var(--cta)) calc(l - .01) c h), oklch(from var(--button-bg-2, var(--cta-2)) calc(l - .07) c h));
box-shadow: var(--button-shadow,
inset 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l + .1) c h / .7),
inset 0 -3px 0 oklch(from var(--button-bg, var(--cta)) calc(l - .2) c h),
0 1px 2px oklch(from var(--cs-shadow) l c h / .4),
0 10px 18px -6px oklch(from var(--cs-shadow) l c h / .6));
}
.cf-cohort-staircase .cs-cta:active{
transform: translateY(1px);
box-shadow:
inset 0 2px 4px oklch(from var(--cs-shadow) l c h / .35),
inset 0 -2px 0 oklch(from var(--button-bg, var(--cta)) calc(l - .16) c h),
0 1px 2px oklch(from var(--cs-shadow) l c h / .35);
}
.cf-cohort-staircase .cs-cta:focus-visible{ outline: 3px solid oklch(from var(--band-ink) l c h / .7); outline-offset: 3px; }
.cf-cohort-staircase .cs-cta:disabled{
cursor: not-allowed; background: var(--secondary); color: var(--secondary-ink); text-shadow: none;
box-shadow: var(--shadow-sm, 0 1px 1px oklch(0.22 0.03 256 / .18), 0 1px 3px oklch(0.22 0.03 256 / .14)); transform: none;
}
.cf-cohort-staircase .cs-alt{ margin: 0; font-size: 15px; line-height: 1.4; font-weight: 500; color: var(--cs-ink-soft); text-wrap: pretty; }
.cf-cohort-staircase .cs-alt a{
color: var(--band-ink); text-decoration: underline;
text-decoration-color: oklch(from var(--band-ink) l c h / .45); text-underline-offset: .18em;
}
.cf-cohort-staircase .cs-alt a:hover{ text-decoration-color: var(--band-ink); }
.cf-cohort-staircase .cs-alt a:focus-visible{ outline: 3px solid oklch(from var(--band-ink) l c h / .6); outline-offset: 3px; border-radius: 4px; }
.cf-cohort-staircase .cs-sr{
position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.cf-cohort-staircase .cs-dialog{
width: min(1000px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px);
padding: 0; border: 0; background: transparent; color: var(--ink); font-family: var(--font-body); overflow: visible;
}
.cf-cohort-staircase .cs-dialog[open]{ animation: cs-in .3s cubic-bezier(.2,.7,.2,1) both; }
.cf-cohort-staircase .cs-dialog::backdrop{ background: oklch(from var(--band, oklch(0.27 0.067 256)) l c h / .8); }
.cf-cohort-staircase .cs-panel{
display: flex; flex-direction: column; max-height: calc(100dvh - 32px);
background: var(--card); color: var(--ink);
border-radius: var(--card-radius, var(--radius, 14px)); padding: clamp(12px, 2vw, 20px);
box-shadow: var(--shadow-lg, 0 2px 4px oklch(0.22 0.03 256 / .22), 0 12px 24px -8px oklch(0.22 0.03 256 / .32));
}
.cf-cohort-staircase .cs-panel-head{ display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.cf-cohort-staircase .cs-panel-title{ margin: 0; font-size: clamp(1.0625rem, 1.25vw, 1.125rem); line-height: 1.4; font-weight: 500; text-wrap: pretty; }
.cf-cohort-staircase .cs-panel-title strong{ font-weight: 800; }
.cf-cohort-staircase .cs-close{
flex: none; display: inline-flex; align-items: center; justify-content: center;
width: 44px; height: 44px; padding: 0; cursor: pointer;
border-radius: var(--button-radius, var(--radius, 12px));
border: 1px solid var(--button-2-border, transparent);
background: var(--button-2-bg, var(--secondary)); color: var(--button-2-ink, var(--secondary-ink));
box-shadow: var(--button-2-shadow, var(--shadow-sm));
transition: background .16s ease, transform .16s ease;
}
.cf-cohort-staircase .cs-close:hover{ background: oklch(from var(--button-2-bg, var(--secondary)) calc(l - .04) c h); }
.cf-cohort-staircase .cs-close:active{ transform: translateY(1px); }
.cf-cohort-staircase .cs-close:focus-visible{ outline: 3px solid oklch(from var(--field-focus, var(--accent)) l c h / .45); outline-offset: 2px; }
.cf-cohort-staircase .cs-panel-img{
display: block; width: 100%; min-height: 0; flex: 1 1 auto; max-height: calc(100dvh - 140px);
object-fit: contain; border-radius: 8px; background: color-mix(in oklch, var(--ink) 4%, var(--card));
}
@keyframes cs-rise{ from{ transform: scaleY(0); } to{ transform: none; } }
@keyframes cs-in{ from{ opacity: .82; transform: translateY(8px); } to{ opacity: 1; transform: none; } }
@media (max-width: 760px){
.cf-cohort-staircase .cs-tiles{ grid-template-columns: repeat(var(--cols-sm), minmax(0, 1fr)); }
}
@media (max-width: 640px){
.cf-cohort-staircase{ --plot: 170px; --label-space: 58px; }
.cf-cohort-staircase .cs-plot{ gap: 8px; padding-top: 16px; }
.cf-cohort-staircase .cs-value{ font-size: 1.3125rem; }
.cf-cohort-staircase .cs-name{ margin-top: 4px; font-size: 14px; }
.cf-cohort-staircase .cs-label{ padding-bottom: 8px; }
.cf-cohort-staircase .cs-col, .cf-cohort-staircase .cs-bar{ border-radius: 8px 8px 0 0; }
.cf-cohort-staircase .cs-cap{ font-size: 14px; }
.cf-cohort-staircase .cs-cta{ width: 100%; max-width: 26rem; min-height: 64px; padding: 12px 20px; }
.cf-cohort-staircase .cs-tile{ padding: 8px 8px 12px; }
.cf-cohort-staircase .cs-cap{ gap: 8px; padding: 0 2px; }
.cf-cohort-staircase .cs-zoom{ width: 32px; height: 32px; margin: -2px -2px 0 0; }
}
@media (prefers-reduced-motion: reduce){
.cf-cohort-staircase[data-rise="true"] .cs-bar,
.cf-cohort-staircase[data-rise="true"] .cs-value,
.cf-cohort-staircase[data-rise="true"] .cs-name{ animation: none; }
.cf-cohort-staircase .cs-bar,
.cf-cohort-staircase .cs-tip,
.cf-cohort-staircase .cs-tile,
.cf-cohort-staircase .cs-shot img,
.cf-cohort-staircase .cs-zoom,
.cf-cohort-staircase .cs-cta,
.cf-cohort-staircase .cs-close{ transition: none; }
.cf-cohort-staircase .cs-tile:hover,
.cf-cohort-staircase .cs-tile:hover .cs-shot img{ transform: none; }
.cf-cohort-staircase .cs-dialog[open]{ animation: none; }
}
`;
pieces/proof/cohort-staircase/specimen.tsx 75 lines
import __studioImage3da7784b from "../assets/7471cd6b6cb82d5c.webp";
import __studioImage72c5ca8e from "../assets/b96ae659144b8535.webp";
import __studioImage57e5bea5 from "../assets/dccf23eecbdbfe46.webp";
import CohortStaircase from "../cohort-staircase";
export const states = ["default", "hover"];
const SCENE = __studioImage3da7784b;
const TRACKER_DARK = __studioImage72c5ca8e;
const TRACKER_LIGHT = __studioImage57e5bea5;
export default function CohortStaircaseSpecimen({ state = "default" }: { state?: "default" | "hover" }) {
return (
<CohortStaircase
state={state}
total="5.2M+ words"
headline="drafted by writers in the last four Draftline sprints"
lead="Every sprint has ended with more words on the page than the last, because the daily method keeps getting simpler to follow."
cohorts={[
{
label: "Sprint 1",
value: 412880,
display: "412K+",
exact: "412,880 words",
caption: "412,880 words in 21 days",
image: TRACKER_DARK,
imageAlt: "Draftline sprint tracker dashboard for Sprint 1",
imagePosition: "50% 0%",
},
{
label: "Sprint 2",
value: 867415,
display: "867K+",
exact: "867,415 words",
caption: "867,415 words, same 21-day window",
image: TRACKER_LIGHT,
imageAlt: "Draftline sprint tracker dashboard for Sprint 2",
imagePosition: "50% 0%",
},
{
label: "Sprint 3",
value: 1604230,
display: "1.6M+",
exact: "1,604,230 words",
caption: "1,604,230 words in 21 days",
image: TRACKER_DARK,
imageAlt: "Draftline sprint tracker leaderboard for Sprint 3",
imagePosition: "50% 100%",
},
{
label: "Sprint 4",
value: 2391775,
display: "2.4M+",
exact: "2,391,775 words",
caption: "2,391,775 words in 21 days",
image: TRACKER_LIGHT,
imageAlt: "Draftline sprint tracker member list for Sprint 4",
imagePosition: "50% 100%",
},
]}
note="Words logged in the Draftline tracker by writers who checked in daily, counted within each 21-day sprint."
ctaLabel="Save my seat in the next sprint"
secondaryLabel="or keep reading to see how a sprint day works"
secondaryHref="#how-it-works"
sceneImage={SCENE}
copy={{
chartLabel: "Words drafted per Draftline sprint",
expandLabel: "View the {label} tracker larger",
closeLabel: "Close",
}}
/>
);
}
| Name | Type | Details |
|---|---|---|
total OptionalCohortStaircase |
React.ReactNode |
|
headline OptionalCohortStaircase |
React.ReactNode |
|
lead OptionalCohortStaircase |
React.ReactNode |
|
cohorts OptionalCohortStaircase |
CohortStaircaseCohort[] |
|
note OptionalCohortStaircase |
React.ReactNode |
|
ctaLabel OptionalCohortStaircase |
string |
|
href OptionalCohortStaircase |
string |
|
onAction OptionalCohortStaircase |
() => void |
|
disabled OptionalCohortStaircase |
boolean |
|
secondaryLabel OptionalCohortStaircase |
React.ReactNode |
|
secondaryHref OptionalCohortStaircase |
string |
|
sceneImage OptionalCohortStaircase |
string |
|
showEdge OptionalCohortStaircase |
boolean |
|
copy OptionalCohortStaircase |
Partial<CohortStaircaseCopy> |
|
state OptionalCohortStaircase |
"default" | "hover" |
|
className OptionalCohortStaircase |
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-border--button-2-ink--button-2-shadow- Secondary button.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field-focus- Form inputs: background, ink, border, radius and focus colour.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
This piece reads no image slots.
-
7471cd6b6cb82d5c.webp
image/webp · 29.3 KB
-
b96ae659144b8535.webp
image/webp · 39.9 KB
-
dccf23eecbdbfe46.webp
image/webp · 32 KB