Unlock Quiz 1
Unlock quiz: a soft offer gate. One tap on an answer reveals the supplied code, price ledger and action in place, so the visitor says a small yes before the ask.
Use it in a prompt
Use forms/unlock-quiz 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/forms/unlock-quiz.tsx. - Import it and pass your copy and images (Props tab):
import { UnlockQuiz } from "@/components/funneldna/forms/unlock-quiz"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/forms/unlock-quiz/component.tsx 828 lines
// layout: advertorial-front
// Unlock quiz: a soft offer gate. One tap on an answer reveals the supplied code, price ledger and action in place, so the visitor says a small yes before the ask.
import React from "react";
import { AlertCircle, Check, Copy, Gift, ShieldCheck, Star, X } from "lucide-react";
import { FX_HOST, Glow } from "../fx/fx";
export type UnlockQuizLine = { label: string; value: string };
export type UnlockQuizProps = {
/** Small masthead line, e.g. "A little gift from Hushline". */
fromLine?: string;
headline?: React.ReactNode;
lead?: React.ReactNode;
/** The one question, set as a red sales-letter subhead. */
question?: string;
/** Four answers fit the 2x2 grid; any answer unlocks the reward. */
answers?: string[];
/** Image slot "scene": a moody photo beside the question. */
sceneImage?: string;
sceneAlt?: string;
/** Proof line under the photo. Supplied facts only; empty hides it. */
rating?: string;
rewardHeadline?: React.ReactNode;
/** Risk reversal that leads the reward, set as a red subhead. */
rewardSubhead?: string;
rewardText?: React.ReactNode;
/** Supplied discount code; empty hides the code row. */
code?: string;
codeLabel?: string;
copyLabel?: string;
copiedLabel?: string;
/** Shown when the browser blocks copying; the code is selected instead. */
copyErrorLabel?: string;
/** Itemised value lines above today's price. */
ledger?: UnlockQuizLine[];
priceLabel?: string;
price?: string;
priceNote?: string;
/** Button label; the placeholder {price} is replaced with the price. */
ctaLabel?: string;
reassurance?: string;
href?: string;
/** Called with the chosen answer when the action is clicked. */
onAction?: (answer: string) => void;
/** Called once when an answer is chosen. */
onAnswer?: (answer: string) => void;
/** "dialog" renders a modal shell with a scrim; Escape, the scrim and the close button call onClose. */
variant?: "inline" | "dialog";
open?: boolean;
/** Providing it shows the close button. */
onClose?: () => void;
closeLabel?: string;
state?: "default" | "hover" | "success";
className?: string;
};
export function UnlockQuiz(props: UnlockQuizProps) {
const {
fromLine = "A little gift for you",
headline = "Want a mystery discount?",
lead = "Answer one quick question to unlock your discount.",
question = "What brings you here today?",
answers = ["Just looking", "Comparing options", "Ready to start", "Buying a gift"],
sceneImage = "",
sceneAlt = "",
rating = "",
rewardHeadline = "Your discount is unlocked",
rewardSubhead = "Try it risk free",
rewardText = "",
code = "",
codeLabel = "Your code",
copyLabel = "Copy",
copiedLabel = "Copied",
copyErrorLabel = "Copying was blocked, so the code is selected for you.",
ledger = [],
priceLabel = "Today",
price = "",
priceNote = "",
ctaLabel = "Claim my discount",
reassurance = "",
href,
onAction,
onAnswer,
variant = "inline",
open = true,
onClose,
closeLabel = "Close",
state = "default",
className = "",
} = props;
const uid = React.useId();
const titleId = `${uid}-title`;
const groupName = `${uid}-answer`;
const isDialog = variant === "dialog";
const [picked, setPicked] = React.useState<string | null>(state === "success" ? answers[0] ?? null : null);
const [revealed, setRevealed] = React.useState(state === "success");
const [copyState, setCopyState] = React.useState<"idle" | "copied" | "error">("idle");
const timers = React.useRef<number[]>([]);
const focusTitle = React.useRef(false);
const titleRef = React.useRef<HTMLHeadingElement>(null);
const codeRef = React.useRef<HTMLSpanElement>(null);
const closeRef = React.useRef<HTMLButtonElement>(null);
const closeFn = React.useRef(onClose);
closeFn.current = onClose;
const later = (fn: () => void, ms: number) => {
timers.current.push(window.setTimeout(fn, ms));
};
React.useEffect(
() => () => {
timers.current.forEach((id) => window.clearTimeout(id));
timers.current = [];
},
[]
);
React.useEffect(() => {
setRevealed(state === "success");
setPicked(state === "success" ? answers[0] ?? null : null);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [state]);
React.useEffect(() => {
if (revealed && focusTitle.current) {
focusTitle.current = false;
titleRef.current?.focus();
}
}, [revealed]);
React.useEffect(() => {
if (!isDialog || !open) return;
closeRef.current?.focus();
const onKey = (event: KeyboardEvent) => {
if (event.key === "Escape" && closeFn.current) {
event.stopPropagation();
closeFn.current();
}
};
document.addEventListener("keydown", onKey);
return () => document.removeEventListener("keydown", onKey);
}, [isDialog, open]);
if (isDialog && !open) return null;
const choose = (answer: string) => {
if (picked !== null || revealed) return;
setPicked(answer);
onAnswer?.(answer);
const still = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
later(() => {
focusTitle.current = true;
setRevealed(true);
}, still ? 0 : 360);
};
const copy = async () => {
try {
if (!navigator.clipboard) throw new Error("clipboard unavailable");
await navigator.clipboard.writeText(code);
setCopyState("copied");
} catch {
const node = codeRef.current;
const selection = window.getSelection();
if (node && selection) {
const range = document.createRange();
range.selectNodeContents(node);
selection.removeAllRanges();
selection.addRange(range);
}
setCopyState("error");
}
later(() => setCopyState("idle"), 2400);
};
const ctaText = ctaLabel.split("{price}").join(price);
const act = () => onAction?.(picked ?? "");
const cta = href ? (
<a className="cf-uq__cta" href={href} onClick={act}>
{ctaText}
</a>
) : (
<button type="button" className="cf-uq__cta" onClick={act}>
{ctaText}
</button>
);
const ask = (
<div className="cf-uq__ask">
<h2 id={titleId} className="cf-uq__title">
{headline}
</h2>
{lead ? <p className="cf-uq__lead">{lead}</p> : null}
<fieldset className="cf-uq__set">
<legend className="cf-uq__sub">{question}</legend>
<div className="cf-uq__chips">
{answers.map((answer, i) => {
const isPicked = picked === answer;
const forced = state === "hover" && i === 0 ? " is-hover" : "";
return (
<label key={answer} className={`cf-uq__chip${isPicked ? " is-picked" : ""}${forced}`}>
<input
className="cf-uq__radio"
type="radio"
name={groupName}
value={answer}
checked={isPicked}
disabled={picked !== null && !isPicked}
onChange={() => choose(answer)}
/>
<span className="cf-uq__dot" aria-hidden="true">
{isPicked ? <Check size={14} strokeWidth={3} /> : null}
</span>
<span className="cf-uq__answer">{answer}</span>
</label>
);
})}
</div>
</fieldset>
</div>
);
const reward = (
<div className="cf-uq__reward">
<h2 id={titleId} ref={titleRef} tabIndex={-1} className="cf-uq__title">
{rewardHeadline}
</h2>
{rewardSubhead ? <h3 className="cf-uq__sub">{rewardSubhead}</h3> : null}
{rewardText ? <p className="cf-uq__text">{rewardText}</p> : null}
{code ? (
<div className="cf-uq__codebox">
<p className="cf-uq__codelabel" id={`${uid}-code`}>
{codeLabel}
</p>
<div className="cf-uq__code">
<span ref={codeRef} className="cf-uq__codevalue" aria-describedby={`${uid}-code`}>
{code}
</span>
<button type="button" className={`cf-uq__copy${copyState === "copied" ? " is-copied" : ""}`} onClick={copy}>
{copyState === "copied" ? (
<Check size={18} strokeWidth={2.5} aria-hidden="true" />
) : (
<Copy size={18} strokeWidth={2.5} aria-hidden="true" />
)}
<span>{copyState === "copied" ? copiedLabel : copyLabel}</span>
</button>
</div>
{copyState === "error" ? (
<p className="cf-uq__note" role="status">
<AlertCircle className="cf-uq__inline" size={16} strokeWidth={2.5} aria-hidden="true" />
{copyErrorLabel}
</p>
) : null}
</div>
) : null}
{ledger.length || price ? (
<div className="cf-uq__ledger">
{ledger.length ? (
<ul className="cf-uq__lines">
{ledger.map((line) => (
<li key={line.label}>
<span>{line.label}</span>
<span className="cf-uq__val">{line.value}</span>
</li>
))}
</ul>
) : null}
{price ? (
<p className="cf-uq__today">
<span className="cf-uq__todaylabel">{priceLabel}</span>
<span className="cf-uq__price">
{price}
{priceNote ? <small>{priceNote}</small> : null}
</span>
</p>
) : null}
</div>
) : null}
{cta}
{reassurance ? (
<p className="cf-uq__reassure">
<ShieldCheck className="cf-uq__inline" size={16} strokeWidth={2.5} aria-hidden="true" />
{reassurance}
</p>
) : null}
<p className="cf-uq__sr" aria-live="polite">
{copyState === "copied" ? copiedLabel : ""}
</p>
</div>
);
const cardClass = ["cf-uq__card", sceneImage ? "" : "is-solo", isDialog ? "" : "cf-unlock-quiz", isDialog ? "" : className]
.filter(Boolean)
.join(" ");
const card = (
<div
className={cardClass}
style={FX_HOST}
role={isDialog ? "dialog" : undefined}
aria-modal={isDialog ? true : undefined}
aria-labelledby={isDialog ? titleId : undefined}
>
<Glow />
<div className="cf-uq__mast">
<p className="cf-uq__from">
<Gift className="cf-uq__inline" size={16} strokeWidth={2.5} aria-hidden="true" />
{fromLine}
</p>
{onClose ? (
<button ref={closeRef} type="button" className="cf-uq__close" aria-label={closeLabel} onClick={onClose}>
<X size={18} strokeWidth={2.5} aria-hidden="true" />
</button>
) : null}
</div>
<div className="cf-uq__body">
<div className="cf-uq__main">
{revealed ? reward : ask}
<div className="cf-uq__steps" aria-hidden="true">
<span className="is-on" />
<span className={revealed ? "is-on" : ""} />
</div>
</div>
{sceneImage ? (
<figure className="cf-uq__aside">
<div className="cf-uq__photo">
<img src={sceneImage} alt={sceneAlt} decoding="async" />
</div>
{rating ? (
<figcaption className="cf-uq__rating">
<Star className="cf-uq__inline cf-uq__star" size={16} strokeWidth={2.5} aria-hidden="true" />
{rating}
</figcaption>
) : null}
</figure>
) : null}
</div>
</div>
);
if (isDialog) {
return (
<div
className={["cf-unlock-quiz", "cf-uq__overlay", className].filter(Boolean).join(" ")}
onMouseDown={(event) => {
if (event.target === event.currentTarget) onClose?.();
}}
>
<style>{CSS}</style>
{card}
</div>
);
}
return (
<>
<style>{CSS}</style>
{card}
</>
);
}
export default UnlockQuiz;
const CSS = `
.cf-unlock-quiz {
--uq-ink: var(--band-ink, oklch(1 0 0));
--uq-bg: var(--band, oklch(0.27 0.067 256));
--uq-soft: color-mix(in oklch, var(--uq-ink) 80%, var(--uq-bg));
--uq-rule: oklch(from var(--uq-ink) l c h / 0.16);
--uq-chip: color-mix(in oklch, var(--uq-ink) 7%, var(--uq-bg));
--uq-chip-hover: color-mix(in oklch, var(--uq-ink) 13%, var(--uq-bg));
--uq-well: color-mix(in oklch, var(--uq-ink) 6%, var(--uq-bg));
--uq-red: var(--subhead-ink, color-mix(in oklab, var(--cta, oklch(0.58 0.21 29)) 62%, var(--uq-ink)));
--uq-shadow: var(--shadow, oklch(0.22 0.03 256));
font-family: var(--font-body, system-ui, sans-serif);
color: var(--uq-ink);
}
.cf-uq__card {
position: relative;
isolation: isolate;
overflow: hidden;
width: 100%;
max-width: 980px;
margin-inline: auto;
background: var(--uq-bg);
color: var(--uq-ink);
border: 1px solid var(--uq-rule);
border-radius: var(--card-radius, var(--radius, 14px));
box-shadow: var(--card-shadow, var(--shadow-lg, 0 2px 4px oklch(0.22 0.03 256 / 0.22), 0 12px 24px -8px oklch(0.22 0.03 256 / 0.32)));
text-align: left;
}
.cf-uq__mast {
position: relative;
z-index: 1;
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
min-height: 64px;
padding: 12px clamp(20px, 3vw, 32px);
border-bottom: 1px solid var(--uq-rule);
}
.cf-uq__from {
margin: 0;
font-size: 0.9375rem;
line-height: 1.4;
font-weight: 600;
color: var(--uq-soft);
text-wrap: pretty;
}
.cf-uq__inline {
display: inline-block;
vertical-align: -0.15em;
margin-inline-end: 0.4em;
flex: none;
}
.cf-uq__from .cf-uq__inline { color: var(--uq-red); }
.cf-uq__close {
flex: none;
display: inline-flex;
align-items: center;
justify-content: center;
width: 44px;
height: 44px;
margin-inline-end: -6px;
border-radius: 999px;
border: 1px solid var(--uq-rule);
background: var(--uq-chip);
color: var(--uq-ink);
cursor: pointer;
transition: background .16s ease, transform .16s ease;
}
.cf-uq__close:hover { background: var(--uq-chip-hover); }
.cf-uq__close:active { transform: scale(0.94); }
.cf-uq__close:focus-visible { outline: 2px solid var(--uq-ink); outline-offset: 2px; }
.cf-uq__body {
position: relative;
z-index: 1;
display: grid;
grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
align-items: stretch;
}
.cf-uq__card.is-solo .cf-uq__body { grid-template-columns: minmax(0, 1fr); }
.cf-uq__main {
display: flex;
flex-direction: column;
min-width: 0;
padding: clamp(28px, 3.4vw, 44px) clamp(20px, 3vw, 40px) clamp(24px, 3vw, 36px);
}
.cf-uq__aside {
margin: 0;
display: flex;
flex-direction: column;
gap: 12px;
min-width: 0;
padding: clamp(20px, 2.4vw, 28px) clamp(20px, 2.4vw, 28px) clamp(20px, 2.4vw, 28px) 0;
}
.cf-uq__photo {
position: relative;
flex: 1 1 auto;
min-height: 340px;
border-radius: 12px;
overflow: hidden;
background: var(--uq-well);
}
.cf-uq__photo::after {
content: "";
position: absolute;
inset: 0;
border-radius: inherit;
box-shadow: inset 0 0 0 1px oklch(from var(--uq-ink) l c h / 0.1);
pointer-events: none;
}
.cf-uq__photo img {
position: absolute;
inset: 0;
display: block;
width: 100%;
height: 100%;
object-fit: cover;
object-position: center 40%;
}
.cf-uq__rating {
margin: 0;
font-size: 0.9375rem;
line-height: 1.4;
font-weight: 600;
color: var(--uq-soft);
text-align: center;
text-wrap: pretty;
}
.cf-uq__star { color: var(--uq-red); fill: currentColor; }
.cf-uq__title {
margin: 0 0 14px;
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(2rem, 3.6vw, 3.25rem);
line-height: 1.06;
color: var(--uq-ink);
text-wrap: balance;
}
.cf-uq__title:focus { outline: none; }
.cf-uq__title:focus-visible { outline: 2px solid var(--uq-ink); outline-offset: 4px; border-radius: 4px; }
.cf-uq__lead {
margin: 0 0 28px;
font-size: clamp(1.125rem, 1.5vw, 1.375rem);
line-height: 1.4;
font-weight: 500;
color: var(--uq-soft);
text-wrap: pretty;
}
.cf-uq__sub {
display: block;
float: none;
width: 100%;
padding: 0;
margin: 0 0 16px;
font-family: var(--font-display, inherit);
font-weight: var(--display-weight, 800);
font-size: clamp(1.125rem, 1.5vw, 1.375rem);
line-height: 1.3;
letter-spacing: -0.01em;
color: var(--uq-red);
text-wrap: balance;
}
.cf-uq__set { margin: 0; padding: 0; border: 0; min-inline-size: 0; }
.cf-uq__chips {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px;
}
.cf-uq__chip {
position: relative;
display: flex;
align-items: center;
gap: 12px;
min-height: 60px;
padding: 12px 16px;
border-radius: var(--radius, 12px);
border: 1px solid var(--uq-rule);
background: var(--uq-chip);
color: var(--uq-ink);
font-size: 1.0625rem;
line-height: 1.25;
font-weight: 700;
text-align: left;
cursor: pointer;
user-select: none;
box-shadow: inset 0 1px 0 oklch(from var(--uq-ink) l c h / 0.06), 0 1px 2px oklch(from var(--uq-shadow) l c h / 0.28);
transition: background .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.cf-uq__answer { min-width: 0; text-wrap: pretty; }
.cf-uq__dot {
flex: none;
display: inline-grid;
place-items: center;
width: 22px;
height: 22px;
border-radius: 999px;
border: 2px solid oklch(from var(--uq-ink) l c h / 0.42);
color: var(--uq-bg);
transition: border-color .16s ease, background .16s ease;
}
.cf-uq__chip:hover, .cf-uq__chip.is-hover {
background: var(--uq-chip-hover);
border-color: oklch(from var(--uq-ink) l c h / 0.34);
transform: translateY(-1px);
box-shadow: inset 0 1px 0 oklch(from var(--uq-ink) l c h / 0.08), 0 1px 2px oklch(from var(--uq-shadow) l c h / 0.3), 0 6px 12px -6px oklch(from var(--uq-shadow) l c h / 0.45);
}
.cf-uq__chip:hover .cf-uq__dot, .cf-uq__chip.is-hover .cf-uq__dot { border-color: oklch(from var(--uq-ink) l c h / 0.8); }
.cf-uq__chip:active { transform: translateY(0) scale(0.985); }
.cf-uq__chip:has(.cf-uq__radio:focus-visible) { outline: 2px solid var(--uq-ink); outline-offset: 2px; }
.cf-uq__chip.is-picked {
background: color-mix(in oklab, var(--accent-fill, var(--accent, oklch(0.5 0.17 257))) 28%, var(--uq-bg));
border-color: oklch(from var(--uq-ink) l c h / 0.72);
transform: none;
}
.cf-uq__chip.is-picked .cf-uq__dot { background: var(--uq-ink); border-color: var(--uq-ink); }
.cf-uq__chip:has(.cf-uq__radio:disabled) {
cursor: default;
color: var(--uq-soft);
background: var(--uq-chip);
border-color: var(--uq-rule);
transform: none;
}
.cf-uq__chip:has(.cf-uq__radio:disabled) .cf-uq__dot { border-color: oklch(from var(--uq-ink) l c h / 0.22); }
.cf-uq__radio, .cf-uq__sr {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0 0 0 0);
white-space: nowrap;
border: 0;
}
.cf-uq__radio { opacity: 0; }
.cf-uq__reward .cf-uq__sub { margin-bottom: 8px; }
.cf-uq__text {
margin: 0 0 24px;
font-size: clamp(1.0625rem, 1.25vw, 1.125rem);
line-height: 1.5;
color: var(--uq-soft);
text-wrap: pretty;
}
.cf-uq__codebox { margin: 0 0 16px; }
.cf-uq__codelabel {
margin: 0 0 8px;
font-size: 0.9375rem;
line-height: 1.4;
font-weight: 600;
color: var(--uq-soft);
}
.cf-uq__code {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 8px 8px 8px 20px;
border-radius: var(--radius, 12px);
border: 1px solid var(--uq-rule);
background: var(--uq-well);
}
.cf-uq__codevalue {
min-width: 0;
overflow-wrap: anywhere;
font-family: var(--font-display, inherit);
font-weight: var(--display-weight, 800);
font-size: clamp(1.3125rem, 1.8vw, 1.625rem);
line-height: 1.15;
letter-spacing: 0.12em;
font-variant-numeric: tabular-nums;
color: var(--uq-ink);
user-select: all;
}
.cf-uq__copy {
flex: none;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
min-height: 48px;
padding: 0 18px;
border-radius: var(--button-radius, var(--radius, 12px));
border: 1px solid var(--button-2-border, transparent);
background: var(--button-2-bg, var(--secondary, oklch(0.93 0.015 263)));
color: var(--button-2-ink, var(--secondary-ink, oklch(0.21 0.034 263)));
box-shadow: var(--button-2-shadow, var(--shadow-sm, 0 1px 2px oklch(0.22 0.03 256 / 0.22)));
font-family: var(--button-font, var(--font-display, inherit));
font-weight: var(--button-weight, 800);
text-transform: var(--button-case, none);
font-size: 1rem;
line-height: 1.15;
cursor: pointer;
transition: background .16s ease, transform .16s ease;
}
.cf-uq__copy:hover { background: oklch(from var(--button-2-bg, var(--secondary, oklch(0.93 0.015 263))) calc(l - 0.04) c h); }
.cf-uq__copy:active { transform: translateY(1px); }
.cf-uq__copy:focus-visible { outline: 2px solid var(--uq-ink); outline-offset: 2px; }
.cf-uq__copy.is-copied svg { color: var(--success, oklch(0.5 0.14 150)); }
.cf-uq__note {
margin: 8px 0 0;
font-size: 0.9375rem;
line-height: 1.4;
font-weight: 600;
color: var(--uq-ink);
text-wrap: pretty;
}
.cf-uq__ledger {
margin: 0 0 20px;
padding: 16px 20px;
border-radius: 10px;
background: var(--uq-well);
}
.cf-uq__lines {
list-style: none;
margin: 0;
padding: 0;
display: grid;
gap: 8px;
}
.cf-uq__lines li {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 16px;
font-size: 1.0625rem;
line-height: 1.4;
color: var(--uq-soft);
}
.cf-uq__val {
flex: none;
font-weight: 700;
color: var(--uq-ink);
font-variant-numeric: tabular-nums;
}
.cf-uq__today {
display: flex;
flex-wrap: wrap;
align-items: baseline;
justify-content: space-between;
gap: 4px 16px;
margin: 16px 0 0;
}
.cf-uq__today:first-child { margin-top: 0; }
.cf-uq__todaylabel {
font-size: 1.0625rem;
line-height: 1.4;
font-weight: 700;
color: var(--uq-ink);
}
.cf-uq__price {
font-family: var(--font-display, inherit);
font-weight: var(--display-weight, 800);
font-size: clamp(2.5rem, 4.2vw, 3.75rem);
line-height: 1;
letter-spacing: -0.03em;
font-variant-numeric: tabular-nums;
color: var(--uq-ink);
}
.cf-uq__price small {
margin-inline-start: 4px;
font-family: var(--font-body, inherit);
font-size: 1.0625rem;
font-weight: 600;
letter-spacing: 0;
color: var(--uq-soft);
}
.cf-uq__cta {
display: flex;
width: 100%;
align-items: center;
justify-content: center;
min-height: 64px;
padding: 10px 28px;
border: 0;
border-radius: var(--button-radius, var(--radius, 12px));
background: linear-gradient(oklch(from var(--button-bg, var(--cta, oklch(0.58 0.21 29))) calc(l + 0.04) c h), oklch(from var(--button-bg-2, var(--cta-2, oklch(0.51 0.21 29))) calc(l - 0.02) c h));
color: var(--button-ink, var(--cta-ink, oklch(1 0 0)));
font-family: var(--button-font, var(--font-display, inherit));
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-wrap: balance;
text-decoration: none;
text-shadow: var(--button-text-shadow, none);
cursor: pointer;
box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--button-bg, var(--cta, oklch(0.58 0.21 29))) calc(l + 0.14) c h / 0.7), inset 0 -3px 0 oklch(from var(--button-bg, var(--cta, oklch(0.58 0.21 29))) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--uq-shadow) l c h / 0.4), 0 8px 16px -6px oklch(from var(--uq-shadow) l c h / 0.5));
transition: background .16s ease, transform .16s ease, box-shadow .16s ease;
}
.cf-uq__cta:hover {
background: linear-gradient(oklch(from var(--button-bg, var(--cta, oklch(0.58 0.21 29))) calc(l - 0.01) c h), oklch(from var(--button-bg-2, var(--cta-2, oklch(0.51 0.21 29))) calc(l - 0.07) c h));
}
.cf-uq__cta:active {
transform: translateY(1px);
box-shadow: inset 0 2px 3px oklch(from var(--uq-shadow) l c h / 0.35), inset 0 -2px 0 oklch(from var(--button-bg, var(--cta, oklch(0.58 0.21 29))) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--uq-shadow) l c h / 0.4);
}
.cf-uq__cta:focus-visible { outline: 3px solid var(--uq-ink); outline-offset: 3px; }
.cf-uq__reassure {
margin: 12px 0 0;
font-size: 0.9375rem;
line-height: 1.4;
font-weight: 600;
color: var(--uq-soft);
text-align: center;
text-wrap: pretty;
}
.cf-uq__steps {
display: flex;
gap: 6px;
margin-top: auto;
padding-top: 28px;
}
.cf-uq__steps span {
width: 22px;
height: 4px;
border-radius: 999px;
background: oklch(from var(--uq-ink) l c h / 0.22);
transition: width .3s cubic-bezier(.2,.7,.2,1), background .3s ease;
}
.cf-uq__steps span.is-on { width: 36px; background: var(--uq-ink); }
@keyframes cf-uq-rise { from { opacity: .82; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes cf-uq-pop { from { opacity: .82; transform: scale(.9); } to { opacity: 1; transform: none; } }
.cf-uq__reward > * { animation: cf-uq-rise .45s cubic-bezier(.2,.7,.2,1) both; }
.cf-uq__reward > :nth-child(2) { animation-delay: .07s; }
.cf-uq__reward > :nth-child(3) { animation-delay: .14s; }
.cf-uq__reward > :nth-child(4) { animation-delay: .21s; }
.cf-uq__reward > :nth-child(n+5) { animation-delay: .28s; }
.cf-uq__chip.is-picked .cf-uq__dot { animation: cf-uq-pop .3s cubic-bezier(.2,.7,.2,1) both; }
.cf-uq__overlay {
position: fixed;
inset: 0;
z-index: 60;
display: grid;
place-items: center;
overflow-y: auto;
padding: clamp(16px, 5vw, 48px);
background: oklch(from var(--band, oklch(0.27 0.067 256)) calc(l - 0.1) c h / 0.72);
}
.cf-uq__overlay .cf-uq__card { animation: cf-uq-rise .3s cubic-bezier(.2,.7,.2,1) both; }
@media (max-width: 760px) {
.cf-uq__body { grid-template-columns: minmax(0, 1fr); }
.cf-uq__aside { order: -1; gap: 8px; padding: 16px 16px 0; }
.cf-uq__photo { flex: none; min-height: 0; height: 156px; }
.cf-uq__photo img { object-position: center 45%; }
.cf-uq__main { padding: 22px 18px 24px; }
.cf-uq__mast { min-height: 60px; padding: 8px 12px 8px 18px; }
.cf-uq__lead { margin-bottom: 22px; }
.cf-uq__chips { grid-template-columns: minmax(0, 1fr); gap: 10px; }
.cf-uq__chip { min-height: 56px; padding-inline: 16px; }
.cf-uq__code { padding-left: 16px; }
.cf-uq__ledger { padding: 14px 16px; }
.cf-uq__steps { padding-top: 22px; }
}
@media (prefers-reduced-motion: reduce) {
.cf-unlock-quiz, .cf-unlock-quiz * { animation: none; transition: none; }
.cf-uq__reward > *, .cf-uq__chip.is-picked .cf-uq__dot, .cf-uq__overlay .cf-uq__card { animation: none; }
.cf-uq__chip:hover, .cf-uq__chip.is-hover, .cf-uq__chip:active, .cf-uq__cta:active { transform: none; }
}
`;
pieces/forms/unlock-quiz/specimen.tsx 44 lines
import __studioImage8a10b94c from "../assets/91184a088a9b5f69.webp";
import React from "react";
import { UnlockQuiz } from "../unlock-quiz";
import { slot } from "../../slots";
export const states = ["default", "hover", "success"];
type QuizState = "default" | "hover" | "success";
export default function UnlockQuizSpecimen({ state = "default" }: { state?: string }) {
const current: QuizState = state === "hover" || state === "success" ? state : "default";
return (
<UnlockQuiz
key={current}
state={current}
fromLine="A little gift from Hushline"
headline="Want a mystery discount?"
lead="Answer one quick question to unlock up to 40% off Hushline Pro."
question="How often does your phone pull you off task?"
answers={["All day long", "A few times an hour", "Now and then", "Hardly ever"]}
sceneImage={slot(
"scene",
__studioImage8a10b94c
)}
sceneAlt="A phone lying face-down on a quiet desk in a beam of evening light"
rating="Rated 4.8 by 3,200 Hushline members"
rewardHeadline="You unlocked 40% off Hushline Pro"
rewardSubhead="Try it for 30 days, risk free"
rewardText="Block the apps that eat your mornings. If Hushline doesn't give you back real focus time within 30 days, we refund every cent."
code="QUIET40"
codeLabel="Your discount code"
ledger={[
{ label: "Hushline Pro, 12 months", value: "$79.99" },
{ label: "Your quiz discount (40%)", value: "−$32.00" },
]}
priceLabel="Your first year today"
price="$47.99"
priceNote="/year"
ctaLabel="Start my 30 days · {price}"
reassurance="Code applies at checkout · Cancel anytime"
onClose={() => {}}
/>
);
}
| Name | Type | Details |
|---|---|---|
fromLine OptionalUnlockQuiz |
string |
|
headline OptionalUnlockQuiz |
React.ReactNode |
|
lead OptionalUnlockQuiz |
React.ReactNode |
|
question OptionalUnlockQuiz |
string |
|
answers OptionalUnlockQuiz |
string[] |
|
sceneImage OptionalUnlockQuiz |
string |
|
sceneAlt OptionalUnlockQuiz |
string |
|
rating OptionalUnlockQuiz |
string |
|
rewardHeadline OptionalUnlockQuiz |
React.ReactNode |
|
rewardSubhead OptionalUnlockQuiz |
string |
|
rewardText OptionalUnlockQuiz |
React.ReactNode |
|
code OptionalUnlockQuiz |
string |
|
codeLabel OptionalUnlockQuiz |
string |
|
copyLabel OptionalUnlockQuiz |
string |
|
copiedLabel OptionalUnlockQuiz |
string |
|
copyErrorLabel OptionalUnlockQuiz |
string |
|
ledger OptionalUnlockQuiz |
UnlockQuizLine[] |
|
priceLabel OptionalUnlockQuiz |
string |
|
price OptionalUnlockQuiz |
string |
|
priceNote OptionalUnlockQuiz |
string |
|
ctaLabel OptionalUnlockQuiz |
string |
|
reassurance OptionalUnlockQuiz |
string |
|
href OptionalUnlockQuiz |
string |
|
onAction OptionalUnlockQuiz |
(answer: string) => void |
|
onAnswer OptionalUnlockQuiz |
(answer: string) => void |
|
variant OptionalUnlockQuiz |
"inline" | "dialog" |
|
open OptionalUnlockQuiz |
boolean |
|
onClose OptionalUnlockQuiz |
() => void |
|
closeLabel OptionalUnlockQuiz |
string |
|
state OptionalUnlockQuiz |
"default" | "hover" | "success" |
|
className OptionalUnlockQuiz |
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-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.
scene- A wide atmosphere photo behind or beside the copy.
-
91184a088a9b5f69.webp
image/webp · 38.3 KB