Question Answer Drop 1
Question, then the one-word answer. A big question holds the screen. As the reader scrolls, a giant answer word
Use it in a prompt
Use content/question-answer-drop 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/question-answer-drop.tsx. - Import it and pass your copy and images (Props tab):
import { QuestionAnswerDrop } from "@/components/funneldna/content/question-answer-drop"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/content/question-answer-drop/component.tsx 422 lines
// layout: spotlight-row
// Question, then the one-word answer. A big question holds the screen. As the reader scrolls, a giant answer word
// fitted to the column (capped on wide screens) drops in and the question dims, so the answer carries the argument.
// Type-led, no button.
import * as React from 'react';
import { Check } from 'lucide-react';
export type QuestionAnswerDropProps = {
/** The doubt or objection in the reader's own words; it is the section heading. Empty hides it. */
question?: React.ReactNode;
/** The one-word answer, fitted to the full width of the column. Empty hides it. */
answer?: string;
/** One short supporting sentence under the answer. Empty hides it. */
sentence?: React.ReactNode;
/** Optional short supporting facts, shown small in a row beneath the answer (supplied facts only). */
points?: string[];
/** Full-bleed background scene (slot "scene"), shown under a solid token scrim. */
sceneImage?: string;
/** Cut-out product on a transparent background (slot "product"). It overhangs the band's lower edge. */
productImage?: string;
/** Alt text for the product image. Empty marks it decorative. */
productAlt?: string;
/** Dark band (--band, --band-ink) or light band (--surface, --ink). */
tone?: 'dark' | 'light';
/** Render the landed composition at once (previews, screenshots). */
revealed?: boolean;
className?: string;
};
type Phase = 'static' | 'armed' | 'landed';
export function QuestionAnswerDrop({
question = 'Can you really do this, even if you’re starting from zero?',
answer = 'Yes.',
sentence = 'Keep reading. Here’s exactly how it works.',
points = [],
sceneImage,
productImage,
productAlt = '',
tone = 'dark',
revealed = false,
className,
}: QuestionAnswerDropProps) {
const wrapRef = React.useRef<HTMLDivElement>(null);
const measureRef = React.useRef<HTMLSpanElement>(null);
const [phase, setPhase] = React.useState<Phase>(revealed ? 'landed' : 'static');
const [fit, setFit] = React.useState<string | null>(null);
const [lead, setLead] = React.useState<string | null>(null);
const answerText = (answer ?? '').trim();
const hasAnswer = answerText.length > 0;
const hasQuestion = question !== null && question !== undefined && question !== false && question !== '';
const hasSentence = sentence !== null && sentence !== undefined && sentence !== false && sentence !== '';
const list = (points ?? []).filter((p) => typeof p === 'string' && p.trim().length > 0);
const hasProduct = Boolean(productImage);
const hasRow = hasSentence || list.length > 0 || hasProduct;
const chars = Math.max(1, Array.from(answerText).length);
// Drop-in: one IntersectionObserver, landed once. Reduced motion and no-IO render the finished composition.
useIsoLayoutEffect(() => {
if (revealed) {
setPhase('landed');
return;
}
if (!hasAnswer) {
setPhase('static');
return;
}
const reduce = typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
const el = wrapRef.current;
if (reduce || typeof IntersectionObserver === 'undefined' || !el) {
setPhase('landed');
return;
}
setPhase('armed');
const io = new IntersectionObserver(
(entries) => {
if (entries.some((e) => e.isIntersecting)) {
setPhase('landed');
io.disconnect();
}
},
{ rootMargin: '0px 0px -28% 0px', threshold: 0 }
);
io.observe(el);
return () => io.disconnect();
}, [revealed, hasAnswer]);
// Fit the answer to the column: measure it once at 100px and express the size in cqi, so resizing never re-measures.
// The ResizeObserver on the hidden measurer catches font loads and theme face changes.
useIsoLayoutEffect(() => {
const m = measureRef.current;
if (!m || !hasAnswer) return;
if (typeof CSS === 'undefined' || typeof CSS.supports !== 'function' || !CSS.supports('font-size', '1cqi')) return;
let alive = true;
const run = () => {
if (!alive) return;
const w = m.getBoundingClientRect().width;
if (w > 0) setFit(`${(9700 / w).toFixed(3)}cqi`);
// The face's glyph box (ascent + descent) at 100px: tall theme faces overhang the line box, so the answer's
// top padding grows to keep it clear of the question. Faces that already fit keep the designed 0.17em.
if (typeof document.createRange === 'function') {
const r = document.createRange();
r.selectNodeContents(m);
const h = r.getBoundingClientRect().height;
if (h > 0) setLead((h / 100).toFixed(3));
}
};
run();
let ro: ResizeObserver | null = null;
if (typeof ResizeObserver !== 'undefined') {
ro = new ResizeObserver(run);
ro.observe(m);
}
if (document.fonts && document.fonts.ready) document.fonts.ready.then(run).catch(() => undefined);
return () => {
alive = false;
if (ro) ro.disconnect();
};
}, [answerText, hasAnswer]);
const fitStyle = {
'--qad-chars': chars,
...(fit ? { '--qad-size': fit } : {}),
...(lead ? { '--qad-c': lead } : {}),
} as React.CSSProperties;
return (
<section
className={['cf-qad', className].filter(Boolean).join(' ')}
data-tone={tone}
data-phase={phase}
data-product={hasProduct ? 'true' : 'false'}
data-dim={hasAnswer && hasQuestion ? 'true' : 'false'}
>
<style>{CSS_TEXT}</style>
<div className="cf-qad__band" aria-hidden="true">
{sceneImage ? <img className="cf-qad__scene" src={sceneImage} alt="" loading="lazy" decoding="async" /> : null}
<div className="cf-qad__scrim" />
</div>
<div className="cf-qad__inner">
{hasQuestion ? <h2 className="cf-qad__q">{question}</h2> : null}
{hasAnswer ? (
<div className="cf-qad__answer-wrap" ref={wrapRef}>
<div className="cf-qad__fit" style={fitStyle}>
<p className="cf-qad__a">{answerText}</p>
<span className="cf-qad__measure" ref={measureRef} aria-hidden="true">
{answerText}
</span>
</div>
</div>
) : null}
{hasRow ? (
<div className="cf-qad__row">
{hasSentence || list.length > 0 ? (
<div className="cf-qad__copy">
{hasSentence ? <p className="cf-qad__sentence">{sentence}</p> : null}
{list.length > 0 ? (
<ul className="cf-qad__points">
{list.map((p, i) => (
<li className="cf-qad__point" key={`${i}-${p}`}>
<Check size={16} strokeWidth={2.5} aria-hidden="true" />
{p}
</li>
))}
</ul>
) : null}
</div>
) : null}
{hasProduct ? (
<div className="cf-qad__product">
<img src={productImage} alt={productAlt} width={768} height={768} loading="lazy" decoding="async" />
</div>
) : null}
</div>
) : null}
</div>
</section>
);
}
export default QuestionAnswerDrop;
const useIsoLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
// The dimmed question moves its colour halfway toward the band in OKLCH (no opacity on text), which keeps it near
// 4.5:1 on both tones. The answer's padding covers the face's ascent/descent so its glyph box never collides with
// the question above or the sentence below, whatever display face the theme loads.
const CSS_TEXT = `
.cf-qad {
--qad-gutter: clamp(16px, 5vw, 48px);
--qad-pad-top: clamp(56px, 8vw, 112px);
--qad-pad-bottom: clamp(64px, 8.5vw, 120px);
--qad-overhang: 0px;
--qad-q-size: clamp(2.5rem, 5.4vw, 4.875rem);
--qad-ground: var(--band, oklch(0.27 0.067 256));
--qad-text: var(--band-ink, oklch(1 0 0));
--qad-chip: color-mix(in oklab, var(--qad-text) 12%, var(--qad-ground));
--qad-dim-ink: color-mix(in oklab, var(--qad-text) 56%, var(--qad-ground));
position: relative;
isolation: isolate;
overflow-x: hidden;
overflow-x: clip;
box-sizing: border-box;
padding: var(--qad-pad-top) var(--qad-gutter) var(--qad-pad-bottom);
background-color: var(--qad-ground);
background-clip: padding-box;
color: var(--qad-text);
font-family: var(--font-body, system-ui, sans-serif);
}
.cf-qad *, .cf-qad *::before, .cf-qad *::after { box-sizing: border-box; }
.cf-qad[data-tone='light'] {
--qad-ground: var(--surface, oklch(1 0 0));
--qad-text: var(--ink, oklch(0.21 0.034 263));
--qad-chip: color-mix(in oklch, var(--ink, oklch(0.21 0.034 263)) 7%, var(--surface, oklch(1 0 0)));
}
/* The overhang is a transparent bottom border: the section's own ground stops above it (background-clip) and the
inner column extends into it, so the product still hangs past the band's lower edge with identical boxes. */
.cf-qad[data-product='true'] {
--qad-overhang: clamp(56px, 7vw, 96px);
padding-bottom: 0;
border-bottom: var(--qad-overhang) solid transparent;
}
.cf-qad[data-product='true'] .cf-qad__inner { margin-block-end: calc(-1 * var(--qad-overhang)); }
.cf-qad__band {
position: absolute;
inset: 0;
z-index: -1;
overflow: hidden;
background: var(--qad-ground);
}
.cf-qad__scene {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
object-position: 50% 40%;
filter: grayscale(1);
mix-blend-mode: luminosity;
}
.cf-qad__scrim {
position: absolute;
inset: 0;
background: color-mix(in oklch, var(--qad-ground) 86%, transparent);
}
.cf-qad__inner {
position: relative;
max-inline-size: 1120px;
margin-inline: auto;
min-width: 0;
}
.cf-qad__q {
margin: 0;
font-family: var(--font-display, inherit);
font-weight: var(--display-weight, 800);
letter-spacing: var(--display-tracking, -0.025em);
text-transform: var(--display-case, none);
font-size: var(--qad-q-size);
line-height: 1.04;
color: var(--qad-text);
text-wrap: balance;
overflow-wrap: break-word;
transition: color 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s;
}
.cf-qad[data-phase='landed'][data-dim='true'] .cf-qad__q { color: var(--qad-dim-ink); }
.cf-qad__answer-wrap {
container-type: inline-size;
min-width: 0;
margin-block-start: 16px;
}
.cf-qad__fit {
--qad-oa: calc((var(--qad-c, 1.1) - 1.1) / 2);
--qad-oh: calc((var(--qad-c, 1.04) - 1.04) / 2);
position: relative;
min-width: 0;
overflow-x: clip;
font-family: var(--font-display, inherit);
font-weight: var(--display-weight, 800);
letter-spacing: var(--display-tracking, -0.025em);
text-transform: var(--display-case, none);
font-size: clamp(3rem, 18vw, 24rem);
line-height: 1.1;
padding-block: max(0.17em, calc(var(--qad-oa) * 1em + var(--qad-oh) * var(--qad-q-size) - 2px)) 0.17em;
}
@supports (font-size: 1cqi) {
.cf-qad__fit { font-size: clamp(3rem, var(--qad-size, calc(100cqi / (var(--qad-chars, 4) * 0.62))), 24rem); }
}
@supports (font-size: 1cqi) and (height: 1svh) {
.cf-qad__fit { font-size: clamp(3rem, var(--qad-size, calc(100cqi / (var(--qad-chars, 4) * 0.62))), min(46svh, 24rem)); }
}
.cf-qad__a {
display: block;
margin: 0;
font: inherit;
letter-spacing: inherit;
color: var(--qad-text);
overflow-wrap: anywhere;
text-wrap: balance;
transition: transform 0.72s cubic-bezier(0.22, 1.18, 0.36, 1), opacity 0.32s ease-out;
}
.cf-qad[data-phase='armed'] .cf-qad__a {
opacity: 0;
transform: translateY(-0.3em);
}
.cf-qad__measure {
position: absolute;
inset-block-start: 0;
inset-inline-start: 0;
display: block;
font-family: var(--font-display, inherit);
font-weight: var(--display-weight, 800);
letter-spacing: var(--display-tracking, -0.025em);
text-transform: var(--display-case, none);
font-size: 100px;
line-height: 1;
white-space: nowrap;
visibility: hidden;
pointer-events: none;
}
.cf-qad__row {
display: grid;
grid-template-columns: minmax(0, 1fr);
gap: 32px;
margin-block-start: clamp(24px, 3vw, 32px);
transition: opacity 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) 0.28s, transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) 0.28s;
}
.cf-qad[data-phase='armed'] .cf-qad__row {
opacity: 0.82;
transform: translateY(8px);
}
.cf-qad__copy { min-width: 0; align-self: start; }
.cf-qad__sentence {
margin: 0;
max-inline-size: 38ch;
font-size: clamp(1.3125rem, 1.8vw, 1.625rem);
line-height: 1.3;
font-weight: 600;
color: var(--qad-text);
text-wrap: pretty;
overflow-wrap: break-word;
}
.cf-qad__points {
list-style: none;
margin: clamp(16px, 2vw, 24px) 0 0;
padding: 0;
display: flex;
flex-wrap: wrap;
gap: 8px 12px;
}
.cf-qad__point {
min-width: 0;
max-inline-size: 100%;
min-block-size: 32px;
padding: 6px 14px 6px 12px;
border-radius: 999px;
background: var(--qad-chip);
color: var(--qad-text);
font-size: 0.875rem;
font-weight: 800;
line-height: 1.4;
text-wrap: pretty;
overflow-wrap: break-word;
}
.cf-qad__point svg {
display: inline-block;
width: 16px;
height: 16px;
vertical-align: -0.2em;
margin-inline-end: 0.4em;
}
.cf-qad__product {
position: relative;
z-index: 1;
min-width: 0;
align-self: end;
justify-self: start;
inline-size: min(100%, 16rem);
}
.cf-qad__product img {
display: block;
inline-size: 100%;
block-size: auto;
aspect-ratio: 1 / 1;
object-fit: contain;
border-radius: 0;
filter: drop-shadow(0 2px 3px oklch(from var(--shadow, oklch(0.22 0.03 256)) l c h / 0.35)) drop-shadow(0 14px 16px oklch(from var(--shadow, oklch(0.22 0.03 256)) l c h / 0.28));
transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
.cf-qad__product:hover img { transform: translateY(-4px); }
}
@media (min-width: 768px) {
.cf-qad[data-product='true'] .cf-qad__row {
grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
gap: clamp(32px, 5vw, 72px);
}
.cf-qad[data-product='true'] .cf-qad__copy {
padding-block-end: calc(var(--qad-overhang) + var(--qad-pad-bottom));
}
.cf-qad__product {
justify-self: end;
inline-size: min(100%, 24rem);
}
}
@media (prefers-reduced-motion: reduce) {
.cf-qad__q, .cf-qad__a, .cf-qad__row, .cf-qad__product img { transition: none; }
.cf-qad[data-phase='armed'] .cf-qad__a,
.cf-qad[data-phase='armed'] .cf-qad__row { opacity: 1; transform: none; }
}
`;
pieces/content/question-answer-drop/specimen.tsx 27 lines
import __studioImage3349aa17 from "../assets/ebb7046cfb7b5444.webp";
import __studioImageab037543 from "../assets/6d68b34fc7194d17.webp";
// Specimen: Loft & Lumen watercolour course (fictional). The block owns its band; no wrapper.
import { QuestionAnswerDrop } from '../question-answer-drop';
import { slot } from '../../slots';
export const states = ['default'];
export default function QuestionAnswerDropSpecimen(_props: { state?: string }) {
return (
<QuestionAnswerDrop
question="Can you really learn to paint in 20 minutes a day?"
answer="Yes."
sentence="Every Loft & Lumen lesson is one small painting, start to finish, in a single sitting."
points={['One painting per lesson', 'A 12-colour starter tin', 'Paint at your kitchen table']}
sceneImage={slot(
'scene',
__studioImage3349aa17
)}
productImage={slot(
'product',
__studioImageab037543
)}
productAlt="Loft & Lumen 12-colour watercolour starter tin with a round brush"
/>
);
}
| Name | Type | Details |
|---|---|---|
question OptionalQuestionAnswerDrop |
React.ReactNode |
Default 'Can you really do this, even if you’re starting from zero?'
|
answer OptionalQuestionAnswerDrop |
string |
Default 'Yes.'
|
sentence OptionalQuestionAnswerDrop |
React.ReactNode |
Default 'Keep reading. Here’s exactly how it works.'
|
points OptionalQuestionAnswerDrop |
string[] |
Default []
|
sceneImage OptionalQuestionAnswerDrop |
string |
|
productImage OptionalQuestionAnswerDrop |
string |
|
productAlt OptionalQuestionAnswerDrop |
string |
Default ''
|
tone OptionalQuestionAnswerDrop |
'dark' | 'light' |
Default 'dark'
|
revealed OptionalQuestionAnswerDrop |
boolean |
Default false
|
className OptionalQuestionAnswerDrop |
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.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
product- The main product shot or cover (ebook, kit, bottle).
scene- A wide atmosphere photo behind or beside the copy.
-
6d68b34fc7194d17.webp
image/webp · 64.7 KB
-
ebb7046cfb7b5444.webp
image/webp · 58.2 KB