Quiz Start 1
Gets visitors to start a quiz by promising a quick, free result and opening on one easy first question.
Use it in a prompt
Use forms/quiz-start 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/quiz-start.tsx. - Import it and pass your copy and images (Props tab):
import { QuizStart } from "@/components/funneldna/forms/quiz-start"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/forms/quiz-start/component.tsx 548 lines
// Gets visitors to start a quiz by promising a quick, free result and opening on one easy first question.
"use client"
import { useEffect, useId, useRef, useState, type CSSProperties, type FormEvent, type ReactNode } from "react"
import { AlertCircle, Check, ChevronRight, ListChecks, Loader2, MousePointerClick, Sparkles, Timer, Trophy } from "lucide-react"
export type QuizStartProps = {
/** Templates accept {count}, {unit}, {title}, {detail} and {current} as text. */
copy?: Partial<typeof defaultCopy>
/** scene slot; takes precedence over image. */
sceneImage?: string
/** Validated first answer; takes precedence over onStart. A returned promise shows the loading label. */
onSubmit?: (answer: string) => void | Promise<void>
/** Called with the answer after onSubmit settles (e.g. go to question 2); takes precedence over onContinue. */
onAction?: (answer: string) => void
/** The big promise. Keep the time promise in it. */
headline?: string
/** One continuous phrase inside the headline that gets the marker stroke. */
highlight?: string
lead?: string
/** Optional photo (src) shown above the find-out list on wide screens. Layout media only, never proof. */
image?: string
imageAlt?: string
/** Short caption shown under the photo. */
photoCaption?: string
findOutTitle?: string
/** What the visitor finds out by taking the quiz (3 is ideal). */
findOut?: string[]
/** The real number of questions in the quiz. Drives the meta row and the progress bar. */
questionCount?: number
durationLabel?: string
timerValue?: string
timerUnit?: string
resultLabel?: string
/** The first question, shown open so starting feels instant. */
question?: string
choices?: QuizChoice[]
/** One short instruction under the question. */
nudge?: string
ctaLabel?: string
loadingLabel?: string
reassurance?: string
errorText?: string
/** @deprecated No longer rendered: the builder wires what happens after submit. */
successTitle?: string
/** @deprecated No longer rendered: the builder wires what happens after submit. */
successText?: string
/** @deprecated No longer rendered: the builder wires what happens after submit. */
nextLabel?: string
/** @deprecated No longer rendered: the builder wires what happens after submit. */
nextQuestion?: string
/** @deprecated No longer rendered: the builder wires what happens after submit. */
continueLabel?: string
/** @deprecated No longer rendered: the builder wires what happens after submit. */
changeLabel?: string
disabled?: boolean
disabledText?: string
/** "success" is accepted for older callers and renders as default. */
state?: QuizStartState
/** Legacy alias for onSubmit. */
onStart?: (answer: string) => void | Promise<void>
/** Legacy alias for onAction. */
onContinue?: (answer: string) => void
className?: string
}
export function QuizStart({
copy: copyOverrides,
sceneImage,
onSubmit,
onAction,
headline = "Find your first funnel in 60 seconds",
highlight = "60 seconds",
lead = "Answer a few quick questions about your offer and see which funnel to build first, plus the pages it needs.",
image,
imageAlt = "",
photoCaption = "Your free funnel plan in 60 seconds",
findOutTitle = "In 60 seconds, you’ll find out:",
findOut = DEFAULT_FIND_OUT,
questionCount = 5,
durationLabel = "60 seconds",
timerValue = "60",
timerUnit = "sec",
resultLabel = "Free result",
question = "What are you selling first?",
choices = DEFAULT_CHOICES,
nudge = "Tap an answer to begin",
ctaLabel = "Start My Free Quiz",
loadingLabel = "Starting your quiz…",
reassurance = "100% free · Takes about 60 seconds",
errorText = "Pick an answer above to start your quiz.",
disabled = false,
disabledText = "This quiz isn’t taking new answers right now.",
state = "default",
onStart,
onContinue,
className = "",
}: QuizStartProps) {
const copy = { ...defaultCopy, ...copyOverrides }
const submitAnswer = onSubmit === undefined ? onStart : onSubmit
const continueAnswer = onAction === undefined ? onContinue : onAction
const photo = sceneImage === undefined ? image : sceneImage
const uid = useId().replace(/:/g, "")
const titleId = `qs-title-${uid}`
const qId = `qs-q-${uid}`
const errId = `qs-err-${uid}`
const count = Math.max(1, Math.round(questionCount))
const isDisabled = disabled || state === "disabled"
const preset = state === "active" ? choices[0]?.value ?? "" : ""
const [answer, setAnswer] = useState(preset)
const [phase, setPhase] = useState<"idle" | "loading">("idle")
const [error, setError] = useState(state === "error")
const firstRadio = useRef<HTMLInputElement>(null)
const mounted = useRef(true)
useEffect(() => {
setAnswer(state === "active" ? choices[0]?.value ?? "" : "")
setPhase("idle")
setError(state === "error")
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [state])
useEffect(() => {
mounted.current = true
return () => {
mounted.current = false
}
}, [])
async function submit(event: FormEvent<HTMLFormElement>) {
event.preventDefault()
if (isDisabled || phase === "loading") return
if (!answer) {
setError(true)
firstRadio.current?.focus()
return
}
setError(false)
try {
const result = submitAnswer?.(answer)
if (result) {
setPhase("loading")
await result
}
continueAnswer?.(answer)
} catch {
// No failure UI in this piece; the caller reports errors.
} finally {
if (mounted.current) setPhase("idle")
}
}
const forced = state === "hover" ? " is-hover" : state === "active" ? " is-active" : ""
const meta: { key: string; icon: ReactNode; text: string }[] = [
{ key: "count", icon: <ListChecks aria-hidden="true" />, text: text(copy.questionCount, { count, unit: count === 1 ? copy.questionSingular : copy.questionPlural }) },
]
if (durationLabel) meta.push({ key: "time", icon: <Timer aria-hidden="true" />, text: durationLabel })
if (resultLabel) meta.push({ key: "result", icon: <Trophy aria-hidden="true" />, text: resultLabel })
const live = phase === "loading" ? loadingLabel : ""
return (
<section className={`cf-quiz-start qs ${className}`.trim()} aria-labelledby={titleId} data-disabled={isDisabled || undefined}>
<style dangerouslySetInnerHTML={{ __html: CSS }} />
<p className="qs-sr" aria-live="polite">{live}</p>
<header className="qs-head">
<svg className="qs-rings" viewBox="0 0 540 540" aria-hidden="true" focusable="false">
{[90, 140, 190, 240, 266].map((r) => (
<circle key={r} cx="270" cy="270" r={r} fill="none" stroke="currentColor" strokeWidth={r === 190 ? 2.5 : 1.25} />
))}
</svg>
<div className="qs-head-copy">
<h2 id={titleId} className="qs-title">
<Headline text={headline} mark={highlight} />
</h2>
{lead ? <p className="qs-lead">{lead}</p> : null}
<ul className="qs-meta" aria-label={copy.details}>
{meta.map((m) => (
<li key={m.key}>
{m.icon}
<span>{m.text}</span>
</li>
))}
</ul>
</div>
<div className="qs-watch-wrap">
<Stopwatch value={timerValue} unit={timerUnit} />
</div>
</header>
<div className="qs-body">
{findOut.length > 0 || photo ? (
<div className="qs-find">
{photo ? (
<figure className="qs-photo">
<span className="qs-photo-frame">
<img src={photo} alt={imageAlt} width={800} height={600} loading="lazy" decoding="async" />
</span>
{photoCaption ? (
<figcaption className="qs-photo-cap">
<Sparkles aria-hidden="true" />
<span>{photoCaption}</span>
</figcaption>
) : null}
</figure>
) : null}
{findOut.length > 0 ? (
<>
<h3 className="qs-find-title">{findOutTitle}</h3>
<ul className="qs-find-list">
{findOut.map((item) => (
<li key={item}>
<span className="qs-tick" aria-hidden="true">
<Check strokeWidth={3.25} />
</span>
<span>{item}</span>
</li>
))}
</ul>
</>
) : null}
</div>
) : null}
<div className="qs-panel" data-phase={phase}>
<div className="qs-progress">
<p className="qs-step">{text(copy.progress, { current: 1, count })}</p>
<Segments count={count} done={0} />
</div>
<form className="qs-form" onSubmit={submit} noValidate>
<h3 id={qId} className="qs-question">{question}</h3>
{nudge && !isDisabled ? (
<p className="qs-nudge">
<MousePointerClick aria-hidden="true" />
<span>{nudge}</span>
</p>
) : null}
<div
className="qs-choices"
role="radiogroup"
aria-labelledby={qId}
aria-describedby={error && !isDisabled ? errId : undefined}
aria-invalid={(error && !isDisabled) || undefined}
data-invalid={(error && !isDisabled) || undefined}
>
{choices.map((choice, i) => {
const checked = answer === choice.value
return (
<label key={choice.value} className="qs-choice" data-checked={checked || undefined} style={{ "--i": i } as CSSProperties}>
<input
ref={i === 0 ? firstRadio : undefined}
type="radio"
name={`qs-${uid}`}
value={choice.value}
checked={checked}
disabled={isDisabled || phase === "loading"}
onChange={() => {
setAnswer(choice.value)
setError(false)
}}
/>
<span className="qs-key" aria-hidden="true">{checked ? <Check strokeWidth={3.25} /> : KEYS[i] ?? String(i + 1)}</span>
<span className="qs-choice-text">
<span className="qs-choice-label">{choice.label}</span>
{choice.hint ? <span className="qs-choice-hint">{choice.hint}</span> : null}
</span>
<ChevronRight className="qs-chev" aria-hidden="true" />
</label>
)
})}
</div>
{error && !isDisabled ? (
<p id={errId} className="qs-error" role="alert">
<AlertCircle aria-hidden="true" />
<span>{errorText}</span>
</p>
) : null}
{isDisabled ? <p className="qs-closed">{disabledText}</p> : null}
<button
type="submit"
className={`qs-cta${forced}`}
disabled={isDisabled}
aria-busy={phase === "loading" || undefined}
data-loading={phase === "loading" || undefined}
data-ready={answer && phase === "idle" && !isDisabled ? true : undefined}
>
<span className="qs-cta-label">{phase === "loading" ? loadingLabel : ctaLabel}</span>
{phase === "loading" ? <span className="qs-cta-icon" aria-hidden="true"><Loader2 className="qs-spin" /></span> : null}
</button>
{reassurance ? <p className="qs-reassure">{reassurance}</p> : null}
</form>
</div>
</div>
</section>
)
}
export type QuizChoice = { value: string; label: string; hint?: string }
/** "success" is accepted for older callers and renders as default. */
export type QuizStartState = "default" | "hover" | "active" | "disabled" | "error" | "success"
const DEFAULT_FIND_OUT = [
"Which funnel fits the offer you have right now",
"The pages that funnel needs, in the order to build them",
"The first page to write, so you know exactly where to start",
]
const DEFAULT_CHOICES: QuizChoice[] = [
{ value: "guide", label: "A free guide or checklist" },
{ value: "product", label: "A low-price digital product" },
{ value: "program", label: "A course or coaching program" },
{ value: "event", label: "A live workshop or webinar" },
]
const KEYS = ["A", "B", "C", "D", "E", "F", "G", "H"]
// Slotted photography retains its original colours.
const CSS = `
.cf-quiz-start{--qs-cta:var(--cta,#d92d20);--qs-cta-2:var(--cta-2,#b42318);--qs-cta-ink:var(--cta-ink,#ffffff);--qs-ink:var(--ink,#101828);--qs-muted:var(--muted,#4a5565);--qs-band:var(--band,#0f2747);--qs-band-ink:var(--band-ink,#ffffff);--qs-accent:var(--accent,#0f5fc2);--qs-accent-fill:var(--accent-fill,var(--accent,#0f5fc2));--qs-card:var(--card,#ffffff);--qs-r:var(--radius,16px);position:relative;isolation:isolate;box-sizing:border-box;width:100%;max-width:980px;margin-inline:auto;overflow:hidden;color:var(--qs-ink);font-family:var(--font-body);border:1px solid oklch(from var(--ink) l c h / 0.26);-webkit-font-smoothing:antialiased;--qs-marker:var(--marker,var(--warning-soft));--qs-ok:var(--success);--qs-err:var(--danger);--qs-wash:var(--card);--qs-line:var(--field-border,oklch(from var(--ink) l c h / 0.22));background:var(--card);border-color:var(--card-border,oklch(from var(--ink) l c h / 0.12));border-radius:var(--card-radius,var(--radius));box-shadow:var(--card-shadow,var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)));}
.cf-quiz-start *,.cf-quiz-start *::before,.cf-quiz-start *::after{box-sizing:border-box}
.cf-quiz-start :where(h2,h3,p,ul,figure){margin:0}
.cf-quiz-start svg{flex:none}
:where(.cf-quiz-start) .qs-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:normal;}
:where(.cf-quiz-start) .qs-head{position:relative;z-index:0;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:20px 36px;padding:clamp(26px,3.8vw,48px) clamp(20px,4vw,48px);background:var(--qs-band);color:var(--qs-band-ink);overflow:hidden;box-shadow:inset 0 -1px 0 oklch(from var(--band) calc(l - 0.12) c h / 0.35),inset 0 1px 0 oklch(from var(--band) calc(l - 0.12) c h / 0.35)}
:where(.cf-quiz-start) .qs-rings{position:absolute;z-index:-1;top:50%;right:-130px;width:560px;height:560px;transform:translateY(-50%);color:var(--qs-band-ink);opacity:.07;pointer-events:none}
:where(.cf-quiz-start) .qs-head-copy{min-width:0}
:where(.cf-quiz-start) .qs-title{font-family:var(--font-display);font-size:clamp(2.1rem,1.2rem + 3vw,3.5rem);line-height:1.06;max-width:11.2em;text-wrap:balance;color:var(--qs-band-ink);font-weight:var(--display-weight,900);letter-spacing:var(--display-tracking,-.018em);text-transform:var(--display-case,none);}
:where(.cf-quiz-start) .qs-mark{padding:0 .2em;margin:0 -.04em;background-color:transparent;background-image:linear-gradient(var(--qs-marker),var(--qs-marker));background-repeat:no-repeat;background-size:100% 86%;background-position:0 100%;border-radius:.26em .5em .34em .58em / .58em .36em .52em .4em;-webkit-box-decoration-break:clone;box-decoration-break:clone;color:var(--ink);}
:where(.cf-quiz-start) .qs-lead{margin-top:clamp(16px,1.5vw,22px);max-width:50ch;font-size:clamp(1.0625rem,1rem + .35vw,1.25rem);font-weight:500;line-height:1.5;color:var(--qs-band-ink);text-wrap:pretty}
:where(.cf-quiz-start) .qs-meta{display:flex;flex-wrap:wrap;gap:8px 10px;margin-top:22px;padding:0;list-style:none}
:where(.cf-quiz-start) .qs-meta li{display:inline-flex;align-items:center;gap:8px;min-height:38px;padding:7px 14px 7px 12px;border-radius:999px;background:var(--qs-band);box-shadow:inset 0 0 0 1px oklch(from var(--qs-band-ink) l c h / 0.14),0 2px 6px -1px oklch(from var(--qs-band) calc(l - 0.12) c h / 0.35);font-size:15px;font-weight:700;line-height:1.2;white-space:nowrap}
:where(.cf-quiz-start) .qs-meta svg{width:18px;height:18px;color:var(--qs-marker)}
:where(.cf-quiz-start) .qs-watch-wrap{width:clamp(140px,15vw,190px)}
:where(.cf-quiz-start) .qs-watch{display:block;width:100%;height:auto;transform:rotate(-7deg);filter:drop-shadow(0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.35)) drop-shadow(0 4px 6px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.25))}
:where(.cf-quiz-start) .qs-body{display:grid;grid-template-columns:minmax(0,.92fr) minmax(0,1.08fr);gap:36px;align-items:start;padding:clamp(20px,3.2vw,40px) clamp(18px,4vw,48px) clamp(22px,3.4vw,44px);background:var(--qs-wash)}
:where(.cf-quiz-start) .qs-find{min-width:0}
:where(.cf-quiz-start) .qs-photo{position:relative;margin-bottom:26px}
:where(.cf-quiz-start) .qs-photo-frame{display:block;aspect-ratio:4/3;border-radius:14px;overflow:hidden;background:transparent;box-shadow:0 2px 4px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.35);}
:where(.cf-quiz-start) .qs-photo img{display:block;width:100%;height:100%;object-fit:cover}
:where(.cf-quiz-start) .qs-photo-cap{display:flex;align-items:center;justify-content:center;gap:8px;margin-top:12px;color:var(--qs-ink);font-size:15px;font-weight:700;line-height:1.25;text-align:center;text-wrap:balance}
:where(.cf-quiz-start) .qs-photo-cap svg{width:17px;height:17px;color:var(--qs-accent)}
:where(.cf-quiz-start) .qs-find-title{font-family:var(--font-display);font-size:clamp(1.3rem,1.1rem + .55vw,1.625rem);line-height:1.2;text-wrap:balance;color:var(--qs-ink);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-.01em);text-transform:var(--display-case,none);}
:where(.cf-quiz-start) .qs-find-list{margin-top:18px;padding:0;list-style:none;display:grid;gap:16px}
:where(.cf-quiz-start) .qs-find-list li{display:grid;grid-template-columns:30px minmax(0,1fr);gap:12px;align-items:start;font-size:17px;font-weight:500;line-height:1.45;color:var(--qs-ink);text-wrap:pretty}
:where(.cf-quiz-start) .qs-tick{display:grid;place-items:center;width:30px;height:30px;margin-top:-3px;border-radius:50%;background:var(--success);color:var(--card);box-shadow:inset 0 -2px 0 oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.35),0 2px 3px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.35);}
:where(.cf-quiz-start) .qs-tick svg{width:17px;height:17px}
:where(.cf-quiz-start) .qs-panel{position:relative;padding:clamp(18px,2.4vw,28px);border:1px solid oklch(from var(--ink) l c h / 0.08);background:color-mix(in oklch,var(--ink) 4%,var(--card));border-radius:var(--card-radius,var(--radius));}
:where(.cf-quiz-start) .qs-progress{display:flex;align-items:center;gap:14px}
:where(.cf-quiz-start) .qs-step{flex:none;font-size:15px;font-weight:800;line-height:1.2;white-space:nowrap;color:color-mix(in oklch,var(--qs-accent) 75%,var(--qs-ink))}
:where(.cf-quiz-start) .qs-seg{flex:1;display:flex;gap:5px;min-width:0}
:where(.cf-quiz-start) .qs-seg span{flex:1;height:8px;border-radius:999px;background:color-mix(in oklch,var(--qs-ink) 10%,var(--qs-card));box-shadow:inset 0 1px 1px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.35);transition:background-color .35s ease}
:where(.cf-quiz-start) .qs-seg span[data-s=now]{background:var(--qs-accent-fill)}
:where(.cf-quiz-start) .qs-seg span[data-s=done]{background:var(--qs-ok)}
:where(.cf-quiz-start) .qs-question{margin-top:20px;font-family:var(--font-display);font-size:clamp(1.4rem,1.15rem + .95vw,1.875rem);line-height:1.15;text-wrap:balance;color:var(--qs-ink);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-.012em);text-transform:var(--display-case,none);}
:where(.cf-quiz-start) .qs-nudge{display:flex;align-items:center;gap:7px;margin-top:10px;color:var(--warning);font-size:15px;font-weight:700;line-height:1.3}
:where(.cf-quiz-start) .qs-nudge svg{width:18px;height:18px}
:where(.cf-quiz-start) .qs-choices{display:grid;grid-template-columns:1fr;gap:10px;margin-top:16px}
:where(.cf-quiz-start) .qs-choice{position:relative;display:flex;align-items:center;gap:14px;min-height:62px;padding:11px 14px 11px 12px;border:2px solid var(--qs-line);cursor:pointer;transition:border-color .16s ease,box-shadow .18s ease,transform .18s ease,background-color .16s ease;-webkit-tap-highlight-color:transparent;background:var(--card);border-color:var(--card-border,oklch(from var(--ink) l c h / 0.12));border-radius:var(--card-radius,var(--radius));box-shadow:var(--card-shadow,var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)));}
:where(.cf-quiz-start) .qs-choice input{position:absolute;width:1px;height:1px;margin:0;opacity:0;clip-path:inset(50%);pointer-events:none;accent-color:var(--field-focus,var(--accent));}
:where(.cf-quiz-start) .qs-key{flex:none;display:grid;place-items:center;width:36px;height:36px;border-radius:9px;border:2px solid oklch(from var(--ink) l c h / 0.22);font-family:var(--font-display);font-size:16px;font-weight:800;line-height:1;transition:background-color .16s ease,border-color .16s ease,color .16s ease,transform .2s ease;background:var(--card);color:var(--ink);}
:where(.cf-quiz-start) .qs-key svg{width:18px;height:18px}
:where(.cf-quiz-start) .qs-choice-text{display:grid;gap:2px;min-width:0;flex:1}
:where(.cf-quiz-start) .qs-choice-label{font-size:17px;font-weight:700;line-height:1.25;text-wrap:pretty;color:var(--label-ink,var(--ink));}
:where(.cf-quiz-start) .qs-choice-hint{font-size:14px;font-weight:500;line-height:1.35;color:var(--qs-muted);text-wrap:pretty}
:where(.cf-quiz-start) .qs-chev{width:20px;height:20px;color:color-mix(in oklch,var(--qs-band) 38%,var(--qs-card));transition:transform .18s ease,color .16s ease}
@media (hover:hover){:where(.cf-quiz-start) .qs-choice:hover{border-color:oklch(from var(--qs-accent) l c h / 0.55);transform:translateY(-2px);box-shadow:var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2))}:where(.cf-quiz-start) .qs-choice:hover .qs-key{border-color:var(--qs-accent);color:var(--qs-accent)}:where(.cf-quiz-start) .qs-choice:hover .qs-chev{color:var(--qs-accent);transform:translateX(3px)}}
:where(.cf-quiz-start) .qs-choice:active{transform:translateY(0) scale(.985)}
:where(.cf-quiz-start) .qs-choice:has(input:focus-visible){outline:3px solid var(--qs-accent);outline-offset:3px}
:where(.cf-quiz-start) .qs-choice[data-checked]{background:var(--card);border-color:var(--success);box-shadow:var(--card-shadow,inset 0 0 0 1px var(--success));}
:where(.cf-quiz-start) .qs-choice[data-checked] .qs-key,:where(.cf-quiz-start) .qs-choice[data-checked]:hover .qs-key{border-color:var(--success);transform:scale(1.04);background:var(--success-soft);color:var(--success);}
:where(.cf-quiz-start) .qs-choice[data-checked] .qs-chev{color:var(--success)}
:where(.cf-quiz-start) .qs-choices[data-invalid] .qs-choice{border-color:var(--qs-err)}
.cf-quiz-start[data-disabled] .qs-choice,.cf-quiz-start[data-disabled] .qs-choice:hover{cursor:not-allowed;border-color:var(--qs-line);box-shadow:none;transform:none;background:var(--card);}
.cf-quiz-start[data-disabled] .qs-choice-label,.cf-quiz-start[data-disabled] .qs-key,.cf-quiz-start[data-disabled] .qs-choice:hover .qs-key{color:var(--qs-muted);border-color:var(--qs-line)}
.cf-quiz-start[data-disabled] .qs-chev{display:none}
:where(.cf-quiz-start) .qs-error{display:flex;align-items:center;gap:8px;margin-top:14px;padding:10px 14px;color:var(--qs-err);font-size:15px;font-weight:700;line-height:1.35;text-wrap:pretty;background:var(--card);border:1px solid;border-color:var(--card-border,oklch(from var(--ink) l c h / 0.12));border-radius:var(--card-radius,var(--radius));}
:where(.cf-quiz-start) .qs-error svg{width:18px;height:18px}
:where(.cf-quiz-start) .qs-closed{margin-top:14px;padding:10px 14px;color:var(--warning);font-size:15px;font-weight:600;line-height:1.4;text-align:center;text-wrap:pretty;background:var(--card);border:1px solid;border-color:var(--card-border,oklch(from var(--ink) l c h / 0.12));border-radius:var(--card-radius,var(--radius));}
:where(.cf-quiz-start) .qs-cta{position:relative;display:flex;align-items:center;justify-content:center;gap:12px;width:100%;min-height:68px;margin-top:20px;padding:12px 20px;letter-spacing:-.005em;text-shadow:var(--button-text-shadow, 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.2) c h / 0.75));cursor:pointer;transition:transform .14s ease,box-shadow .14s ease,filter .14s ease;-webkit-tap-highlight-color:transparent;background:linear-gradient(180deg in oklch,var(--button-bg,var(--cta)),var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h)));color:var(--button-ink,var(--cta-ink));border-color:var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h));border-radius:var(--button-radius,var(--radius));font:var(--button-weight,800) clamp(1.2rem,1.05rem + .55vw,1.45rem)/1.1 var(--button-font,var(--font-display));text-transform:var(--button-case,none);box-shadow:var(--button-shadow,inset 0 -3px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.16) c h),var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)));border:1px solid var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h));}
:where(.cf-quiz-start) .qs-cta-label{text-align:center;text-wrap:balance}
:where(.cf-quiz-start) .qs-cta-icon{display:grid;place-items:center;width:32px;height:32px;border-radius:50%;transition:transform .16s ease;background:transparent;box-shadow:none;}
:where(.cf-quiz-start) .qs-cta-icon svg{width:19px;height:19px}
:where(.cf-quiz-start) .qs-cta:hover:not(:disabled),:where(.cf-quiz-start) .qs-cta.is-hover{transform:translateY(-2px);filter:none;box-shadow:var(--button-shadow,inset 0 -3px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.16) c h),var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)));}
:where(.cf-quiz-start) .qs-cta:active:not(:disabled),:where(.cf-quiz-start) .qs-cta.is-active{transform:translateY(2px);filter:none;box-shadow:var(--button-shadow,inset 0 -1px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.16) c h),var(--shadow-sm, 0 1px 1px oklch(0.22 0.03 260 / 0.18), 0 1px 3px oklch(0.22 0.03 260 / 0.14)));}
:where(.cf-quiz-start) .qs-cta:focus-visible{outline:3px solid var(--qs-band);outline-offset:3px}
:where(.cf-quiz-start) .qs-cta:disabled{cursor:not-allowed;text-shadow:none;filter:none;transform:none;background:var(--button-2-bg,var(--card));color:var(--button-2-ink,var(--ink));border-color:var(--button-2-border,oklch(from var(--ink) l c h / 0.22));border-radius:var(--button-radius,var(--radius));box-shadow:var(--button-shadow,none);}
:where(.cf-quiz-start) .qs-cta:disabled .qs-cta-icon{background:transparent;box-shadow:none;}
:where(.cf-quiz-start) .qs-cta[data-loading]{cursor:progress}
:where(.cf-quiz-start) .qs-cta[data-ready]::after{content:'';position:absolute;inset:-4px;border-radius:15px;pointer-events:none;animation:none;}
:where(.cf-quiz-start) .qs-reassure{margin-top:12px;text-align:center;font-size:14px;font-weight:600;line-height:1.4;color:var(--qs-muted);text-wrap:pretty}
@keyframes qs-sweep{from{stroke-dashoffset:100}to{stroke-dashoffset:0}}
@keyframes qs-swipe{from{background-size:0% 86%}to{background-size:100% 86%}}
@keyframes qs-settle{from{transform:rotate(-16deg) scale(.94)}to{transform:rotate(-7deg)}}
@keyframes qs-in{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes qs-zoom{from{transform:scale(1.06)}to{transform:scale(1)}}
@keyframes qs-shake{0%,100%{transform:none}25%{transform:translateX(-4px)}75%{transform:translateX(4px)}}
@keyframes qs-spin{to{transform:rotate(360deg)}}
@keyframes qs-ready{from{box-shadow:0 0 0 0 oklch(from var(--qs-cta) l c h / 0.45)}to{box-shadow:0 0 0 14px oklch(from var(--qs-cta) l c h / 0)}}
@media (prefers-reduced-motion:no-preference){
:where(.cf-quiz-start) .qs-mark{animation:qs-swipe .6s cubic-bezier(.55,.1,.25,1) .2s backwards}
:where(.cf-quiz-start) .qs-arc{animation:qs-sweep 1.5s cubic-bezier(.55,.05,.3,1) .15s backwards}
:where(.cf-quiz-start) .qs-watch{animation:qs-settle .55s cubic-bezier(.2,.8,.2,1) backwards}
:where(.cf-quiz-start) .qs-photo img{animation:qs-zoom 1.4s cubic-bezier(.2,.7,.2,1) backwards}
:where(.cf-quiz-start) .qs-choice{animation:qs-in .45s ease-out backwards;animation-delay:calc(min(var(--i,0),4) * .07s)}
:where(.cf-quiz-start) .qs-error{animation:qs-shake .3s ease-in-out 1}
:where(.cf-quiz-start) .qs-spin{animation:qs-spin .8s linear infinite}
:where(.cf-quiz-start) .qs-cta[data-ready]::after{animation:qs-ready 1.1s ease-out 2}
}
@media (prefers-reduced-motion:reduce){.cf-quiz-start *,.cf-quiz-start *::before,.cf-quiz-start *::after{transition:none !important}:where(.cf-quiz-start) .qs-choice:hover,:where(.cf-quiz-start) .qs-cta:hover:not(:disabled),:where(.cf-quiz-start) .qs-cta.is-hover{transform:none}:where(.cf-quiz-start) .qs-cta:hover:not(:disabled) .qs-cta-icon,:where(.cf-quiz-start) .qs-cta.is-hover .qs-cta-icon,:where(.cf-quiz-start) .qs-choice:hover .qs-chev{transform:none}}
@media (max-width:860px){:where(.cf-quiz-start) .qs-body{grid-template-columns:1fr;gap:22px}:where(.cf-quiz-start) .qs-photo{display:none}:where(.cf-quiz-start) .qs-find{max-width:560px}}
@media (max-width:640px){:where(.cf-quiz-start) .qs-head{grid-template-columns:1fr;gap:14px}:where(.cf-quiz-start) .qs-watch-wrap{order:-1;width:96px}:where(.cf-quiz-start) .qs-rings{top:-140px;right:-210px;transform:none;width:420px;height:420px}:where(.cf-quiz-start) .qs-meta{margin-top:18px}:where(.cf-quiz-start) .qs-meta li{min-height:34px;padding:6px 12px 6px 10px;font-size:14px}}
@media (max-width:420px){:where(.cf-quiz-start) .qs-progress{gap:10px}:where(.cf-quiz-start) .qs-choice{min-height:58px;gap:12px}:where(.cf-quiz-start) .qs-cta{min-height:64px;padding-inline:14px}}
`
function Headline({ text, mark }: { text: string; mark?: string }) {
if (!mark) return <>{text}</>
const at = text.indexOf(mark)
if (at < 0) return <>{text}</>
return (
<>
{text.slice(0, at)}
<span className="qs-mark" style={mark.length <= 16 ? { whiteSpace: "nowrap" } : undefined}>{mark}</span>
{text.slice(at + mark.length)}
</>
)
}
function Stopwatch({ value, unit }: { value: string; unit: string }) {
const id = useId().replace(/:/g, "")
const cx = 100
const cy = 130
const p = (n: number) => Number(n.toFixed(2))
const ticks = Array.from({ length: 60 }, (_, i) => {
const major = i % 5 === 0
const a = (i / 60) * Math.PI * 2
const r1 = major ? 58 : 62
const r2 = 66
return (
<line
key={i}
x1={p(cx + Math.sin(a) * r1)}
y1={p(cy - Math.cos(a) * r1)}
x2={p(cx + Math.sin(a) * r2)}
y2={p(cy - Math.cos(a) * r2)}
strokeWidth={major ? 2.6 : 1.2}
strokeLinecap="round"
style={{ stroke: "var(--qs-band)", strokeOpacity: major ? 0.9 : 0.35 }}
/>
)
})
return (
<svg className="qs-watch" viewBox="0 0 200 224" aria-hidden="true" focusable="false">
<defs>
<linearGradient id={`${id}m`} x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stopColor="var(--card)" />
<stop offset=".45" stopColor="var(--card)" />
<stop offset="1" stopColor="var(--card)" />
</linearGradient>
<linearGradient id={`${id}c`} x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stopColor="var(--card)" />
<stop offset="1" stopColor="var(--card)" />
</linearGradient>
<radialGradient id={`${id}f`} cx=".38" cy=".32" r=".8">
<stop offset="0" stopColor="var(--card)" />
<stop offset="1" stopColor="var(--card)" />
</radialGradient>
</defs>
<g transform={`rotate(-42 ${cx} ${cy})`}>
<rect x="93" y="34" width="14" height="14" rx="3" fill={`url(#${id}c)`} stroke="var(--ink)" strokeWidth="1" />
</g>
<g transform={`rotate(42 ${cx} ${cy})`}>
<rect x="93" y="34" width="14" height="14" rx="3" fill={`url(#${id}c)`} stroke="var(--ink)" strokeWidth="1" />
</g>
<rect x="94" y="26" width="12" height="20" rx="2" fill={`url(#${id}c)`} stroke="var(--ink)" strokeWidth="1" />
<rect x="82" y="12" width="36" height="17" rx="5" fill={`url(#${id}c)`} stroke="var(--ink)" strokeWidth="1" />
<path d="M90 16v9M96 16v9M102 16v9M108 16v9" stroke="var(--ink)" strokeWidth="1.4" strokeLinecap="round" />
<circle cx={cx} cy={cy} r="86" fill={`url(#${id}m)`} stroke="var(--ink)" strokeWidth="1" />
<circle cx={cx} cy={cy} r="78" style={{ fill: "var(--ink)" }} />
<circle cx={cx} cy={cy} r="78" fill="none" stroke="oklch(from var(--ink) l c h / 0.28)" strokeWidth="2" />
<circle cx={cx} cy={cy} r="71" fill={`url(#${id}f)`} />
<circle cx={cx} cy={cy} r="71" fill="none" stroke="var(--ink)" strokeWidth="1.5" />
{ticks}
<circle cx={cx} cy={cy} r="46" fill="none" stroke="var(--ink)" strokeWidth="9" />
<circle
className="qs-arc"
cx={cx}
cy={cy}
r="46"
fill="none"
pathLength={100}
strokeDasharray="100"
strokeDashoffset="0"
strokeWidth="9"
strokeLinecap="round"
transform={`rotate(-90 ${cx} ${cy})`}
style={{ stroke: "var(--qs-accent-fill)" }}
/>
<text x={cx} y="141" textAnchor="middle" style={{ fill: "var(--ink)", fontFamily: "var(--font-display)", fontWeight: 900, fontSize: 38, letterSpacing: "-1px" }}>
{value}
</text>
<text x={cx} y="160" textAnchor="middle" style={{ fill: "var(--qs-muted)", fontFamily: "var(--font-body)", fontWeight: 700, fontSize: 11, letterSpacing: "3px" }}>
{unit.toUpperCase()}
</text>
</svg>
)
}
function Segments({ count, done }: { count: number; done: number }) {
return (
<div className="qs-seg" aria-hidden="true">
{Array.from({ length: count }, (_, i) => (
<span key={i} data-s={i < done ? "done" : i === done ? "now" : "next"} />
))}
</div>
)
}
export default QuizStart
const defaultCopy = {
"successNext": "Your first answer is saved. Question 2 of {count} is ready for you.",
"successResult": "Your answer is saved. Your result is ready.",
"continueNext": "Go To Question 2",
"continueResult": "See My Result",
"questionSingular": "question",
"questionPlural": "questions",
"questionCount": "{count} {unit}",
"successAnnouncement": "{title} {detail}",
"details": "Quiz details",
"progress": "Question {current} of {count}",
"loadingNext": "Loading…"
}
function text(template: string, values: Record<string, string | number>) {
return template.replace(/\{(\w+)\}/g, (match, key: string) => String(values[key] ?? match))
}
pieces/forms/quiz-start/specimen.tsx 47 lines
import __studioImage4eb80070 from "../assets/440d8716d47da116.webp";
import QuizStart, { type QuizStartState } from "../quiz-start"
import { slot } from "../../slots"
import defaults from "../../studio-defaults.json"
export const states = ["default", "hover", "active", "disabled", "error"]
const sample = defaults.sample
const quizName = sample.registration.name.replace("Workshop", "Quiz")
export default function QuizStartSpecimen({ state = "default" }: { state?: string }) {
return (
<QuizStart
state={state as QuizStartState}
headline="Find your first funnel in 60 seconds"
highlight="60 seconds"
lead={`Take the free ${quizName}. Answer a few quick questions about your offer and see which funnel to build first, plus the pages it needs.`}
sceneImage={slot("scene", __studioImage4eb80070)}
imageAlt="A woman planning her first funnel at her laptop"
photoCaption="Your free funnel plan in 60 seconds"
findOutTitle="In 60 seconds, you’ll find out:"
findOut={[
"Which funnel fits the offer you have right now",
"The pages that funnel needs, in the order to build them",
"The first page to write, so you know exactly where to start",
]}
questionCount={5}
durationLabel="60 seconds"
timerValue="60"
timerUnit="sec"
resultLabel="Free result"
question="What are you selling first?"
choices={[
{ value: "guide", label: "A free guide or checklist" },
{ value: "product", label: "A low-price digital product" },
{ value: "program", label: "A course or coaching program" },
{ value: "event", label: "A live workshop or webinar" },
]}
nudge="Tap an answer to begin"
ctaLabel="Start My Free Quiz"
loadingLabel="Starting your quiz…"
reassurance="100% free · Takes about 60 seconds"
errorText="Pick an answer above to start your quiz."
disabledText="This quiz isn’t taking new answers right now."
/>
)
}
| Name | Type | Details |
|---|---|---|
copy OptionalQuizStart |
Partial<typeof defaultCopy> |
|
sceneImage OptionalQuizStart |
string |
|
onSubmit OptionalQuizStart |
(answer: string) => void | Promise<void> |
|
onAction OptionalQuizStart |
(answer: string) => void |
|
headline OptionalQuizStart |
string |
Default "Find your first funnel in 60 seconds"
|
highlight OptionalQuizStart |
string |
Default "60 seconds"
|
lead OptionalQuizStart |
string |
Default "Answer a few quick questions about your offer and see which funnel to build first, plus the pages it needs."
|
image OptionalQuizStart |
string |
|
imageAlt OptionalQuizStart |
string |
Default ""
|
photoCaption OptionalQuizStart |
string |
Default "Your free funnel plan in 60 seconds"
|
findOutTitle OptionalQuizStart |
string |
Default "In 60 seconds, you’ll find out:"
|
findOut OptionalQuizStart |
string[] |
Default DEFAULT_FIND_OUT
|
questionCount OptionalQuizStart |
number |
Default 5
|
durationLabel OptionalQuizStart |
string |
Default "60 seconds"
|
timerValue OptionalQuizStart |
string |
Default "60"
|
timerUnit OptionalQuizStart |
string |
Default "sec"
|
resultLabel OptionalQuizStart |
string |
Default "Free result"
|
question OptionalQuizStart |
string |
Default "What are you selling first?"
|
choices OptionalQuizStart |
QuizChoice[] |
Default DEFAULT_CHOICES
|
nudge OptionalQuizStart |
string |
Default "Tap an answer to begin"
|
ctaLabel OptionalQuizStart |
string |
Default "Start My Free Quiz"
|
loadingLabel OptionalQuizStart |
string |
Default "Starting your quiz…"
|
reassurance OptionalQuizStart |
string |
Default "100% free · Takes about 60 seconds"
|
errorText OptionalQuizStart |
string |
Default "Pick an answer above to start your quiz."
|
successTitle OptionalQuizStart |
string |
|
successText OptionalQuizStart |
string |
|
nextLabel OptionalQuizStart |
string |
|
nextQuestion OptionalQuizStart |
string |
|
continueLabel OptionalQuizStart |
string |
|
changeLabel OptionalQuizStart |
string |
|
disabled OptionalQuizStart |
boolean |
Default false
|
disabledText OptionalQuizStart |
string |
Default "This quiz isn’t taking new answers right now."
|
state OptionalQuizStart |
QuizStartState |
Default "default"
|
onStart OptionalQuizStart |
(answer: string) => void | Promise<void> |
|
onContinue OptionalQuizStart |
(answer: string) => void |
|
className OptionalQuizStart |
string |
Default ""
|
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- 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-border--field-focus- Form inputs: background, ink, border, radius and focus colour.
--marker- The highlighter colour behind key phrases.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
scene- A wide atmosphere photo behind or beside the copy.
-
440d8716d47da116.webp
image/webp · 90 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB