Fill The Blank Statement 1
Fill-the-blank statement: the reader's own guesses land in the blanks and are struck one by one, then the real
Use it in a prompt
Use content/fill-the-blank-statement 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/content/fill-the-blank-statement.tsx. - Import it and pass your copy and images (Props tab):
import { FillTheBlankStatement } from "@/components/funneldna/content/fill-the-blank-statement"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/content/fill-the-blank-statement/component.tsx 414 lines
// layout: magazine-spread
// Fill-the-blank statement: the reader's own guesses land in the blanks and are struck one by one, then the real
// reason lands last in the accent colour, so the belief the offer rests on feels discovered rather than told.
import * as React from "react";
import { Backdrop, Divider, FX_HOST } from "../fx/fx";
import city from "../fx/backdrops/city";
type BackdropTreatment = React.ComponentProps<typeof Backdrop>["treatment"];
type DividerTone = React.ComponentProps<typeof Divider>["tone"];
export type FillTheBlankBlank = {
/** The word or phrase the blank finally lands on. */
answer?: string;
/** Wrong guesses, shown and struck in order before the answer lands (three reads best). */
guesses?: string[];
};
export type FillTheBlankStatementProps = {
/** The sentence, with {first} and {second} marking the two blanks. */
template?: string;
first?: FillTheBlankBlank;
/** Its answer is set in the accent colour. */
second?: FillTheBlankBlank;
/** Short paragraphs set as magazine columns under the sentence. */
body?: string[];
/** One phrase inside body swiped with the marker highlight. */
highlight?: string;
/** dark = the page's band colour with light type; light = a quiet grey band with ink type. */
tone?: "dark" | "light";
/** Background photo (the theme's scene slot replaces it); null for a plain band. */
backdropImage?: string | null;
backdropTreatment?: BackdropTreatment;
/** Colour of the next section, for the angled bottom edge. */
edgeTone?: DividerTone;
showEdge?: boolean;
/** false renders the finished sentence with no scroll animation. */
animate?: boolean;
className?: string;
};
const DEFAULT_TEMPLATE = "The reason your {first} isn't working is {second}.";
const DEFAULT_FIRST: FillTheBlankBlank = { guesses: ["website", "emails", "videos"], answer: "funnel" };
const DEFAULT_SECOND: FillTheBlankBlank = { guesses: ["your price", "your traffic", "the algorithm"], answer: "one missing step" };
const DEFAULT_BODY = [
"You've already tried the obvious fixes. A new headline. A lower price. More traffic. Each one felt like the answer, until it wasn't.",
"The real problem usually hides one step past where everyone looks. Find that step, and everything you've already built finally gets a fair chance to work.",
];
const DEFAULT_HIGHLIGHT = "one step past where everyone looks";
const useIsoLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
export function FillTheBlankStatement(props: FillTheBlankStatementProps) {
const {
template = DEFAULT_TEMPLATE,
first = DEFAULT_FIRST,
second = DEFAULT_SECOND,
body = DEFAULT_BODY,
highlight = DEFAULT_HIGHLIGHT,
tone = "dark",
backdropImage = city,
backdropTreatment,
edgeTone = "surface",
showEdge = true,
animate = true,
className,
} = props;
const parts = React.useMemo(() => parseTemplate(template), [template]);
const has1 = parts.some((p) => p.kind === "blank" && p.which === "first");
const has2 = parts.some((p) => p.kind === "blank" && p.which === "second");
const g1 = React.useMemo(() => clean(first?.guesses), [first]);
const g2 = React.useMemo(() => clean(second?.guesses), [second]);
const k1 = has1 ? g1.length : 0;
const k2 = has2 ? g2.length : 0;
const off2 = has1 ? k1 + 1 : 0;
const T = off2 + (has2 ? k2 + 1 : 0);
const stageRef = React.useRef<HTMLDivElement>(null);
const [live, setLive] = React.useState(false);
const [pos, setPos] = React.useState(T);
const [striking, setStriking] = React.useState(false);
const shown = live ? pos : T;
// Scroll sets a target step; the shown step walks toward it so every guess is seen and struck.
useIsoLayoutEffect(() => {
if (!animate || T === 0) return;
const stage = stageRef.current;
if (!stage || typeof window.matchMedia !== "function") return;
const mq = window.matchMedia("(prefers-reduced-motion: reduce)");
if (mq.matches) return;
const isGuess = (p: number) =>
(has1 && p >= 1 && p <= k1) || (has2 && p - off2 >= 1 && p - off2 <= k2);
let raf = 0;
let timer = 0;
let strikingNow = false;
const viewport = () => window.innerHeight || document.documentElement.clientHeight || 1;
const read = () => {
const r = stage.getBoundingClientRect();
const vh = viewport();
const start = vh * 0.92;
const end = vh * 0.34;
const p = Math.min(1, Math.max(0, (start - r.top) / (start - end)));
return Math.min(T, Math.floor(p * (T + 1)));
};
const rect = stage.getBoundingClientRect();
const inView = rect.top < viewport() && rect.bottom > 0;
let target = read();
let cur = inView ? 0 : target;
setPos(cur);
setStriking(false);
setLive(true);
const tick = () => {
timer = 0;
if (cur === target) {
if (strikingNow) {
strikingNow = false;
setStriking(false);
}
return;
}
if (target > cur) {
if (isGuess(cur) && !strikingNow) {
strikingNow = true;
setStriking(true);
timer = window.setTimeout(tick, 320);
return;
}
strikingNow = false;
setStriking(false);
cur += 1;
setPos(cur);
timer = window.setTimeout(tick, isGuess(cur) ? 480 : 380);
} else {
if (strikingNow) {
strikingNow = false;
setStriking(false);
}
cur -= 1;
setPos(cur);
timer = window.setTimeout(tick, 110);
}
};
const kick = () => {
if (!timer) timer = window.setTimeout(tick, 0);
};
const onScroll = () => {
if (raf) return;
raf = window.requestAnimationFrame(() => {
raf = 0;
target = read();
kick();
});
};
const stop = () => {
window.removeEventListener("scroll", onScroll);
window.removeEventListener("resize", onScroll);
mq.removeEventListener?.("change", onMotion);
if (raf) window.cancelAnimationFrame(raf);
if (timer) window.clearTimeout(timer);
raf = 0;
timer = 0;
};
function onMotion() {
if (!mq.matches) return;
stop();
setStriking(false);
setLive(false);
}
window.addEventListener("scroll", onScroll, { passive: true });
window.addEventListener("resize", onScroll);
mq.addEventListener?.("change", onMotion);
if (cur !== target) kick();
return () => {
stop();
setLive(false);
setStriking(false);
};
}, [animate, T, k1, k2, off2, has1, has2]);
// Keep each faint trail of struck guesses inside the column, whatever line its blank lands on.
const fitTrails = React.useCallback(() => {
const stage = stageRef.current;
if (!stage) return;
const trails = Array.from(stage.querySelectorAll<HTMLElement>(".ftb-trail"));
if (!trails.length) return;
for (const t of trails) t.style.setProperty("--ftb-shift", "0px");
const box = stage.getBoundingClientRect();
for (const t of trails) {
const r = t.getBoundingClientRect();
let shift = 0;
if (r.right > box.right) shift = box.right - r.right;
if (r.left + shift < box.left) shift = box.left - r.left;
if (shift) t.style.setProperty("--ftb-shift", `${Math.round(shift)}px`);
}
}, []);
useIsoLayoutEffect(() => {
fitTrails();
}, [fitTrails, shown, live, template, g1, g2]);
React.useEffect(() => {
const stage = stageRef.current;
if (!stage) return;
let alive = true;
let ro: ResizeObserver | undefined;
if (typeof ResizeObserver !== "undefined") {
ro = new ResizeObserver(() => fitTrails());
ro.observe(stage);
}
document.fonts?.ready.then(() => {
if (alive) fitTrails();
});
return () => {
alive = false;
ro?.disconnect();
};
}, [fitTrails]);
const answer1 = first?.answer?.trim() ?? "";
const answer2 = second?.answer?.trim() ?? "";
const finalSentence = parts
.map((p) => (p.kind === "text" ? p.text : p.which === "first" ? answer1 : answer2))
.join("")
.replace(/\s+/g, " ")
.trim();
const renderSentence = (at: number, isLive: boolean, strike: boolean) => {
const out: React.ReactNode[] = [];
let skip = 0;
parts.forEach((seg, i) => {
if (seg.kind === "text") {
let t = seg.text.slice(skip);
skip = 0;
// Tie the last word before a blank to its neighbour so no lone "is" strands on its own line.
if (parts[i + 1]?.kind === "blank") t = t.replace(/ (\S+\s?)$/, "\u00a0$1");
if (t) out.push(<React.Fragment key={i}>{t}</React.Fragment>);
return;
}
const next = parts[i + 1];
const tail = next && next.kind === "text" ? (next.text.match(/^\S*/)?.[0] ?? "") : "";
skip = tail.length;
const isFirst = seg.which === "first";
out.push(
<BlankView
key={i}
guesses={isFirst ? g1 : g2}
answer={isFirst ? answer1 : answer2}
tail={tail}
local={isFirst ? at : at - off2}
live={isLive}
striking={strike}
accent={!isFirst}
/>,
);
});
return out;
};
const paras = (body ?? []).map((s) => (s ?? "").trim()).filter(Boolean);
const markAt = highlight ? paras.findIndex((p) => p.includes(highlight)) : -1;
const treatment = backdropTreatment ?? (tone === "light" ? "scrim-light" : "scrim-dark");
const rootClass = ["cf-ftb", className].filter(Boolean).join(" ");
return (
<section className={rootClass} data-tone={tone} data-edge={showEdge ? "" : undefined} style={FX_HOST}>
<style>{CSS}</style>
{backdropImage ? <Backdrop src={backdropImage} treatment={treatment} /> : null}
<div className="ftb-inner">
{parts.length ? (
<div className="ftb-stage" ref={stageRef}>
<h2 className="ftb-sentence">
<span className="ftb-sr">{finalSentence}</span>
<span aria-hidden="true">{renderSentence(shown, live, striking)}</span>
</h2>
{live ? (
<div className="ftb-sentence ftb-ghost" aria-hidden="true">
{renderSentence(T, false, false)}
</div>
) : null}
</div>
) : null}
{paras.length ? (
<div className="ftb-cols">
{paras.map((p, i) => (
<p key={i}>{i === markAt && highlight ? markPhrase(p, highlight) : p}</p>
))}
</div>
) : null}
</div>
{showEdge ? <Divider shape="angle" tone={edgeTone} height={56} /> : null}
</section>
);
}
export default FillTheBlankStatement;
type Segment = { kind: "text"; text: string } | { kind: "blank"; which: "first" | "second" };
function parseTemplate(template: string): Segment[] {
const out: Segment[] = [];
const re = /\{(first|second)\}/g;
let last = 0;
let m: RegExpExecArray | null;
while ((m = re.exec(template))) {
if (m.index > last) out.push({ kind: "text", text: template.slice(last, m.index) });
out.push({ kind: "blank", which: m[1] as "first" | "second" });
last = m.index + m[0].length;
}
if (last < template.length) out.push({ kind: "text", text: template.slice(last) });
return out;
}
function clean(list?: string[]) {
return (list ?? []).map((s) => (s ?? "").trim()).filter(Boolean);
}
function markPhrase(text: string, phrase: string) {
const at = text.indexOf(phrase);
if (at < 0) return text;
return (
<>
{text.slice(0, at)}
<mark className="ftb-mark">{phrase}</mark>
{text.slice(at + phrase.length)}
</>
);
}
function BlankView({
guesses,
answer,
tail,
local,
live,
striking,
accent,
}: {
guesses: string[];
answer: string;
/** Punctuation that follows the blank; set right after the word so it never drifts to the line's end. */
tail: string;
local: number;
live: boolean;
striking: boolean;
accent: boolean;
}) {
const k = guesses.length;
const kind = local <= 0 ? "empty" : local <= k ? "guess" : "answer";
const trail = kind === "empty" ? 0 : kind === "guess" ? local - 1 : k;
const word = kind === "guess" ? guesses[local - 1] : kind === "answer" ? answer : "";
const key = kind === "guess" ? `g${local}` : kind;
return (
<span className="ftb-blank" style={{ "--n": k } as React.CSSProperties}>
{k > 0 ? (
<span className="ftb-trail">
{guesses.map((g, i) => (
<span key={i} data-on={i < trail ? "" : undefined}>
{g}
</span>
))}
</span>
) : null}
<span className="ftb-anim" key={key} data-enter={live ? "" : undefined}>
{word ? (
<span
className="ftb-word"
data-strike={striking && kind === "guess" ? "" : undefined}
data-accent={accent && kind === "answer" ? "" : undefined}
>
{word}
</span>
) : (
<span className="ftb-gap" />
)}
{tail ? <span className="ftb-tail">{tail}</span> : null}
</span>
</span>
);
}
const CSS = `
.cf-ftb{position:relative;overflow:clip;isolation:isolate;background:var(--ftb-bg);color:var(--ftb-ink);font-family:var(--font-body)}
.cf-ftb[data-tone="dark"]{--ftb-bg:var(--band, oklch(0.27 0.067 256));--ftb-ink:var(--band-ink, oklch(1 0 0));--ftb-faint:color-mix(in oklch, var(--ftb-ink) 74%, var(--ftb-bg));--ftb-line:color-mix(in oklch, var(--ftb-ink) 70%, transparent);--ftb-accent:oklch(from var(--accent, oklch(0.5 0.17 257)) max(l, 0.82) c h);--ftb-accent-line:oklch(from var(--accent-fill, var(--accent, oklch(0.5 0.17 257))) max(l, 0.72) c h);--ftb-strike:oklch(from var(--danger, oklch(0.5 0.17 27)) max(l, 0.7) c h)}
.cf-ftb[data-tone="light"]{--ftb-bg:color-mix(in oklch, var(--ink, oklch(0.21 0.034 263)) 4%, var(--surface, oklch(1 0 0)));--ftb-ink:var(--ink, oklch(0.21 0.034 263));--ftb-faint:var(--muted, oklch(0.45 0.03 258));--ftb-line:color-mix(in oklch, var(--ftb-ink) 40%, transparent);--ftb-accent:var(--accent, oklch(0.5 0.17 257));--ftb-accent-line:var(--accent-fill, var(--accent, oklch(0.5 0.17 257)));--ftb-strike:var(--danger, oklch(0.5 0.17 27))}
.cf-ftb .ftb-inner{position:relative;z-index:1;box-sizing:border-box;inline-size:100%;min-inline-size:0;max-inline-size:calc(1120px + 2 * clamp(16px, 5vw, 48px));margin-inline:auto;padding-inline:clamp(16px, 5vw, 48px);padding-block:clamp(56px, 8vw, 112px) clamp(64px, 8.5vw, 120px)}
.cf-ftb[data-edge] .ftb-inner{padding-block-end:calc(clamp(64px, 8.5vw, 120px) + 56px)}
.cf-ftb .ftb-stage{container-type:inline-size;display:grid;min-inline-size:0}
.cf-ftb .ftb-stage > *{grid-area:1 / 1;align-self:start;min-inline-size:0}
.cf-ftb .ftb-ghost{visibility:hidden;pointer-events:none}
.cf-ftb .ftb-sentence{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, 8.4vw, 4.875rem);font-size:clamp(2rem, 9cqi, 4.875rem);line-height:1.06;text-wrap:balance;overflow-wrap:break-word;hyphens:manual;color:var(--ftb-ink)}
.cf-ftb .ftb-sr{position:absolute;inline-size:1px;block-size:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}
.cf-ftb .ftb-blank{position:relative;display:inline-block;max-inline-size:100%;white-space:normal;vertical-align:baseline;padding-block-start:calc(var(--n, 0) * max(0.26em, 0.875rem) * 1.18 + min(var(--n, 0), 1) * 0.12em)}
.cf-ftb .ftb-trail{position:absolute;inset-block-start:0;inset-inline-start:0;display:flex;flex-direction:column-reverse;align-items:flex-start;inline-size:max-content;max-inline-size:60cqi;font-size:max(0.26em, 0.875rem);font-weight:700;line-height:1.18;letter-spacing:0;translate:var(--ftb-shift, 0px) 0;pointer-events:none}
.cf-ftb .ftb-tail{color:var(--ftb-ink)}
.cf-ftb .ftb-trail > span{display:block;max-inline-size:100%;white-space:normal;color:var(--ftb-faint);text-decoration-line:line-through;text-decoration-color:var(--ftb-strike);text-decoration-thickness:0.11em;opacity:0;transform:translateY(0.7em);transition:opacity .3s ease, transform .42s cubic-bezier(.2,.7,.2,1)}
.cf-ftb .ftb-trail > span[data-on]{opacity:1;transform:none}
.cf-ftb .ftb-anim{display:block}
.cf-ftb .ftb-anim[data-enter]{animation:cf-ftb-land .42s cubic-bezier(.2,.7,.2,1) both}
@keyframes cf-ftb-land{from{opacity:.3;transform:translateY(.16em)}}
.cf-ftb .ftb-word{--ftb-under:var(--ftb-line);background-image:linear-gradient(var(--ftb-strike), var(--ftb-strike)), linear-gradient(var(--ftb-under), var(--ftb-under));background-repeat:no-repeat;background-position:0 56%, 0 100%;background-size:0% 0.085em, 100% 0.06em;-webkit-box-decoration-break:clone;box-decoration-break:clone;transition:background-size .32s cubic-bezier(.2,.7,.2,1), color .3s ease}
.cf-ftb .ftb-word[data-strike]{background-size:100% 0.085em, 100% 0.06em;color:var(--ftb-faint)}
.cf-ftb .ftb-word[data-accent]{--ftb-under:var(--ftb-accent-line);color:var(--ftb-accent)}
.cf-ftb .ftb-gap{display:inline-block;inline-size:2.6em;max-inline-size:100%;block-size:0.62em;border-block-end:0.06em solid var(--ftb-line);vertical-align:-0.16em}
.cf-ftb .ftb-cols{display:grid;grid-template-columns:repeat(auto-fit, minmax(min(100%, 19rem), 1fr));gap:clamp(16px, 3vw, 24px) clamp(32px, 5vw, 72px);margin-block-start:clamp(32px, 4.5vw, 56px);max-inline-size:56rem;min-inline-size:0}
.cf-ftb .ftb-cols p{margin:0;min-inline-size:0;max-inline-size:64ch;font-size:clamp(1.0625rem, 1.25vw, 1.125rem);line-height:1.55;font-weight:400;color:var(--ftb-ink);text-wrap:pretty;overflow-wrap:break-word}
.cf-ftb .ftb-mark{background:var(--marker, #fae37c);background:oklch(from var(--marker, #fae37c) max(l, 0.88) c h);color:var(--marker-ink, oklch(0.22 0.03 260));padding:0.02em 0.16em 0.04em;margin-inline:-0.04em;border-radius:0.12em 0.28em 0.16em 0.3em;-webkit-box-decoration-break:clone;box-decoration-break:clone;font-weight:600}
.cf-ftb[data-tone="light"] .ftb-mark{background:linear-gradient(transparent 0.42em, var(--marker, #fae37c) 0.42em);background:linear-gradient(transparent 0.42em, oklch(from var(--marker, #fae37c) max(l, 0.88) c h) 0.42em);color:var(--ftb-ink)}
@media (prefers-reduced-motion: reduce){.cf-ftb .ftb-anim[data-enter]{animation:none}.cf-ftb .ftb-word,.cf-ftb .ftb-trail > span{transition:none}}
`;
pieces/content/fill-the-blank-statement/specimen.tsx 22 lines
// Specimen: Main Street Ads, a fictional local ad agency, finishing the sentence its prospects keep getting wrong.
import { FillTheBlankStatement } from "../fill-the-blank-statement";
import retail from "../../fx/backdrops/retail";
export const states = ["default"];
export default function FillTheBlankStatementSpecimen({ state = "default" }: { state?: string }) {
void state;
return (
<FillTheBlankStatement
template="The reason your {first} aren't working is {second}."
first={{ guesses: ["flyers", "posts", "emails"], answer: "ads" }}
second={{ guesses: ["the targeting", "the budget", "the photos"], answer: "the page after the click" }}
body={[
"You tried new photos. New headlines. A bigger budget. The clicks kept coming, and the phone still didn't ring.",
"Every click lands somewhere. Main Street Ads builds the page that turns a local click into a booked call, so the ads you already pay for finally have somewhere worth landing.",
]}
highlight="the page that turns a local click into a booked call"
backdropImage={retail}
/>
);
}
| Name | Type | Details |
|---|---|---|
template OptionalFillTheBlankStatement |
string |
|
first OptionalFillTheBlankStatement |
FillTheBlankBlank |
|
second OptionalFillTheBlankStatement |
FillTheBlankBlank |
|
body OptionalFillTheBlankStatement |
string[] |
|
highlight OptionalFillTheBlankStatement |
string |
|
tone OptionalFillTheBlankStatement |
"dark" | "light" |
|
backdropImage OptionalFillTheBlankStatement |
string | null |
|
backdropTreatment OptionalFillTheBlankStatement |
BackdropTreatment |
|
edgeTone OptionalFillTheBlankStatement |
DividerTone |
|
showEdge OptionalFillTheBlankStatement |
boolean |
|
animate OptionalFillTheBlankStatement |
boolean |
|
className OptionalFillTheBlankStatement |
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.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--marker- The highlighter colour behind key phrases.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
This piece reads no image slots.
-
5bb1b66cfd3f8ab1.webp
image/webp · 43.8 KB
-
d0cac66d335df33c.webp
image/webp · 44.7 KB