Closing Opt-in 4
Closing opt-in block: the reader rehearses their first week with the free guide in three paced panels over a themed photo, then meets a sticky form card that overlaps the photo's edge. The builder wires onSubmit.
Use it in a prompt
Use forms/closing-optin-4 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/closing-optin-4.tsx. - Import it and pass your copy and images (Props tab):
import { ClosingOptin4 } from "@/components/funneldna/forms/closing-optin-4"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/forms/closing-optin-4/component.tsx 519 lines
// layout: photo-overlap-card
// Closing opt-in block: the reader rehearses their first week with the free guide in three paced panels over a themed photo, then meets a sticky form card that overlaps the photo's edge. The builder wires onSubmit.
import React from 'react'
import { AlertCircle, ChevronDown, Loader2, Lock } from 'lucide-react'
import { Backdrop, Scrim, Spot, FX_HOST } from '../fx/fx'
import home from '../fx/backdrops/home'
import book from '../fx/spots/book'
import calendar from '../fx/spots/calendar'
import community from '../fx/spots/community'
export type ClosingOptin4Panel = {
// the time cue that opens the line, e.g. 'Tonight,'
when: string
// the rest of the rehearsed line, e.g. 'you open the guide.'
line: string
// one short sentence on how they use the guide at that point
detail?: React.ReactNode
// fx Spot illustration (an imported asset); defaults to book, calendar, community
spot?: string
}
export type ClosingOptin4Option = { value: string; label: string }
export type ClosingOptin4Values = { firstName: string; email: string; role: string }
export type ClosingOptin4State = 'default' | 'hover' | 'active' | 'disabled' | 'error'
export type ClosingOptin4Props = {
headline?: React.ReactNode
lead?: React.ReactNode
// the paced moments; three reads best
panels?: ClosingOptin4Panel[]
// fx backdrop photo (an imported asset); a page's scene slot replaces it inside Backdrop
backdropImage?: string
formHeadline?: string
// phrase inside formHeadline that gets the marker stroke
highlight?: string
// small-caps label that opens the investment line
investmentLabel?: string
investmentText?: React.ReactNode
// slot: product, transparent background
productImage?: string
productAlt?: string
firstNameLabel?: string
firstNamePlaceholder?: string
emailLabel?: string
emailPlaceholder?: string
roleLabel?: string
rolePlaceholder?: string
// the optional select shows only when options are supplied
roleOptions?: ClosingOptin4Option[]
// button label; use the same CTA wording as the rest of the page
label?: string
// one reassurance line under the button
note?: React.ReactNode
privacy?: React.ReactNode
copy?: {
// '{label}' is replaced with the field label
required?: string
invalidEmail?: string
optional?: string
pending?: string
}
// receives validated, trimmed values; return a promise to show the busy state until it settles
onSubmit?: (values: ClosingOptin4Values) => void | Promise<unknown>
disabled?: boolean
state?: ClosingOptin4State
id?: string
className?: string
}
type Errors = Partial<Record<'firstName' | 'email', string>>
const SPOTS: string[] = [book, calendar, community]
const DEFAULT_PANELS: ClosingOptin4Panel[] = [
{ when: 'Tonight,', line: 'you open the guide.', detail: 'Read the first chapter in one sitting and see what to tackle first.' },
{ when: 'This weekend,', line: 'you work through the checklist.', detail: 'Tick off the first steps with the guide open beside you.' },
{ when: 'By next month,', line: 'you follow your own plan.', detail: 'Come back to the pages you marked whenever the next question comes up.' },
]
const DEFAULT_COPY = {
required: 'Please enter your {label}.',
invalidEmail: 'That email looks incomplete. Try something like you@example.com.',
optional: '(optional)',
pending: 'Sending your guide…',
}
const EMPTY: ClosingOptin4Values = { firstName: '', email: '', role: '' }
const EMAIL = /^[^ @]+@[^ @]+[.][^ @]+$/
export function ClosingOptin4(props: ClosingOptin4Props) {
const {
headline = 'Picture your first week with the guide',
lead = 'Walk through it once, right here. Then grab your free copy.',
panels = DEFAULT_PANELS,
backdropImage = home,
formHeadline = 'Get your free guide tonight',
highlight = 'free guide',
investmentLabel = 'Your investment:',
investmentText = 'nothing. The guide is free and arrives by email.',
productImage,
productAlt = '',
firstNameLabel = 'First name',
firstNamePlaceholder = 'Dana',
emailLabel = 'Email address',
emailPlaceholder = 'you@example.com',
roleLabel = 'I’m a…',
rolePlaceholder = 'Choose one',
roleOptions = [],
label = 'Send Me The Free Guide',
note = 'Free PDF · Sent to your inbox',
privacy = 'We respect your inbox. Unsubscribe anytime.',
copy,
onSubmit,
disabled = false,
state = 'default',
id,
className,
} = props
const c = { ...DEFAULT_COPY, ...copy }
const list = panels.length ? panels : DEFAULT_PANELS
const labels = { firstName: firstNameLabel, email: emailLabel }
const uid = React.useId()
const ids = {
head: uid + '-head',
title: uid + '-title',
first: uid + '-first',
email: uid + '-email',
role: uid + '-role',
}
const isDisabled = disabled || state === 'disabled'
const [values, setValues] = React.useState<ClosingOptin4Values>(EMPTY)
const [errors, setErrors] = React.useState<Errors>(() => (state === 'error' ? validate(EMPTY, labels, c) : {}))
const [pending, setPending] = React.useState(false)
const [armed, setArmed] = React.useState(false)
const [seen, setSeen] = React.useState<boolean[]>([])
const panelRefs = React.useRef<(HTMLLIElement | null)[]>([])
const inputRefs = React.useRef<Record<string, HTMLInputElement | null>>({})
const mounted = React.useRef(true)
React.useEffect(() => {
mounted.current = true
return () => {
mounted.current = false
}
}, [])
React.useEffect(() => {
setErrors(state === 'error' ? validate(EMPTY, labels, c) : {})
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [state])
// Signature: each paced panel rises in with the house reveal as it scrolls into view.
// Panels render finished first; the reveal is armed only when motion is allowed.
React.useEffect(() => {
if (typeof window === 'undefined' || typeof IntersectionObserver === 'undefined') return
if (window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches) return
const els = panelRefs.current.filter(Boolean) as HTMLLIElement[]
if (!els.length) return
setArmed(true)
const io = new IntersectionObserver(
(entries) => {
const hits: number[] = []
entries.forEach((e) => {
if (!e.isIntersecting) return
hits.push(Number((e.target as HTMLElement).dataset.index))
io.unobserve(e.target)
})
if (!hits.length) return
setSeen((s) => {
const next = [...s]
hits.forEach((i) => {
next[i] = true
})
return next
})
},
{ threshold: 0.25, rootMargin: '0px 0px -8% 0px' },
)
els.forEach((el) => io.observe(el))
return () => io.disconnect()
}, [list.length])
const update = (name: keyof ClosingOptin4Values, value: string) => {
setValues((v) => ({ ...v, [name]: value }))
if (name === 'role' || !errors[name]) return
const next = validate({ ...values, [name]: value }, labels, c)
if (!next[name]) {
setErrors((e) => {
const n = { ...e }
delete n[name]
return n
})
}
}
const blurEmail = () => {
const email = values.email.trim()
if (email && !EMAIL.test(email)) setErrors((e) => ({ ...e, email: c.invalidEmail }))
}
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault()
if (isDisabled || pending) return
const found = validate(values, labels, c)
setErrors(found)
const firstInvalid = (['firstName', 'email'] as const).find((k) => found[k])
if (firstInvalid) {
inputRefs.current[firstInvalid]?.focus()
return
}
const clean: ClosingOptin4Values = {
firstName: values.firstName.trim(),
email: values.email.trim(),
role: values.role,
}
const result: unknown = onSubmit?.(clean)
if (isThenable(result)) {
setPending(true)
const done = () => {
if (mounted.current) setPending(false)
}
result.then(done, done)
}
}
const btnClass = ['cf-co4__btn', state === 'hover' ? 'is-hover' : '', state === 'active' ? 'is-active' : '']
.filter(Boolean)
.join(' ')
return (
<section
id={id}
className={['cf-co4', className].filter(Boolean).join(' ')}
data-armed={armed ? 'true' : undefined}
aria-labelledby={ids.head}
>
<style>{CSS}</style>
<div className="cf-co4__wrap">
<div className="cf-co4__frame" style={FX_HOST}>
<div className="cf-co4__media" aria-hidden="true">
<Backdrop src={backdropImage} treatment="duotone" side="left" />
<Scrim side="left" />
</div>
<div className="cf-co4__story">
<h2 id={ids.head} className="cf-co4__h2">
{headline}
</h2>
{lead ? <p className="cf-co4__lead">{lead}</p> : null}
<ol className="cf-co4__panels">
{list.map((p, i) => (
<li
key={i}
ref={(el) => {
panelRefs.current[i] = el
}}
data-index={i}
className={seen[i] ? 'cf-co4__panel is-in' : 'cf-co4__panel'}
style={{ ['--d' as string]: Math.min(i * 0.07, 0.28) + 's' } as React.CSSProperties}
>
<span className="cf-co4__spot" aria-hidden="true">
<Spot src={p.spot ?? SPOTS[i % SPOTS.length]} size={64} />
</span>
<div className="cf-co4__panel-copy">
<h3 className="cf-co4__h3">
<span className="cf-co4__when">{p.when}</span> {p.line}
</h3>
{p.detail ? <p className="cf-co4__detail">{p.detail}</p> : null}
</div>
</li>
))}
</ol>
</div>
</div>
<aside className="cf-co4__aside" aria-labelledby={ids.title}>
<div className="cf-co4__card">
<div className={productImage ? 'cf-co4__head has-img' : 'cf-co4__head'}>
{productImage ? (
<img className="cf-co4__product" src={productImage} alt={productAlt} width={176} height={240} loading="lazy" />
) : null}
<div>
<h3 id={ids.title} className="cf-co4__title">
{marked(formHeadline, highlight)}
</h3>
{investmentText ? (
<p className="cf-co4__invest">
<span className="cf-co4__sc">{investmentLabel}</span> {investmentText}
</p>
) : null}
</div>
</div>
<form className="cf-co4__form" onSubmit={handleSubmit} noValidate aria-labelledby={ids.title}>
<div className="cf-co4__field">
<label htmlFor={ids.first} className="cf-co4__label">
{firstNameLabel}
</label>
<input
id={ids.first}
ref={(el) => {
inputRefs.current.firstName = el
}}
className="cf-co4__input"
name="firstName"
type="text"
autoComplete="given-name"
placeholder={firstNamePlaceholder}
value={values.firstName}
onChange={(e) => update('firstName', e.target.value)}
required
disabled={isDisabled}
aria-invalid={errors.firstName ? true : undefined}
aria-describedby={errors.firstName ? ids.first + '-err' : undefined}
/>
{errors.firstName ? (
<p id={ids.first + '-err'} className="cf-co4__err" role="alert">
<AlertCircle className="cf-co4__inline-icon" size={16} strokeWidth={2.5} aria-hidden="true" />
{errors.firstName}
</p>
) : null}
</div>
<div className="cf-co4__field">
<label htmlFor={ids.email} className="cf-co4__label">
{emailLabel}
</label>
<input
id={ids.email}
ref={(el) => {
inputRefs.current.email = el
}}
className="cf-co4__input"
name="email"
type="email"
inputMode="email"
autoComplete="email"
placeholder={emailPlaceholder}
value={values.email}
onChange={(e) => update('email', e.target.value)}
onBlur={blurEmail}
required
disabled={isDisabled}
aria-invalid={errors.email ? true : undefined}
aria-describedby={errors.email ? ids.email + '-err' : undefined}
/>
{errors.email ? (
<p id={ids.email + '-err'} className="cf-co4__err" role="alert">
<AlertCircle className="cf-co4__inline-icon" size={16} strokeWidth={2.5} aria-hidden="true" />
{errors.email}
</p>
) : null}
</div>
{roleOptions.length ? (
<div className="cf-co4__field">
<label htmlFor={ids.role} className="cf-co4__label">
{roleLabel} <span className="cf-co4__opt">{c.optional}</span>
</label>
<div className="cf-co4__select-wrap">
<select
id={ids.role}
name="role"
className={values.role ? 'cf-co4__input cf-co4__select' : 'cf-co4__input cf-co4__select is-empty'}
value={values.role}
onChange={(e) => update('role', e.target.value)}
disabled={isDisabled}
>
<option value="" disabled>
{rolePlaceholder}
</option>
{roleOptions.map((o) => (
<option key={o.value} value={o.value}>
{o.label}
</option>
))}
</select>
<ChevronDown className="cf-co4__chev" size={20} strokeWidth={2.5} aria-hidden="true" />
</div>
</div>
) : null}
<button type="submit" className={btnClass} disabled={isDisabled} aria-busy={pending || undefined}>
{pending ? (
<>
<Loader2 className="cf-co4__spin" size={20} strokeWidth={2.5} aria-hidden="true" />
<span>{c.pending}</span>
</>
) : (
<span>{label}</span>
)}
</button>
{note ? <p className="cf-co4__note">{note}</p> : null}
{privacy ? (
<p className="cf-co4__privacy">
<Lock className="cf-co4__inline-icon" size={16} strokeWidth={2.5} aria-hidden="true" />
{privacy}
</p>
) : null}
</form>
</div>
</aside>
</div>
</section>
)
}
export default ClosingOptin4
function validate(v: ClosingOptin4Values, labels: { firstName: string; email: string }, c: typeof DEFAULT_COPY): Errors {
const e: Errors = {}
if (!v.firstName.trim()) e.firstName = fill(c.required, labels.firstName)
const email = v.email.trim()
if (!email) e.email = fill(c.required, labels.email)
else if (!EMAIL.test(email)) e.email = c.invalidEmail
return e
}
function fill(template: string, label: string) {
return template.replace('{label}', label.toLowerCase())
}
function isThenable(value: unknown): value is Promise<unknown> {
return typeof value === 'object' && value !== null && typeof (value as { then?: unknown }).then === 'function'
}
function marked(text: string, phrase?: string): React.ReactNode {
if (!phrase) return text
const i = text.indexOf(phrase)
if (i < 0) return text
return (
<>
{text.slice(0, i)}
<span className="cf-co4__mark">{phrase}</span>
{text.slice(i + phrase.length)}
</>
)
}
const CSS = `
.cf-co4{--co4-shadow:var(--shadow, oklch(0.22 0.03 260));--co4-marker:oklch(from var(--marker, #fae37c) l c h / 0.8);--co4-focus:var(--field-focus, var(--accent));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)}
.cf-co4 *,.cf-co4 *::before,.cf-co4 *::after{box-sizing:border-box}
.cf-co4 :where(h2,h3,p,ol,li){margin:0}
.cf-co4__wrap{max-width:1120px;margin-inline:auto;display:grid;grid-template-columns:minmax(0,1fr) 64px minmax(320px,380px);align-items:start}
.cf-co4__frame{--fg:var(--band-ink);--fg-2:var(--band-ink);grid-column:1/3;grid-row:1;position:relative;isolation:isolate;overflow:hidden;border-radius:var(--radius,12px);background:var(--band);color:var(--fg);padding:clamp(40px,5vw,64px) calc(64px + clamp(28px,3.5vw,40px)) clamp(40px,5vw,64px) clamp(28px,4vw,56px)}
.cf-co4__media{position:absolute;inset:0;z-index:0;overflow:hidden}
.cf-co4__story{position:relative;z-index:1}
.cf-co4__h2{font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;text-wrap:balance;color:var(--fg);margin:0 0 16px}
.cf-co4__lead{font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--fg);max-width:46ch;text-wrap:pretty;margin:0 0 32px}
.cf-co4__panels{list-style:none;padding:0;margin:0;display:grid;gap:16px}
.cf-co4__panel{display:grid;grid-template-columns:64px minmax(0,1fr);gap:20px;align-items:start;padding:clamp(20px,2.4vw,28px);border-radius:var(--card-radius,var(--radius,14px));background:oklch(from var(--band) l c h / 0.8);border:1px solid oklch(from var(--band-ink) l c h / 0.16);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);transition:opacity .45s cubic-bezier(.2,.7,.2,1) var(--d,0s),transform .45s cubic-bezier(.2,.7,.2,1) var(--d,0s)}
.cf-co4[data-armed='true'] .cf-co4__panel:not(.is-in){opacity:.82;transform:translateY(8px)}
.cf-co4__spot{display:block;width:64px;height:64px}
.cf-co4__panel-copy{min-width:0}
.cf-co4__h3{font-family:var(--font-display);font-weight:800;letter-spacing:-0.01em;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;color:var(--fg);text-wrap:balance}
.cf-co4__detail{margin-top:8px;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;font-weight:400;color:var(--fg-2);text-wrap:pretty}
.cf-co4__aside{grid-column:2/4;grid-row:1;position:sticky;top:24px;z-index:2;margin-top:clamp(32px,4vw,56px)}
.cf-co4__card{background:var(--card);color:var(--ink);border:1px solid var(--card-border,oklch(from var(--ink) l c h / 0.12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(from var(--co4-shadow) l c h / 0.22),0 12px 24px -8px oklch(from var(--co4-shadow) l c h / 0.32)));padding:clamp(20px,3vw,32px)}
.cf-co4__head.has-img{display:grid;grid-template-columns:88px minmax(0,1fr);gap:16px;align-items:start}
.cf-co4__product{display:block;width:88px;height:auto;max-height:124px;object-fit:contain;filter:drop-shadow(0 2px 3px oklch(from var(--co4-shadow) l c h / 0.3)) drop-shadow(0 10px 12px oklch(from var(--co4-shadow) l c h / 0.22))}
.cf-co4__title{font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;color:var(--ink);text-wrap:balance}
.cf-co4__mark{background:linear-gradient(to bottom,transparent 56%,var(--co4-marker) 56%,var(--co4-marker) 94%,transparent 94%);-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:0 .14em;margin:0 -.06em;border-radius:.18em .4em .3em .22em}
.cf-co4__invest{margin-top:12px;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
.cf-co4__sc{font-variant-caps:all-small-caps;letter-spacing:.06em;font-weight:800;color:var(--ink)}
.cf-co4__form{display:grid;gap:16px;margin-top:24px}
.cf-co4__field{display:grid;gap:8px}
.cf-co4__label{font-size:1rem;font-weight:700;line-height:1.2;color:var(--label-ink,var(--ink))}
.cf-co4__opt{font-weight:500;color:var(--muted)}
.cf-co4__input{width:100%;height:56px;padding:0 16px;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));box-shadow:inset 0 1px 2px oklch(from var(--co4-shadow) l c h / 0.08);outline:none;transition:border-color .16s ease,box-shadow .16s ease}
.cf-co4__input::placeholder{color:color-mix(in oklch,var(--field-ink) 65%,var(--field));opacity:1}
.cf-co4__input:hover:not(:disabled){border-color:color-mix(in oklch,var(--ink) 40%,transparent)}
.cf-co4__input:focus{border-color:var(--co4-focus);box-shadow:0 0 0 3px oklch(from var(--co4-focus) l c h / 0.35)}
.cf-co4__input[aria-invalid='true']{border-color:var(--danger)}
.cf-co4__input[aria-invalid='true']:focus{box-shadow:0 0 0 3px oklch(from var(--danger) l c h / 0.3)}
.cf-co4__input:disabled{background:color-mix(in oklch,var(--ink) 4%,var(--field));cursor:not-allowed}
.cf-co4__select-wrap{position:relative}
.cf-co4__select{appearance:none;-webkit-appearance:none;padding-right:48px;cursor:pointer}
.cf-co4__select.is-empty{color:color-mix(in oklch,var(--field-ink) 65%,var(--field))}
.cf-co4__select option{color:var(--field-ink);background:var(--field)}
.cf-co4__chev{position:absolute;right:16px;top:50%;margin-top:-10px;color:var(--field-ink);pointer-events:none}
.cf-co4__err{font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--danger);text-wrap:pretty}
.cf-co4__inline-icon{display:inline-block;vertical-align:-0.15em;margin-inline-end:.4em}
.cf-co4__btn{appearance:none;border:0;margin-top:8px;width:100%;min-height:56px;padding:12px 28px;display:inline-flex;align-items:center;justify-content:center;gap:10px;text-align:center;text-wrap:balance;border-radius:var(--button-radius,var(--radius,12px));font-family:var(--button-font,var(--font-display));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;color:var(--button-ink,var(--cta-ink));text-shadow:var(--button-text-shadow,none);background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l + 0.04) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - 0.02) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta)) calc(l + 0.14) c h / 0.7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.16) c h),0 1px 2px oklch(from var(--co4-shadow) l c h / 0.3),0 8px 16px -6px oklch(from var(--co4-shadow) l c h / 0.45));cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
.cf-co4__btn:hover:not(:disabled),.cf-co4__btn.is-hover:not(:disabled){background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l - 0.01) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - 0.07) c h));box-shadow:inset 0 1px 0 oklch(from var(--button-bg,var(--cta)) calc(l + 0.12) c h / 0.6),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.2) c h),0 1px 2px oklch(from var(--co4-shadow) l c h / 0.32),0 10px 20px -6px oklch(from var(--co4-shadow) l c h / 0.5);transform:translateY(-1px)}
.cf-co4__btn:active:not(:disabled),.cf-co4__btn.is-active:not(:disabled){background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - 0.08) c h));box-shadow:inset 0 2px 4px oklch(from var(--button-bg,var(--cta)) calc(l - 0.22) c h / 0.55),inset 0 -2px 0 oklch(from var(--button-bg,var(--cta)) calc(l - 0.18) c h),0 1px 2px oklch(from var(--co4-shadow) l c h / 0.3);transform:translateY(1px)}
.cf-co4__btn:focus-visible{outline:3px solid var(--co4-focus);outline-offset:3px}
.cf-co4__btn:disabled{background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));box-shadow:var(--button-2-shadow,var(--shadow-sm));text-shadow:none;cursor:not-allowed;transform:none}
.cf-co4__btn[aria-busy='true']{cursor:progress}
.cf-co4__spin{animation:cf-co4-spin .8s linear infinite}
@keyframes cf-co4-spin{to{transform:rotate(360deg)}}
.cf-co4__note{margin-top:4px;text-align:center;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-co4__privacy{text-align:center;font-size:.875rem;font-weight:500;line-height:1.4;color:var(--muted);text-wrap:pretty}
@media (max-width:1024px){
.cf-co4__wrap{grid-template-columns:minmax(0,1fr);row-gap:40px}
.cf-co4__frame{--fg:var(--ink);--fg-2:var(--muted);grid-column:1;grid-row:1;width:100%;max-width:720px;margin-inline:auto;background:transparent;overflow:visible;border-radius:0;padding:0}
.cf-co4__media{position:relative;inset:auto;height:clamp(168px,40vw,260px);margin-bottom:24px;border-radius:var(--radius,12px);background:var(--band)}
.cf-co4__panels{gap:20px}
.cf-co4__panel{background:none;border:0;border-top:1px solid oklch(from var(--ink) l c h / 0.12);border-radius:0;padding:20px 0 0;-webkit-backdrop-filter:none;backdrop-filter:none}
.cf-co4__panel:first-child{border-top:0;padding-top:0}
.cf-co4__aside{grid-column:1;grid-row:2;position:static;width:100%;max-width:720px;margin:0 auto}
}
@media (prefers-reduced-motion:reduce){
.cf-co4__panel,.cf-co4__btn,.cf-co4__input{transition:none}
.cf-co4[data-armed='true'] .cf-co4__panel:not(.is-in){opacity:1;transform:none}
.cf-co4__btn:hover:not(:disabled),.cf-co4__btn.is-hover:not(:disabled),.cf-co4__btn:active:not(:disabled),.cf-co4__btn.is-active:not(:disabled){transform:none}
.cf-co4__spin{animation:none}
}
`
pieces/forms/closing-optin-4/specimen.tsx 57 lines
import __studioImage8d3c712f from "../assets/9cf9bacd2f6a7252.webp";
import React from 'react'
import { ClosingOptin4, type ClosingOptin4State } from '../closing-optin-4'
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
export const states = ['default', 'hover', 'active', 'disabled', 'error']
export default function ClosingOptin4Specimen({ state = 'default' }: { state?: string }) {
return (
<ClosingOptin4
headline="Picture your first week as a new foster parent"
lead="Before you ask for the guide, walk through how you’ll use it."
panels={[
{
when: 'Tonight,',
line: 'you open the guide.',
detail: 'Read the welcome chapter on the couch and see what to have ready before placement day.',
},
{
when: 'This weekend,',
line: 'you get the room ready.',
detail: 'Work down the room-ready list, from the bed to the night light, with the guide open beside you.',
},
{
when: 'By next month,',
line: 'you know who to call.',
detail: 'Fill in the support contacts page so your caseworker, school and respite numbers sit in one place.',
},
]}
formHeadline="Get your free Starter Guide tonight"
highlight="free Starter Guide"
investmentLabel="Your investment:"
investmentText="nothing. Harbor Kids Alliance sends the New Foster Parent Starter Guide free by email."
productImage={slot(
'product',
__studioImage8d3c712f,
)}
productAlt="New Foster Parent Starter Guide cover"
firstNameLabel="First name"
firstNamePlaceholder="Dana"
emailLabel="Email address"
emailPlaceholder="you@example.com"
roleLabel="I’m a…"
rolePlaceholder="Choose one"
roleOptions={[
{ value: 'foster', label: 'Foster carer' },
{ value: 'adoptive', label: 'Adoptive parent' },
{ value: 'kinship', label: 'Kinship carer' },
]}
label="Send Me The Free Guide"
note="Free PDF from Harbor Kids Alliance · Sent by email"
privacy={defaults.sample.registration.privacy}
state={state as ClosingOptin4State}
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalClosingOptin4 |
React.ReactNode |
|
lead OptionalClosingOptin4 |
React.ReactNode |
|
panels OptionalClosingOptin4 |
ClosingOptin4Panel[] |
|
backdropImage OptionalClosingOptin4 |
string |
|
formHeadline OptionalClosingOptin4 |
string |
|
highlight OptionalClosingOptin4 |
string |
|
investmentLabel OptionalClosingOptin4 |
string |
|
investmentText OptionalClosingOptin4 |
React.ReactNode |
|
productImage OptionalClosingOptin4 |
string |
|
productAlt OptionalClosingOptin4 |
string |
|
firstNameLabel OptionalClosingOptin4 |
string |
|
firstNamePlaceholder OptionalClosingOptin4 |
string |
|
emailLabel OptionalClosingOptin4 |
string |
|
emailPlaceholder OptionalClosingOptin4 |
string |
|
roleLabel OptionalClosingOptin4 |
string |
|
rolePlaceholder OptionalClosingOptin4 |
string |
|
roleOptions OptionalClosingOptin4 |
ClosingOptin4Option[] |
|
label OptionalClosingOptin4 |
string |
|
note OptionalClosingOptin4 |
React.ReactNode |
|
privacy OptionalClosingOptin4 |
React.ReactNode |
|
copy OptionalClosingOptin4 |
{
// '{label}' is replaced with the field label
required?: string
invalidEmail?: string
optional?: string
pending?: string
} |
|
onSubmit OptionalClosingOptin4 |
(values: ClosingOptin4Values) => void | Promise<unknown> |
|
disabled OptionalClosingOptin4 |
boolean |
|
state OptionalClosingOptin4 |
ClosingOptin4State |
|
id OptionalClosingOptin4 |
string |
|
className OptionalClosingOptin4 |
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-ink--button-2-shadow- 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--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.
product- The main product shot or cover (ebook, kit, bottle).
-
321240b3188e2da4.webp
image/webp · 18.7 KB
-
4b82104bfd627615.webp
image/webp · 44.9 KB
-
5602e47ebdb81810.webp
image/webp · 35.6 KB
-
9cf9bacd2f6a7252.webp
image/webp · 94.1 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
bc3d360c88eeac0e.webp
image/webp · 23.9 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB