Results Gate 3
Quiz results gate: fans every possible result type above a first name + email form. The visitor sees who they might be, and their details reveal which one is theirs.
Use it in a prompt
Use forms/results-gate-3 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/results-gate-3.tsx. - Import it and pass your copy and images (Props tab):
import { ResultsGate3 } from "@/components/funneldna/forms/results-gate-3"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/forms/results-gate-3/component.tsx 498 lines
// layout: card-fan
// Quiz results gate: fans every possible result type above a first name + email form. The visitor sees who they might be, and their details reveal which one is theirs.
import * as React from 'react'
import { CircleAlert, CircleCheck, CircleHelp, Hand, Loader2, Lock, Mail, ShieldCheck, Sparkles, User, type LucideIcon } from 'lucide-react'
import { FX_HOST, Pattern } from '../fx/fx'
export type ResultsGate3Type = {
/** Short type name, e.g. "The Grazer". */
name: string
/** One-line description of the type. */
line: string
/** Illustration for the type. A landscape or square crop works. */
image?: string
imageAlt?: string
/** Focal point of the illustration (CSS position, e.g. "0% 50%"). Lets several types share one illustration. */
imageFocus?: string
/** Zoom into the focal point (1 = whole image). */
imageZoom?: number
}
export type ResultsGate3Values = { firstName: string; email: string }
export type ResultsGate3State = 'default' | 'hover' | 'active' | 'disabled' | 'error'
export type ResultsGate3Props = {
headline?: string
/** One continuous phrase inside the headline that gets the marker stroke. */
highlight?: string
/** The open loop under the headline. */
lead?: string
/** Every possible result (2 to 5). All get the same treatment. None is marked as the visitor's before submit. */
types?: ResultsGate3Type[]
/** Accessible name for the card fan. */
deckLabel?: string
/** Visible line above the fan. */
hint?: string
/** Screen-reader instruction for keyboard use of the fan. */
keyHint?: string
/** Chip on every card. It is identical on each card. */
cardTag?: string
/** The question the button answers. */
question?: string
firstNameLabel?: string
firstNamePlaceholder?: string
emailLabel?: string
emailPlaceholder?: string
/** Button label, one line. */
label?: string
loadingLabel?: string
/** Screen-reader note on the button while it is locked. */
lockedHint?: string
privacy?: string
psLabel?: string
ps?: string
nameError?: string
emailError?: string
/** Shown when onSubmit rejects. */
error?: string
/** Starting field values. */
defaultValues?: Partial<ResultsGate3Values>
headingLevel?: 'h2' | 'h3'
state?: ResultsGate3State
/** Receives validated values. The button shows the loader until a returned promise settles. A rejection shows the error alert. */
onSubmit?: (values: ResultsGate3Values) => void | Promise<void>
className?: string
style?: React.CSSProperties
}
type Touched = Partial<Record<keyof ResultsGate3Values, boolean>>
const EMAIL = /^[^ @]+@[^ @]+[.][^ @]+$/
const DEFAULT_TYPES: ResultsGate3Type[] = [
{ name: 'The Planner', line: 'Maps every step before taking the first one.' },
{ name: 'The Sprinter', line: 'Moves fast, learns on the way, fixes later.' },
{ name: 'The Connector', line: 'Gets further with people than with plans.' },
{ name: 'The Fine-Tuner', line: 'Keeps polishing until it feels exactly right.' },
]
export function ResultsGate3({
headline = 'Which type are you?',
highlight = 'type',
lead = 'You are one of these. Your answers decide which.',
types = DEFAULT_TYPES,
deckLabel = 'Every possible result',
hint = 'Tap any card to bring it to the front.',
keyHint = 'Use the arrow keys to move between cards.',
cardTag = 'Could this be you?',
question = 'Ready to see which one is you?',
firstNameLabel = 'First name',
firstNamePlaceholder = 'Jane',
emailLabel = 'Email address',
emailPlaceholder = 'you@example.com',
label = 'Yes, show me my type',
loadingLabel = 'Matching your answers…',
lockedHint = 'Add your first name and email to unlock your result.',
privacy = 'Free to see. We respect your inbox. Unsubscribe anytime.',
psLabel = 'P.S.',
ps = 'Your answers already picked your type. Your details open it.',
nameError = 'Add your first name so we know who the result is for.',
emailError = 'Enter a valid email so we can show your result.',
error = 'We couldn’t open your result just now. Please try again.',
defaultValues,
headingLevel = 'h2',
state = 'default',
onSubmit,
className,
style,
}: ResultsGate3Props) {
const uid = React.useId().replace(/:/g, '')
const ids = {
title: `${uid}-t`,
hint: `${uid}-h`,
ask: `${uid}-q`,
lock: `${uid}-l`,
privacy: `${uid}-p`,
}
const deck = types.slice(0, 5)
const n = deck.length
const [front, setFront] = React.useState(0)
const [values, setValues] = React.useState<ResultsGate3Values>({
firstName: defaultValues?.firstName ?? '',
email: defaultValues?.email ?? '',
})
const [touched, setTouched] = React.useState<Touched>(state === 'error' ? { firstName: true, email: true } : {})
const [loading, setLoading] = React.useState(false)
const [failed, setFailed] = React.useState(false)
const busy = React.useRef(false)
const steered = React.useRef(0)
const fanRef = React.useRef<HTMLDivElement>(null)
const cardRefs = React.useRef<Array<HTMLButtonElement | null>>([])
const nameRef = React.useRef<HTMLInputElement>(null)
const emailRef = React.useRef<HTMLInputElement>(null)
const shown = Math.min(front, Math.max(n - 1, 0))
const nameOk = values.firstName.trim() !== ''
const emailOk = EMAIL.test(values.email.trim())
const valid = nameOk && emailOk
const locked = state === 'disabled'
const nameErr = touched.firstName && !nameOk ? nameError : undefined
const emailErr = touched.email && !emailOk ? emailError : undefined
const off = locked || !valid
const force = !off && !loading && (state === 'hover' || state === 'active') ? state : undefined
const H = headingLevel
const Sub = headingLevel === 'h2' ? 'h3' : 'h4'
function scrollable(fan: HTMLDivElement) {
return fan.scrollWidth > fan.clientWidth + 2
}
function show(i: number) {
setFront(i)
const fan = fanRef.current
const card = cardRefs.current[i]
if (!fan || !card || !scrollable(fan)) return
const pad = parseFloat(getComputedStyle(fan).scrollPaddingLeft) || 0
const reduce = typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches
steered.current = performance.now()
fan.scrollTo({ left: card.offsetLeft - pad, behavior: reduce ? 'auto' : 'smooth' })
}
function onFanScroll() {
const fan = fanRef.current
if (!fan || !scrollable(fan) || performance.now() - steered.current < 700) return
const pad = parseFloat(getComputedStyle(fan).scrollPaddingLeft) || 0
let best = 0
let dist = Infinity
cardRefs.current.slice(0, n).forEach((card, i) => {
if (!card) return
const d = Math.abs(card.offsetLeft - pad - fan.scrollLeft)
if (d < dist) {
dist = d
best = i
}
})
if (fan.scrollLeft >= fan.scrollWidth - fan.clientWidth - 4) best = n - 1
setFront((prev) => (prev === best ? prev : best))
}
function onCardKey(e: React.KeyboardEvent<HTMLButtonElement>, i: number) {
let next = -1
if (e.key === 'ArrowRight' || e.key === 'ArrowDown') next = (i + 1) % n
else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') next = (i - 1 + n) % n
else if (e.key === 'Home') next = 0
else if (e.key === 'End') next = n - 1
if (next < 0) return
e.preventDefault()
show(next)
cardRefs.current[next]?.focus({ preventScroll: true })
}
const update = (key: keyof ResultsGate3Values) => (e: React.ChangeEvent<HTMLInputElement>) => {
const v = e.target.value
setValues((p) => ({ ...p, [key]: v }))
if (failed) setFailed(false)
}
async function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
e.preventDefault()
if (locked || busy.current) return
setTouched({ firstName: true, email: true })
if (!nameOk) {
nameRef.current?.focus()
return
}
if (!emailOk) {
emailRef.current?.focus()
return
}
busy.current = true
setFailed(false)
setLoading(true)
try {
await onSubmit?.({ firstName: values.firstName.trim(), email: values.email.trim() })
} catch {
setFailed(true)
} finally {
busy.current = false
setLoading(false)
}
}
function field(
key: keyof ResultsGate3Values,
cfg: { label: string; placeholder: string; type: string; auto: string; Icon: LucideIcon; inputRef: React.Ref<HTMLInputElement>; err?: string; ok: boolean },
) {
const id = `${uid}-${key}`
const errId = `${id}-err`
const good = Boolean(touched[key]) && cfg.ok
return (
<div className={['rg3-field', cfg.err ? 'is-invalid' : '', good ? 'is-valid' : ''].filter(Boolean).join(' ')}>
<label className='rg3-label' htmlFor={id}>{cfg.label}</label>
<span className='rg3-control'>
<cfg.Icon className='rg3-fico' strokeWidth={2.5} aria-hidden='true' />
<input
ref={cfg.inputRef}
id={id}
name={key}
type={cfg.type}
autoComplete={cfg.auto}
placeholder={cfg.placeholder}
value={values[key]}
required
aria-invalid={cfg.err ? true : undefined}
aria-describedby={cfg.err ? errId : undefined}
onChange={update(key)}
onBlur={() => setTouched((p) => (p[key] ? p : { ...p, [key]: true }))}
/>
{good ? <CircleCheck className='rg3-ok' strokeWidth={2.5} aria-hidden='true' /> : null}
</span>
{cfg.err ? (
<p id={errId} className='rg3-err' role='alert'>
<CircleAlert strokeWidth={2.5} aria-hidden='true' />
{cfg.err}
</p>
) : null}
</div>
)
}
return (
<section className={['cf-results-gate-3', className].filter(Boolean).join(' ')} style={style} aria-labelledby={ids.title}>
<style>{CSS}</style>
<div className='rg3-wrap'>
<header className='rg3-head'>
<H id={ids.title} className='rg3-title'>{emphasize(headline, highlight)}</H>
{lead ? <p className='rg3-lead'>{lead}</p> : null}
</header>
<div className='rg3-stage' style={FX_HOST}>
<Pattern name='rings' fade='edges' />
{hint ? (
<p className='rg3-hint' id={ids.hint}>
<Hand className='rg3-ico' strokeWidth={2.5} aria-hidden='true' />
{hint}
{keyHint ? <span className='rg3-sr'> {keyHint}</span> : null}
</p>
) : null}
<div
ref={fanRef}
className='rg3-fan'
role='group'
aria-label={deckLabel}
aria-describedby={hint ? ids.hint : undefined}
onScroll={onFanScroll}
style={{ '--n': Math.max(n, 2) } as React.CSSProperties}
>
{deck.map((t, i) => {
const o = i - (n - 1) / 2
const isFront = i === shown
const nameId = `${uid}-c${i}`
const lineId = `${uid}-d${i}`
return (
<button
key={`${t.name}-${i}`}
ref={(el) => {
cardRefs.current[i] = el
}}
type='button'
className={isFront ? 'rg3-card is-front' : 'rg3-card'}
style={{
'--o': o,
'--a': Math.abs(o),
zIndex: isFront ? 20 : 10 - Math.abs(i - shown),
animationDelay: `${Math.min(i * 0.07, 0.28)}s`,
} as React.CSSProperties}
tabIndex={isFront ? 0 : -1}
aria-current={isFront ? 'true' : undefined}
aria-labelledby={nameId}
aria-describedby={lineId}
onClick={() => show(i)}
onKeyDown={(e) => onCardKey(e, i)}
>
<span className='rg3-art'>
{t.image ? (
<img
src={t.image}
alt={t.imageAlt ?? ''}
loading='lazy'
decoding='async'
style={{ '--focus': t.imageFocus, '--zoom': t.imageZoom } as React.CSSProperties}
/>
) : (
<Sparkles strokeWidth={2.5} aria-hidden='true' />
)}
</span>
<span className='rg3-name' id={nameId}>{t.name}</span>
<span className='rg3-line' id={lineId}>{t.line}</span>
{cardTag ? (
<span className='rg3-tag'>
<CircleHelp strokeWidth={2.5} aria-hidden='true' />
{cardTag}
</span>
) : null}
</button>
)
})}
</div>
<div className='rg3-dots' aria-hidden='true'>
{deck.map((t, i) => (
<span key={`${t.name}-dot-${i}`} className={i === shown ? 'is-on' : undefined} />
))}
</div>
</div>
<form
className={['rg3-form', force ? `is-${force}` : ''].filter(Boolean).join(' ')}
noValidate
onSubmit={handleSubmit}
aria-labelledby={ids.ask}
aria-busy={loading || undefined}
>
<fieldset className='rg3-set' disabled={locked}>
<Sub id={ids.ask} className='rg3-ask'>{question}</Sub>
<div className='rg3-row'>
{field('firstName', { label: firstNameLabel, placeholder: firstNamePlaceholder, type: 'text', auto: 'given-name', Icon: User, inputRef: nameRef, err: nameErr, ok: nameOk })}
{field('email', { label: emailLabel, placeholder: emailPlaceholder, type: 'email', auto: 'email', Icon: Mail, inputRef: emailRef, err: emailErr, ok: emailOk })}
<button
type='submit'
className={['rg3-btn', off ? 'is-off' : '', loading ? 'is-loading' : ''].filter(Boolean).join(' ')}
disabled={off || loading}
aria-describedby={[off && lockedHint ? ids.lock : '', privacy ? ids.privacy : ''].filter(Boolean).join(' ') || undefined}
>
{loading ? (
<>
<Loader2 className='rg3-bico rg3-spin' strokeWidth={2.5} aria-hidden='true' />
<span>{loadingLabel}</span>
</>
) : (
<>
{off ? <Lock className='rg3-bico' strokeWidth={2.5} aria-hidden='true' /> : null}
<span>{label}</span>
</>
)}
</button>
</div>
{lockedHint ? <span id={ids.lock} className='rg3-sr'>{lockedHint}</span> : null}
{failed ? (
<p className='rg3-alert' role='alert'>
<CircleAlert strokeWidth={2.5} aria-hidden='true' />
{error}
</p>
) : null}
{privacy ? (
<p className='rg3-privacy' id={ids.privacy}>
<ShieldCheck strokeWidth={2.5} aria-hidden='true' />
{privacy}
</p>
) : null}
{ps ? (
<p className='rg3-ps'>
<strong>{psLabel}</strong> {ps}
</p>
) : null}
</fieldset>
</form>
</div>
</section>
)
}
export default ResultsGate3
function emphasize(text: string, phrase?: string) {
if (!phrase) return text
const at = text.indexOf(phrase)
if (at < 0) return text
return (
<>
{text.slice(0, at)}
<span className='rg3-mark'>{phrase}</span>
{text.slice(at + phrase.length)}
</>
)
}
const MD = 'var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / .22), 0 4px 10px -2px oklch(0.22 0.03 260 / .2))'
const LG = 'var(--shadow-lg, 0 2px 4px oklch(0.22 0.03 260 / .22), 0 12px 24px -8px oklch(0.22 0.03 260 / .32))'
const BORDER = 'var(--card-border, oklch(from var(--ink) l c h / .12))'
const CSS = `
.cf-results-gate-3{position:relative;background:var(--surface);color:var(--ink);font-family:var(--font-body);padding:clamp(56px,8vw,112px) clamp(16px,5vw,48px) clamp(64px,8.5vw,120px);overflow-x:clip}
.cf-results-gate-3 *,.cf-results-gate-3 *::before,.cf-results-gate-3 *::after{box-sizing:border-box}
.cf-results-gate-3 .rg3-wrap{max-width:1120px;margin:0 auto}
.cf-results-gate-3 .rg3-head{max-width:46rem;margin:0 auto;text-align:center}
.cf-results-gate-3 .rg3-title{margin:0 0 16px;font-family:var(--font-display);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);text-wrap:balance;color:var(--ink)}
.cf-results-gate-3 .rg3-mark{background:linear-gradient(180deg,transparent 0 50%,color-mix(in oklch,var(--marker,#fae37c) 72%,var(--surface)) 50% 94%,transparent 94%);-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:0 .14em;margin:0 -.04em;border-radius:.18em .5em .32em .44em}
.cf-results-gate-3 .rg3-lead{margin:0;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--ink);text-wrap:pretty}
.cf-results-gate-3 .rg3-stage{position:relative;isolation:isolate;margin-top:clamp(32px,4vw,48px);padding:28px 24px 104px;border-radius:calc(var(--card-radius,var(--radius,14px)) * 2);background:color-mix(in oklch,var(--ink) 4%,var(--surface));overflow:clip}
.cf-results-gate-3 .rg3-hint{position:relative;z-index:1;margin:0;text-align:center;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted);text-wrap:pretty}
.cf-results-gate-3 .rg3-ico{display:inline-block;width:16px;height:16px;vertical-align:-.15em;margin-inline-end:.4em}
.cf-results-gate-3 .rg3-fan{--card-w:252px;--card-h:372px;--step:min(168px,calc((100cqw - var(--card-w) - 120px) / (var(--n) - 1)));position:relative;z-index:1;container-type:inline-size;height:470px;max-width:1000px;margin:16px auto 0}
.cf-results-gate-3 .rg3-card{--lift:0px;position:absolute;left:50%;top:30px;width:var(--card-w);height:var(--card-h);margin:0 0 0 calc(var(--card-w) / -2);display:flex;flex-direction:column;align-items:stretch;padding:12px 12px 18px;text-align:left;font:inherit;color:var(--ink);background:var(--card);border:1px solid ${BORDER};border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,${MD});cursor:pointer;-webkit-appearance:none;appearance:none;overflow:hidden;-webkit-tap-highlight-color:transparent;transform-origin:50% 100%;transform:translateX(calc(var(--o) * var(--step))) translateY(calc(var(--a) * var(--a) * 10px + var(--lift))) rotate(calc(var(--o) * 5deg));transition:transform .45s cubic-bezier(.2,.7,.2,1),box-shadow .16s ease,border-color .16s ease;animation:rg3-in .45s cubic-bezier(.2,.7,.2,1) both}
.cf-results-gate-3 .rg3-card.is-front{transform:translateX(calc(var(--o) * var(--step))) translateY(-14px) rotate(0deg) scale(1.04);box-shadow:${LG};border-color:color-mix(in oklch,var(--accent) 45%,var(--card))}
.cf-results-gate-3 .rg3-card:focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:4px}
.cf-results-gate-3 .rg3-art{position:relative;display:block;flex:0 0 auto;height:172px;border-radius:10px;overflow:hidden;background:color-mix(in oklch,var(--ink) 5%,var(--card))}
.cf-results-gate-3 .rg3-art img{display:block;width:100%;height:100%;object-fit:cover;object-position:var(--focus,50% 40%);transform-origin:var(--focus,50% 40%);transform:scale(var(--zoom,1))}
.cf-results-gate-3 .rg3-art svg{position:absolute;inset:0;margin:auto;width:40px;height:40px;color:var(--accent)}
.cf-results-gate-3 .rg3-name{display:block;margin:16px 4px 0;font-family:var(--font-display);font-size:clamp(1.3125rem,1.8vw,1.5rem);line-height:1.15;font-weight:var(--display-weight,800);letter-spacing:-0.01em;text-transform:var(--display-case,none);color:var(--ink);text-wrap:balance}
.cf-results-gate-3 .rg3-line{display:block;margin:6px 4px 14px;font-size:1rem;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-results-gate-3 .rg3-tag{display:inline-flex;align-items:center;gap:6px;align-self:flex-start;margin:auto 4px 0;min-height:28px;padding:4px 12px;border-radius:999px;background:color-mix(in oklch,var(--ink) 6%,var(--card));color:var(--ink);font-size:.875rem;line-height:1.2;font-weight:800}
.cf-results-gate-3 .rg3-tag svg{flex:none;width:16px;height:16px;color:var(--accent)}
.cf-results-gate-3 .rg3-dots{display:none}
.cf-results-gate-3 .rg3-form{position:relative;z-index:2;max-width:920px;margin:-72px auto 0;padding:clamp(20px,3vw,32px);background:var(--card);color:var(--ink);border:1px solid ${BORDER};border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,${MD})}
.cf-results-gate-3 .rg3-set{min-width:0;margin:0;padding:0;border:0}
.cf-results-gate-3 .rg3-ask{margin:0 0 20px;text-align:center;font-family:var(--font-display);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;font-weight:var(--display-weight,800);letter-spacing:-0.01em;text-transform:var(--display-case,none);color:var(--ink);text-wrap:balance}
.cf-results-gate-3 .rg3-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.25fr) auto;gap:12px 16px;align-items:start}
.cf-results-gate-3 .rg3-field{min-width:0}
.cf-results-gate-3 .rg3-label{display:block;margin:0 0 8px;font-size:1rem;line-height:20px;font-weight:700;color:var(--label-ink,var(--ink))}
.cf-results-gate-3 .rg3-control{position:relative;display:block}
.cf-results-gate-3 .rg3-control input{display:block;width:100%;height:56px;margin:0;padding:0 44px 0 46px;font:inherit;font-size:1.0625rem;color:var(--field-ink);background:var(--field);border:1px solid var(--field-border,color-mix(in oklch,var(--ink) 22%,transparent));border-radius:var(--field-radius,var(--radius,12px));outline:none;-webkit-appearance:none;appearance:none;transition:border-color .16s ease,box-shadow .16s ease}
.cf-results-gate-3 .rg3-control input::placeholder{color:color-mix(in oklch,var(--field-ink) 65%,var(--field));opacity:1}
.cf-results-gate-3 .rg3-control input:focus{border-color:var(--field-focus,var(--accent));box-shadow:0 0 0 3px oklch(from var(--field-focus,var(--accent)) l c h / .35)}
.cf-results-gate-3 .rg3-control input:disabled{cursor:not-allowed;background:color-mix(in oklch,var(--field-ink) 5%,var(--field))}
.cf-results-gate-3 .is-invalid .rg3-control input{border-color:var(--danger)}
.cf-results-gate-3 .is-invalid .rg3-control input:focus{box-shadow:0 0 0 3px oklch(from var(--danger) l c h / .3)}
.cf-results-gate-3 .rg3-fico{position:absolute;left:16px;top:50%;width:20px;height:20px;margin-top:-10px;color:color-mix(in oklch,var(--field-ink) 60%,var(--field));pointer-events:none}
.cf-results-gate-3 .rg3-ok{position:absolute;right:16px;top:50%;width:20px;height:20px;margin-top:-10px;color:var(--success);pointer-events:none}
.cf-results-gate-3 .rg3-err{margin:8px 0 0;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--danger);text-wrap:pretty}
.cf-results-gate-3 .rg3-err svg,.cf-results-gate-3 .rg3-alert svg,.cf-results-gate-3 .rg3-privacy svg{display:inline-block;width:16px;height:16px;vertical-align:-.15em;margin-inline-end:.4em}
.cf-results-gate-3 .rg3-btn{--b:var(--button-bg,var(--cta));--b2:var(--button-bg-2,var(--cta-2));--sh:var(--shadow,oklch(0.22 0.03 260));margin:28px 0 0;display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:56px;padding:0 28px;white-space:nowrap;border:0;font-family:var(--button-font,var(--font-display));font-size:clamp(1.125rem,1.4vw,1.25rem);line-height:1.15;font-weight:var(--button-weight,800);text-transform:var(--button-case,none);color:var(--button-ink,var(--cta-ink));text-shadow:var(--button-text-shadow,none);background:linear-gradient(180deg,oklch(from var(--b) calc(l + .04) c h),oklch(from var(--b2) calc(l - .02) c h));border-radius:var(--button-radius,var(--radius,12px));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--b) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--b) calc(l - .16) c h),0 1px 2px oklch(from var(--sh) l c h / .3),0 8px 16px -6px oklch(from var(--sh) l c h / .42));cursor:pointer;-webkit-tap-highlight-color:transparent;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
.cf-results-gate-3 .rg3-btn:not(:disabled):hover,.cf-results-gate-3 .rg3-form.is-hover .rg3-btn:not(:disabled){background:linear-gradient(180deg,oklch(from var(--b) calc(l - .01) c h),oklch(from var(--b2) calc(l - .07) c h));transform:translateY(-1px)}
.cf-results-gate-3 .rg3-btn:not(:disabled):active,.cf-results-gate-3 .rg3-form.is-active .rg3-btn:not(:disabled){transform:translateY(1px);background:linear-gradient(180deg,oklch(from var(--b) calc(l - .04) c h),oklch(from var(--b2) calc(l - .08) c h));box-shadow:inset 0 2px 4px oklch(from var(--b) calc(l - .22) c h / .5),inset 0 -2px 0 oklch(from var(--b) calc(l - .16) c h),0 1px 2px oklch(from var(--sh) l c h / .3)}
.cf-results-gate-3 .rg3-btn:focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:3px}
.cf-results-gate-3 .rg3-btn:disabled{cursor:not-allowed}
.cf-results-gate-3 .rg3-btn.is-off{background:color-mix(in oklch,var(--b) 14%,var(--card));color:color-mix(in oklch,var(--ink) 80%,var(--card));text-shadow:none;box-shadow:inset 0 0 0 1px oklch(from var(--ink) l c h / .1)}
.cf-results-gate-3 .rg3-btn.is-loading{cursor:progress}
.cf-results-gate-3 .rg3-bico{flex:none;width:20px;height:20px}
.cf-results-gate-3 .rg3-spin{animation:rg3-spin .8s linear infinite}
.cf-results-gate-3 .rg3-alert{margin:16px 0 0;padding:12px 16px;border-radius:10px;background:var(--danger-soft);color:var(--danger);font-size:.9375rem;line-height:1.4;font-weight:600;text-wrap:pretty}
.cf-results-gate-3 .rg3-privacy{margin:16px 0 0;text-align:center;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
.cf-results-gate-3 .rg3-privacy svg{color:var(--success)}
.cf-results-gate-3 .rg3-ps{margin:20px 0 0;padding-top:16px;border-top:1px solid oklch(from var(--ink) l c h / .1);text-align:center;font-size:1.0625rem;line-height:1.5;color:var(--ink);text-wrap:pretty}
.cf-results-gate-3 .rg3-ps strong{font-weight:800}
.cf-results-gate-3 .rg3-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
@media (hover:hover) and (min-width:880px){.cf-results-gate-3 .rg3-card:not(.is-front):hover{--lift:-12px}}
@media (max-width:879px){
.cf-results-gate-3 .rg3-stage{padding:24px 0 96px}
.cf-results-gate-3 .rg3-hint{padding:0 20px}
.cf-results-gate-3 .rg3-fan{container-type:normal;display:flex;gap:14px;height:auto;max-width:none;margin:16px 0 0;padding:10px 20px 18px;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x mandatory;scroll-padding-inline:20px;scrollbar-width:none}
.cf-results-gate-3 .rg3-fan::-webkit-scrollbar{display:none}
.cf-results-gate-3 .rg3-card,.cf-results-gate-3 .rg3-card.is-front{position:relative;left:auto;top:auto;flex:0 0 min(76%,300px);width:auto;height:auto;min-height:344px;margin:0;transform:none;scroll-snap-align:start}
.cf-results-gate-3 .rg3-card.is-front{box-shadow:var(--card-shadow,${MD})}
.cf-results-gate-3 .rg3-art{height:168px}
.cf-results-gate-3 .rg3-dots{position:relative;z-index:1;display:flex;justify-content:center;gap:6px;margin-top:2px}
.cf-results-gate-3 .rg3-dots span{width:8px;height:8px;border-radius:999px;background:oklch(from var(--ink) l c h / .22);transition:width .16s ease,background .16s ease}
.cf-results-gate-3 .rg3-dots span.is-on{width:22px;background:var(--accent-fill,var(--accent))}
.cf-results-gate-3 .rg3-form{margin:-64px 12px 0}
.cf-results-gate-3 .rg3-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
.cf-results-gate-3 .rg3-btn{grid-column:1 / -1;width:100%;margin-top:4px}
}
@media (max-width:559px){.cf-results-gate-3 .rg3-row{grid-template-columns:minmax(0,1fr)}}
@keyframes rg3-in{from{opacity:.82;translate:0 8px}to{opacity:1;translate:0 0}}
@keyframes rg3-spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.cf-results-gate-3 .rg3-card,.cf-results-gate-3 .rg3-btn,.cf-results-gate-3 .rg3-dots span,.cf-results-gate-3 .rg3-control input{animation:none;transition:none}.cf-results-gate-3 .rg3-spin{animation:none}.cf-results-gate-3 .rg3-fan{scroll-behavior:auto}}
`
pieces/forms/results-gate-3/specimen.tsx 82 lines
import __studioImage89ebc352 from "../assets/97e478893c28987e.webp";
import __studioImage1cb50607 from "../assets/60ed43841a6bfa4b.webp";
import * as React from 'react'
import defaults from '../../studio-defaults.json'
import { ResultsGate3, type ResultsGate3State, type ResultsGate3Type } from '../results-gate-3'
export const states = ['default', 'hover', 'active', 'disabled', 'error']
export default function ResultsGate3Specimen({ state = 'default' }: { state?: ResultsGate3State }) {
const pairA = __studioImage89ebc352
const pairB = __studioImage1cb50607
const types: ResultsGate3Type[] = [
{
name: 'The Grazer',
line: 'Nibbles little and often, all day long.',
image: pairA,
imageFocus: '0% 50%',
imageZoom: 1.7,
imageAlt: 'A relaxed beagle nibbling kibble beside a half-full bowl',
},
{
name: 'The Gulper',
line: 'Clears the bowl in seconds, then asks for more.',
image: pairA,
imageFocus: '100% 50%',
imageZoom: 1.7,
imageAlt: 'An excited Labrador diving nose-first into its food bowl',
},
{
name: 'The Picky Eater',
line: 'Sniffs the bowl, walks away, comes back later. Maybe.',
image: pairB,
imageFocus: '0% 50%',
imageZoom: 1.7,
imageAlt: 'A small white dog turning its nose up at a full bowl',
},
{
name: 'The Clockwork Eater',
line: 'Same time, same spot, same happy routine.',
image: pairB,
imageFocus: '100% 50%',
imageZoom: 1.7,
imageAlt: 'A border collie waiting politely by its bowl under a wall clock',
},
]
const filled =
state === 'hover' || state === 'active'
? { firstName: 'Dana', email: 'dana@example.com' }
: state === 'error'
? { firstName: 'Dana', email: 'dana@example' }
: undefined
return (
<ResultsGate3
key={state}
state={state}
defaultValues={filled}
headline='Which feeding style fits your dog?'
highlight='feeding style'
lead='Your dog is one of these four. Your answers decide which.'
types={types}
deckLabel='Every Copper & Kibble feeding style'
hint='Tap any card to bring it to the front.'
cardTag='Is this your dog?'
question='Ready to meet your dog’s feeding style?'
firstNamePlaceholder='Dana'
emailPlaceholder='dana@example.com'
label='Yes, show me my dog’s type'
loadingLabel='Matching your answers…'
lockedHint='Add your first name and email to unlock your dog’s results.'
privacy={`Free results. ${defaults.sample.registration.privacy}`}
ps='Your results show which feeding style fits your dog, and why it fits.'
nameError='Add your first name so we know who the results are for.'
emailError='Enter a valid email so we can show your dog’s results.'
error='We couldn’t open your results just now. Please try again.'
onSubmit={() => new Promise<void>((resolve) => setTimeout(resolve, 1400))}
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalResultsGate3 |
string |
Default 'Which type are you?'
|
highlight OptionalResultsGate3 |
string |
Default 'type'
|
lead OptionalResultsGate3 |
string |
Default 'You are one of these. Your answers decide which.'
|
types OptionalResultsGate3 |
ResultsGate3Type[] |
Default DEFAULT_TYPES
|
deckLabel OptionalResultsGate3 |
string |
Default 'Every possible result'
|
hint OptionalResultsGate3 |
string |
Default 'Tap any card to bring it to the front.'
|
keyHint OptionalResultsGate3 |
string |
Default 'Use the arrow keys to move between cards.'
|
cardTag OptionalResultsGate3 |
string |
Default 'Could this be you?'
|
question OptionalResultsGate3 |
string |
Default 'Ready to see which one is you?'
|
firstNameLabel OptionalResultsGate3 |
string |
Default 'First name'
|
firstNamePlaceholder OptionalResultsGate3 |
string |
Default 'Jane'
|
emailLabel OptionalResultsGate3 |
string |
Default 'Email address'
|
emailPlaceholder OptionalResultsGate3 |
string |
Default 'you@example.com'
|
label OptionalResultsGate3 |
string |
Default 'Yes, show me my type'
|
loadingLabel OptionalResultsGate3 |
string |
Default 'Matching your answers…'
|
lockedHint OptionalResultsGate3 |
string |
Default 'Add your first name and email to unlock your result.'
|
privacy OptionalResultsGate3 |
string |
Default 'Free to see. We respect your inbox. Unsubscribe anytime.'
|
psLabel OptionalResultsGate3 |
string |
Default 'P.S.'
|
ps OptionalResultsGate3 |
string |
Default 'Your answers already picked your type. Your details open it.'
|
nameError OptionalResultsGate3 |
string |
Default 'Add your first name so we know who the result is for.'
|
emailError OptionalResultsGate3 |
string |
Default 'Enter a valid email so we can show your result.'
|
error OptionalResultsGate3 |
string |
Default 'We couldn’t open your result just now. Please try again.'
|
defaultValues OptionalResultsGate3 |
Partial<ResultsGate3Values> |
|
headingLevel OptionalResultsGate3 |
'h2' | 'h3' |
Default 'h2'
|
state OptionalResultsGate3 |
ResultsGate3State |
Default 'default'
|
onSubmit OptionalResultsGate3 |
(values: ResultsGate3Values) => void | Promise<void> |
|
className OptionalResultsGate3 |
string |
|
style OptionalResultsGate3 |
React.CSSProperties |
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.
--card-border--card-h--card-radius--card-shadow--card-w- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field--field-border--field-focus--field-ink--field-radius- 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.
This piece reads no image slots.
-
60ed43841a6bfa4b.webp
image/webp · 44.4 KB
-
97e478893c28987e.webp
image/webp · 44 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB