Closing Opt-in 7
Closing opt-in block: one big question the free guide answers, the reader’s own words on one side and the restated promise with an inline name/email form on the other, so the visitor sees their problem and the way out in one look. The button names the guide; the builder wires onSubmit.
Use it in a prompt
Use forms/closing-optin-7 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-7.tsx. - Import it and pass your copy and images (Props tab):
import { ClosingOptin7 } from "@/components/funneldna/forms/closing-optin-7"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/forms/closing-optin-7/component.tsx 781 lines
// layout: before-after-split
// Closing opt-in block: one big question the free guide answers, the reader’s own words on one side and the restated promise with an inline name/email form on the other, so the visitor sees their problem and the way out in one look. The button names the guide; the builder wires onSubmit.
import React from 'react'
import { AlertCircle, Loader2, Lock } from 'lucide-react'
import { Divider, FX_HOST, Texture } from '../fx/fx'
import weave from '../fx/textures/weave'
export type ClosingOptin7Quote = {
// the reader’s words exactly as supplied; curly quote marks are added around them
text: React.ReactNode
// who said it, e.g. 'Maya T.'
name?: string
// short context after the name, e.g. 'Columbus'
detail?: string
}
export type ClosingOptin7Values = { name: string; email: string }
export type ClosingOptin7State = 'default' | 'hover' | 'active' | 'disabled' | 'error'
type DividerTone = React.ComponentProps<typeof Divider>['tone']
export type ClosingOptin7Props = {
// the question the guide answers
headline?: React.ReactNode
// phrase inside a string headline that gets the marker stroke
highlight?: string
// one sentence that introduces the reader quotes
quotesIntro?: React.ReactNode
// accessible name of the quote list
quotesLabel?: string
// supplied reader quotes (up to three); without them the block becomes a promise-and-form split
quotes?: ClosingOptin7Quote[]
// the promise restated in one or two sentences
promise?: React.ReactNode
// bold lead-in before the numbered reasons
reasonsIntro?: React.ReactNode
// short reasons, numbered inline (three read best)
reasons?: React.ReactNode[]
// the plain instruction right before the form
instruction?: React.ReactNode
// the selling headline inside the form card
formHeading?: React.ReactNode
// the guide’s name; '{guide}' in label and copy.pending is replaced with it
guideName?: string
// button label; '{guide}' echoes the guide name
label?: string
// slot: product, the guide on a transparent background
productImage?: string
productAlt?: string
nameLabel?: string
namePlaceholder?: string
// ask for the name as optional instead of required
nameOptional?: boolean
emailLabel?: string
emailPlaceholder?: string
privacy?: React.ReactNode
copy?: {
nameRequired?: string
emailRequired?: string
emailInvalid?: string
optional?: string
// '{guide}' is replaced with the guide name
pending?: string
}
// tactile weave texture across the band
texture?: boolean
// curved hand-off into the next section
edge?: boolean
// token name of the next section’s background, used for the curve
edgeTone?: DividerTone
// receives validated, trimmed values; return a promise to show the busy state until it settles
onSubmit?: (values: ClosingOptin7Values) => void | Promise<unknown>
disabled?: boolean
state?: ClosingOptin7State
id?: string
className?: string
}
const DEFAULT_REASONS: React.ReactNode[] = ['It costs nothing.', 'You can start the same day.', 'It’s yours to keep.']
const NO_QUOTES: ClosingOptin7Quote[] = []
const DEFAULT_COPY = {
nameRequired: 'Please enter your first name.',
emailRequired: 'Please enter your email address.',
emailInvalid: 'That email looks incomplete. Try something like you@example.com.',
optional: '(optional)',
pending: 'Sending {guide}…',
}
type Copy = typeof DEFAULT_COPY
type Errors = Partial<Record<keyof ClosingOptin7Values, string>>
const EMPTY: ClosingOptin7Values = { name: '', email: '' }
const EMAIL = /^[^ @]+@[^ @]+[.][^ @]+$/
const EDGE = 56
export function ClosingOptin7(props: ClosingOptin7Props) {
const {
headline = 'What if your next step was already planned for you?',
highlight = 'already planned',
quotesIntro = 'Sound familiar? You told us:',
quotesLabel = 'What readers told us',
quotes = NO_QUOTES,
promise = 'The free guide answers that question with a simple plan you can start using today.',
reasonsIntro = 'Three reasons to grab it now:',
reasons = DEFAULT_REASONS,
instruction = 'Enter your name and email to get it free.',
formHeading = 'Get your free copy now',
guideName = 'The Free Guide',
label = 'Send Me {guide}',
productImage,
productAlt = '',
nameLabel = 'First name',
namePlaceholder = 'Jane',
nameOptional = false,
emailLabel = 'Email address',
emailPlaceholder = 'you@example.com',
privacy = 'We respect your inbox. Unsubscribe anytime.',
copy,
texture = true,
edge = true,
edgeTone = 'band' as DividerTone,
onSubmit,
disabled = false,
state = 'default',
id,
className,
} = props
const c: Copy = { ...DEFAULT_COPY, ...copy }
const uid = React.useId()
const ids = {
head: uid + '-head',
form: uid + '-form',
name: uid + '-name',
nameErr: uid + '-name-err',
email: uid + '-email',
emailErr: uid + '-email-err',
privacy: uid + '-privacy',
}
const shown = quotes.slice(0, 3)
const hasQuotes = shown.length > 0
const isDisabled = disabled || state === 'disabled'
const forceError = state === 'error'
const buttonText = fill(label, guideName)
const pendingText = fill(c.pending, guideName)
const [values, setValues] = React.useState<ClosingOptin7Values>(EMPTY)
const [errors, setErrors] = React.useState<Errors>(() => (forceError ? check(EMPTY, c, nameOptional) : {}))
const [pending, setPending] = React.useState(false)
const [reveal, setReveal] = React.useState<'idle' | 'armed' | 'seen'>('idle')
const rootRef = React.useRef<HTMLElement | null>(null)
const nameRef = React.useRef<HTMLInputElement | null>(null)
const emailRef = React.useRef<HTMLInputElement | null>(null)
const mounted = React.useRef(true)
React.useEffect(() => {
mounted.current = true
return () => {
mounted.current = false
}
}, [])
React.useEffect(() => {
setErrors(forceError ? check(EMPTY, c, nameOptional) : {})
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [state])
// the block renders finished first; only when motion is allowed is the reveal armed and played once in view
React.useEffect(() => {
const el = rootRef.current
if (!el || typeof window === 'undefined' || typeof IntersectionObserver === 'undefined') return
if (window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches) return
setReveal('armed')
const io = new IntersectionObserver(
(entries) => {
if (entries.some((entry) => entry.isIntersecting)) {
setReveal('seen')
io.disconnect()
}
},
{ threshold: 0.15, rootMargin: '0px 0px -8% 0px' },
)
io.observe(el)
return () => io.disconnect()
}, [])
const update = (key: keyof ClosingOptin7Values, value: string) => {
const next = { ...values, [key]: value }
setValues(next)
if (!errors[key]) return
const found = check(next, c, nameOptional)
if (!found[key]) {
setErrors((prev) => {
const copyErrors = { ...prev }
delete copyErrors[key]
return copyErrors
})
}
}
const blurEmail = () => {
const value = values.email.trim()
if (value && !EMAIL.test(value)) setErrors((prev) => ({ ...prev, email: c.emailInvalid }))
}
const submit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault()
if (isDisabled || pending) return
const found = check(values, c, nameOptional)
setErrors(found)
if (found.name) {
nameRef.current?.focus()
return
}
if (found.email) {
emailRef.current?.focus()
return
}
const clean: ClosingOptin7Values = { name: values.name.trim(), email: values.email.trim() }
const result: unknown = onSubmit?.(clean)
if (isThenable(result)) {
setPending(true)
const done = () => {
if (mounted.current) setPending(false)
}
result.then(done, done)
}
}
const rootClass = [
'cf-closing-optin-7',
edge ? 'has-edge' : '',
reveal === 'armed' ? 'is-armed' : '',
reveal === 'seen' ? 'is-seen' : '',
className ?? '',
]
.filter(Boolean)
.join(' ')
const buttonClass = [
'co7-btn',
state === 'hover' ? 'is-hover' : '',
state === 'active' ? 'is-active' : '',
pending ? 'is-pending' : '',
]
.filter(Boolean)
.join(' ')
const pitch = (
<div className='co7-pitch'>
{promise ? <p className='co7-promise'>{promise}</p> : null}
{reasons.length ? (
<div className='co7-reasons'>
{reasonsIntro ? <p className='co7-reasons-intro'>{reasonsIntro}</p> : null}
<ol className='co7-reason-list'>
{reasons.map((reason, i) => (
<li key={i} className='co7-reason'>
<span className='co7-num' aria-hidden='true'>
{i + 1}
</span>
<span className='co7-reason-text'>{reason}</span>
</li>
))}
</ol>
</div>
) : null}
{instruction ? <p className='co7-instruction'>{instruction}</p> : null}
</div>
)
const nameInvalid = Boolean(errors.name)
const emailInvalid = Boolean(errors.email)
const card = (
<div className='co7-card co7-rise' style={step(1)}>
{productImage || formHeading ? (
<div className='co7-card-head'>
{productImage ? (
<img className='co7-thumb' src={productImage} alt={productAlt} width={104} height={104} loading='lazy' />
) : null}
{formHeading ? (
<h3 className='co7-form-title' id={ids.form}>
{formHeading}
</h3>
) : null}
</div>
) : null}
<form
className='co7-form'
noValidate
onSubmit={submit}
aria-labelledby={formHeading ? ids.form : undefined}
aria-label={formHeading ? undefined : buttonText}
aria-describedby={privacy ? ids.privacy : undefined}
>
<fieldset className='co7-set' disabled={isDisabled}>
<div className='co7-field'>
<label className='co7-label' htmlFor={ids.name}>
{nameLabel}
{nameOptional ? <span className='co7-opt'> {c.optional}</span> : null}
</label>
<input
ref={nameRef}
id={ids.name}
className='co7-input'
name='name'
type='text'
autoComplete='given-name'
placeholder={namePlaceholder}
value={values.name}
onChange={(e) => update('name', e.target.value)}
required={!nameOptional}
aria-invalid={nameInvalid || undefined}
aria-describedby={nameInvalid ? ids.nameErr : undefined}
/>
{nameInvalid ? (
<p className='co7-err' id={ids.nameErr} role='alert'>
<AlertCircle className='co7-inline-icon' size={16} strokeWidth={2.5} aria-hidden='true' />
{errors.name}
</p>
) : null}
</div>
<div className='co7-field'>
<label className='co7-label' htmlFor={ids.email}>
{emailLabel}
</label>
<input
ref={emailRef}
id={ids.email}
className='co7-input'
name='email'
type='email'
inputMode='email'
autoComplete='email'
placeholder={emailPlaceholder}
value={values.email}
onChange={(e) => update('email', e.target.value)}
onBlur={blurEmail}
required
aria-invalid={emailInvalid || undefined}
aria-describedby={emailInvalid ? ids.emailErr : undefined}
/>
{emailInvalid ? (
<p className='co7-err' id={ids.emailErr} role='alert'>
<AlertCircle className='co7-inline-icon' size={16} strokeWidth={2.5} aria-hidden='true' />
{errors.email}
</p>
) : null}
</div>
<button type='submit' className={buttonClass} aria-busy={pending || undefined}>
{pending ? (
<>
<Loader2 className='co7-spin' size={20} strokeWidth={2.5} aria-hidden='true' />
<span>{pendingText}</span>
</>
) : (
<span>{buttonText}</span>
)}
</button>
</fieldset>
{privacy ? (
<p className='co7-privacy' id={ids.privacy}>
<Lock className='co7-inline-icon' size={16} strokeWidth={2.5} aria-hidden='true' />
{privacy}
</p>
) : null}
</form>
</div>
)
return (
<section ref={rootRef} id={id} className={rootClass} style={FX_HOST} aria-labelledby={ids.head}>
{texture ? <Texture src={weave} tone='ink' /> : null}
<div className='co7-inner'>
<div className='co7-head'>
<h2 className='co7-title' id={ids.head}>
{mark(headline, highlight)}
</h2>
</div>
<div className={hasQuotes ? 'co7-split has-quotes' : 'co7-split'}>
{hasQuotes ? (
<div className='co7-before'>
{quotesIntro ? <p className='co7-intro'>{quotesIntro}</p> : null}
<ul className='co7-quotes' aria-label={quotesLabel}>
{shown.map((quote, i) => (
<li key={i} className='co7-quote co7-rise' style={step(i + 1)}>
<figure className='co7-fig'>
<blockquote className='co7-said'>
<p>
“{quote.text}”
</p>
</blockquote>
{quote.name || quote.detail ? (
<figcaption className='co7-who'>
{quote.name ? <span className='co7-who-name'>{quote.name}</span> : null}
{quote.name && quote.detail ? <span aria-hidden='true'> · </span> : null}
{quote.detail ? <span>{quote.detail}</span> : null}
</figcaption>
) : null}
</figure>
</li>
))}
</ul>
</div>
) : (
<div className='co7-before'>
{pitch}
{productImage ? (
<img className='co7-hero-img' src={productImage} alt={productAlt} width={320} height={320} loading='lazy' />
) : null}
</div>
)}
<div className='co7-after'>
{hasQuotes ? pitch : null}
{card}
</div>
</div>
</div>
{edge ? <Divider shape='curve' tone={edgeTone} height={EDGE} /> : null}
<style>{CSS}</style>
</section>
)
}
export default ClosingOptin7
function check(values: ClosingOptin7Values, c: Copy, nameOptional: boolean): Errors {
const found: Errors = {}
if (!nameOptional && !values.name.trim()) found.name = c.nameRequired
const email = values.email.trim()
if (!email) found.email = c.emailRequired
else if (!EMAIL.test(email)) found.email = c.emailInvalid
return found
}
function fill(template: string, guide: string) {
return template.split('{guide}').join(guide)
}
function mark(text: React.ReactNode, phrase?: string) {
if (typeof text !== 'string' || !phrase) return text
const at = text.indexOf(phrase)
if (at < 0) return text
return (
<>
{text.slice(0, at)}
<span className='co7-mark'>{phrase}</span>
{text.slice(at + phrase.length)}
</>
)
}
function step(i: number) {
return { ['--i']: i } as React.CSSProperties
}
function isThenable(value: unknown): value is PromiseLike<unknown> {
return typeof value === 'object' && value !== null && typeof (value as { then?: unknown }).then === 'function'
}
const CSS = `
.cf-closing-optin-7 {
--co7-marker: var(--marker, #fae37c);
--co7-line: oklch(from var(--ink, #101828) l c h / 0.14);
--co7-shadow: var(--shadow, oklch(0.22 0.03 260));
position: relative;
overflow: hidden;
box-sizing: border-box;
background: var(--surface, #ffffff);
color: var(--ink, #101828);
font-family: var(--font-body, system-ui, sans-serif);
padding: clamp(56px, 8vw, 112px) clamp(16px, 5vw, 48px) clamp(64px, 8.5vw, 120px);
}
.cf-closing-optin-7.has-edge { padding-bottom: calc(clamp(64px, 8.5vw, 120px) + 56px); }
.cf-closing-optin-7 *, .cf-closing-optin-7 *::before, .cf-closing-optin-7 *::after { box-sizing: border-box; }
.cf-closing-optin-7 .co7-inner { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; }
.cf-closing-optin-7 .co7-head { min-width: 0; }
.cf-closing-optin-7 .co7-title {
margin: 0;
font-family: var(--font-display, inherit);
font-weight: var(--display-weight, 800);
letter-spacing: var(--display-tracking, -0.025em);
text-transform: var(--display-case, none);
font-size: clamp(2.5rem, 5.4vw, 4.875rem);
line-height: 1.04;
color: var(--ink, #101828);
text-wrap: balance;
}
.cf-closing-optin-7 .co7-mark {
background-image: linear-gradient(transparent 54%, var(--co7-marker) 54%, var(--co7-marker) 92%, transparent 92%);
-webkit-box-decoration-break: clone;
box-decoration-break: clone;
padding: 0 0.08em;
border-radius: 0.08em 0.22em 0.12em 0.2em;
}
.cf-closing-optin-7 .co7-split {
position: relative;
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
gap: clamp(32px, 5vw, 72px);
align-items: start;
margin-top: clamp(32px, 4vw, 48px);
}
.cf-closing-optin-7 .co7-split.has-quotes::before {
content: '';
position: absolute;
top: 4px;
bottom: 4px;
left: 50%;
width: 1px;
background: var(--co7-line);
}
.cf-closing-optin-7 .co7-split:not(.has-quotes) { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); }
.cf-closing-optin-7 .co7-intro {
margin: 0 0 24px;
font-size: clamp(1.125rem, 1.5vw, 1.375rem);
line-height: 1.4;
font-weight: 500;
color: var(--muted, #475467);
text-wrap: pretty;
}
.cf-closing-optin-7 .co7-quotes { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.cf-closing-optin-7 .co7-quote {
background: var(--card, #ffffff);
color: var(--ink, #101828);
border: 1px solid var(--card-border, oklch(from var(--ink, #101828) l c h / 0.12));
border-radius: var(--card-radius, var(--radius, 14px));
box-shadow: 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));
padding: clamp(20px, 3vw, 32px);
}
.cf-closing-optin-7 .co7-quote:nth-child(2) { margin-inline-start: clamp(0px, 3vw, 40px); }
.cf-closing-optin-7 .co7-fig, .cf-closing-optin-7 .co7-said { margin: 0; }
.cf-closing-optin-7 .co7-said p {
margin: 0;
font-family: var(--font-display, inherit);
font-weight: 700;
font-size: clamp(1.3125rem, 1.8vw, 1.625rem);
line-height: 1.25;
letter-spacing: -0.01em;
hanging-punctuation: first;
text-wrap: pretty;
}
.cf-closing-optin-7 .co7-who {
margin-top: 12px;
font-size: 0.9375rem;
line-height: 1.4;
font-weight: 500;
color: var(--muted, #475467);
}
.cf-closing-optin-7 .co7-who-name { font-weight: 700; color: var(--ink, #101828); }
.cf-closing-optin-7 .co7-promise {
margin: 0;
font-size: clamp(1.125rem, 1.5vw, 1.375rem);
line-height: 1.4;
font-weight: 500;
color: var(--ink, #101828);
text-wrap: pretty;
}
.cf-closing-optin-7 .co7-split:not(.has-quotes) .co7-promise {
font-family: var(--font-display, inherit);
font-weight: 700;
font-size: clamp(1.3125rem, 1.8vw, 1.625rem);
line-height: 1.25;
letter-spacing: -0.01em;
}
.cf-closing-optin-7 .co7-reasons { margin: 24px 0 0; }
.cf-closing-optin-7 .co7-reasons-intro {
margin: 0;
font-size: clamp(1.0625rem, 1.25vw, 1.125rem);
line-height: 1.5;
font-weight: 700;
color: var(--ink, #101828);
text-wrap: pretty;
}
.cf-closing-optin-7 .co7-reason-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.cf-closing-optin-7 .co7-reason {
display: grid;
grid-template-columns: 2rem minmax(0, 1fr);
align-items: baseline;
column-gap: 8px;
font-size: clamp(1.0625rem, 1.25vw, 1.125rem);
line-height: 1.5;
color: var(--ink, #101828);
}
.cf-closing-optin-7 .co7-reason-text { min-width: 0; text-wrap: pretty; }
.cf-closing-optin-7 .co7-num {
font-family: var(--font-display, inherit);
font-weight: 800;
font-size: clamp(1.3125rem, 1.8vw, 1.625rem);
line-height: 1;
letter-spacing: -0.01em;
color: var(--accent, #1d4ed8);
font-variant-numeric: tabular-nums;
}
.cf-closing-optin-7 .co7-instruction {
margin: 24px 0 0;
font-size: clamp(1.0625rem, 1.25vw, 1.125rem);
line-height: 1.5;
font-weight: 700;
color: var(--ink, #101828);
text-wrap: pretty;
}
.cf-closing-optin-7 .co7-after .co7-pitch { margin-bottom: 24px; }
.cf-closing-optin-7 .co7-hero-img {
display: block;
width: min(100%, 320px);
height: auto;
aspect-ratio: 1 / 1;
object-fit: contain;
margin-top: 32px;
border-radius: 0;
filter: drop-shadow(0 2px 3px oklch(from var(--co7-shadow) l c h / 0.3)) drop-shadow(0 12px 16px oklch(from var(--co7-shadow) l c h / 0.18));
}
.cf-closing-optin-7 .co7-card {
background: var(--card, #ffffff);
color: var(--ink, #101828);
border: 1px solid var(--card-border, oklch(from var(--ink, #101828) 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(0.22 0.03 260 / 0.22), 0 12px 24px -8px oklch(0.22 0.03 260 / 0.32)));
padding: clamp(20px, 3vw, 32px);
}
.cf-closing-optin-7 .co7-card-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.cf-closing-optin-7 .co7-thumb {
flex: 0 0 auto;
width: 104px;
height: 104px;
object-fit: contain;
border-radius: 0;
filter: drop-shadow(0 2px 3px oklch(from var(--co7-shadow) l c h / 0.3)) drop-shadow(0 8px 12px oklch(from var(--co7-shadow) l c h / 0.16));
}
.cf-closing-optin-7 .co7-split:not(.has-quotes) .co7-thumb { display: none; }
.cf-closing-optin-7 .co7-form-title {
margin: 0;
font-family: var(--font-display, inherit);
font-weight: var(--display-weight, 800);
text-transform: var(--display-case, none);
letter-spacing: -0.01em;
font-size: clamp(1.3125rem, 1.8vw, 1.625rem);
line-height: 1.15;
text-wrap: balance;
}
.cf-closing-optin-7 .co7-form { margin: 0; }
.cf-closing-optin-7 .co7-set { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 16px; }
.cf-closing-optin-7 .co7-field { display: grid; gap: 8px; }
.cf-closing-optin-7 .co7-label { font-size: 1rem; line-height: 1.3; font-weight: 700; color: var(--label-ink, var(--ink, #101828)); }
.cf-closing-optin-7 .co7-opt { font-weight: 500; color: var(--muted, #475467); }
.cf-closing-optin-7 .co7-input {
width: 100%;
min-height: 56px;
margin: 0;
padding: 0 16px;
font-family: var(--font-body, inherit);
font-size: 1.0625rem;
line-height: 1.3;
background: var(--field, #ffffff);
color: var(--field-ink, #101828);
border: 1px solid var(--field-border, color-mix(in oklch, var(--ink, #101828) 22%, transparent));
border-radius: var(--field-radius, var(--radius, 12px));
box-shadow: inset 0 1px 2px oklch(from var(--co7-shadow) l c h / 0.08);
transition: border-color 0.16s ease, box-shadow 0.16s ease;
-webkit-appearance: none;
appearance: none;
}
.cf-closing-optin-7 .co7-input::placeholder { color: color-mix(in oklch, var(--field-ink, #101828) 65%, var(--field, #ffffff)); opacity: 1; }
.cf-closing-optin-7 .co7-input:hover:not(:disabled) { border-color: color-mix(in oklch, var(--ink, #101828) 42%, transparent); }
.cf-closing-optin-7 .co7-input:focus { outline: none; }
.cf-closing-optin-7 .co7-input:focus-visible, .cf-closing-optin-7 .co7-input:focus {
border-color: var(--field-focus, var(--accent, #1d4ed8));
box-shadow: 0 0 0 3px oklch(from var(--field-focus, var(--accent, #1d4ed8)) l c h / 0.35);
}
.cf-closing-optin-7 .co7-input[aria-invalid='true'] { border-color: var(--danger, #b42318); }
.cf-closing-optin-7 .co7-input[aria-invalid='true']:focus {
border-color: var(--danger, #b42318);
box-shadow: 0 0 0 3px oklch(from var(--danger, #b42318) l c h / 0.3);
}
.cf-closing-optin-7 .co7-input:disabled {
cursor: not-allowed;
background: color-mix(in oklch, var(--ink, #101828) 4%, var(--field, #ffffff));
color: var(--field-ink, #101828);
}
.cf-closing-optin-7 .co7-err {
margin: 0;
font-size: 0.9375rem;
line-height: 1.4;
font-weight: 600;
color: var(--danger, #b42318);
text-wrap: pretty;
}
.cf-closing-optin-7 .co7-inline-icon { display: inline-block; vertical-align: -0.15em; margin-inline-end: 0.4em; }
.cf-closing-optin-7 .co7-btn {
--co7-bg: var(--button-bg, var(--cta, #d92d20));
--co7-bg2: var(--button-bg-2, var(--cta-2, #b42318));
display: flex;
width: 100%;
align-items: center;
justify-content: center;
gap: 10px;
min-height: 64px;
margin: 8px 0 0;
padding: 10px 28px;
border: 0;
border-radius: var(--button-radius, var(--radius, 12px));
background: linear-gradient(oklch(from var(--co7-bg) calc(l + 0.04) c h), oklch(from var(--co7-bg2) calc(l - 0.02) c h));
color: var(--button-ink, var(--cta-ink, #ffffff));
font-family: var(--button-font, var(--font-display, inherit));
font-weight: var(--button-weight, 800);
text-transform: var(--button-case, none);
font-size: clamp(1.125rem, 1.55vw, 1.375rem);
line-height: 1.15;
text-align: center;
text-wrap: balance;
text-shadow: var(--button-text-shadow, none);
cursor: pointer;
box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--co7-bg) calc(l + 0.14) c h / 0.7), inset 0 -3px 0 oklch(from var(--co7-bg) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--co7-shadow) l c h / 0.3), 0 8px 16px -6px oklch(from var(--co7-shadow) l c h / 0.45));
transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.cf-closing-optin-7 .co7-btn:hover:not(:disabled), .cf-closing-optin-7 .co7-btn.is-hover:not(:disabled) {
transform: translateY(-1px);
background: linear-gradient(oklch(from var(--co7-bg) calc(l - 0.01) c h), oklch(from var(--co7-bg2) calc(l - 0.07) c h));
box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--co7-bg) calc(l + 0.12) c h / 0.7), inset 0 -3px 0 oklch(from var(--co7-bg) calc(l - 0.18) c h), 0 1px 2px oklch(from var(--co7-shadow) l c h / 0.32), 0 10px 18px -6px oklch(from var(--co7-shadow) l c h / 0.55));
}
.cf-closing-optin-7 .co7-btn:active:not(:disabled), .cf-closing-optin-7 .co7-btn.is-active:not(:disabled) {
transform: translateY(1px);
background: linear-gradient(oklch(from var(--co7-bg) calc(l - 0.05) c h), oklch(from var(--co7-bg2) calc(l - 0.08) c h));
box-shadow: inset 0 2px 4px oklch(from var(--co7-bg) calc(l - 0.22) c h / 0.55), inset 0 -2px 0 oklch(from var(--co7-bg) calc(l - 0.16) c h), 0 1px 1px oklch(from var(--co7-shadow) l c h / 0.3);
}
.cf-closing-optin-7 .co7-btn:focus-visible { outline: 3px solid var(--field-focus, var(--accent, #1d4ed8)); outline-offset: 3px; }
.cf-closing-optin-7 .co7-btn.is-pending { cursor: progress; }
.cf-closing-optin-7 .co7-btn:disabled {
cursor: not-allowed;
transform: none;
background: var(--button-2-bg, var(--secondary, #e4e7ec));
color: var(--button-2-ink, var(--secondary-ink, #101828));
text-shadow: none;
box-shadow: var(--button-2-shadow, var(--shadow-sm, 0 1px 2px oklch(0.22 0.03 260 / 0.18)));
}
.cf-closing-optin-7 .co7-spin { flex: 0 0 auto; animation: co7-spin 0.8s linear infinite; }
.cf-closing-optin-7 .co7-privacy {
margin: 16px 0 0;
font-size: 0.9375rem;
line-height: 1.4;
font-weight: 500;
color: var(--muted, #475467);
text-align: center;
text-wrap: pretty;
}
.cf-closing-optin-7.is-armed .co7-rise { opacity: 0.82; transform: translateY(8px); }
.cf-closing-optin-7.is-seen .co7-rise {
animation: co7-rise 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
animation-delay: min(calc(var(--i, 0) * 70ms), 280ms);
}
@keyframes co7-rise { from { opacity: 0.82; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes co7-spin { to { transform: rotate(360deg); } }
@media (max-width: 860px) {
.cf-closing-optin-7 .co7-split, .cf-closing-optin-7 .co7-split:not(.has-quotes) { grid-template-columns: minmax(0, 1fr); gap: 32px; }
.cf-closing-optin-7 .co7-split.has-quotes::before { display: none; }
.cf-closing-optin-7 .co7-split.has-quotes .co7-after { order: -1; }
.cf-closing-optin-7 .co7-quote:nth-child(2) { margin-inline-start: 0; }
.cf-closing-optin-7 .co7-hero-img { display: none; }
.cf-closing-optin-7 .co7-split:not(.has-quotes) .co7-thumb { display: block; }
}
@media (max-width: 480px) {
.cf-closing-optin-7 .co7-card { padding: 20px 16px; }
.cf-closing-optin-7 .co7-btn { padding-inline: 14px; font-size: 1.0625rem; }
.cf-closing-optin-7 .co7-thumb { width: 80px; height: 80px; }
.cf-closing-optin-7 .co7-card-head { gap: 12px; margin-bottom: 20px; }
.cf-closing-optin-7 .co7-reason { grid-template-columns: 1.75rem minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
.cf-closing-optin-7 .co7-rise, .cf-closing-optin-7.is-armed .co7-rise, .cf-closing-optin-7.is-seen .co7-rise { animation: none; opacity: 1; transform: none; }
.cf-closing-optin-7 .co7-spin { animation: none; }
.cf-closing-optin-7 .co7-btn, .cf-closing-optin-7 .co7-input { transition: none; }
.cf-closing-optin-7 .co7-btn:hover:not(:disabled), .cf-closing-optin-7 .co7-btn.is-hover:not(:disabled), .cf-closing-optin-7 .co7-btn:active:not(:disabled), .cf-closing-optin-7 .co7-btn.is-active:not(:disabled) { transform: none; }
}
`
pieces/forms/closing-optin-7/specimen.tsx 38 lines
import __studioImagead08728a from "../assets/c7652dd73b4406c0.webp";
import React from 'react'
import { ClosingOptin7, type ClosingOptin7State } from '../closing-optin-7'
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
export const states = ['default', 'hover', 'active', 'disabled', 'error']
export default function ClosingOptin7Specimen({ state }: { state?: ClosingOptin7State }) {
return (
<ClosingOptin7
headline='What if Tuesday’s dinner was already in your freezer?'
highlight='already in your freezer'
quotesIntro='You told us how weeknights really go:'
quotesLabel='What Hearth & Pantry readers told us'
quotes={[
{ text: 'By 5:30 I’m staring into the fridge with nothing planned and three hungry kids.', name: 'Maya T.', detail: 'Columbus' },
{ text: 'We order takeout most weeknights because I’m too tired to think about cooking.', name: 'Jordan P.', detail: 'Tacoma' },
{ text: 'I bought a chest freezer last year. It’s still mostly ice and one bag of peas.', name: 'Renee K.', detail: 'Asheville' },
]}
promise='The Hearth & Pantry Freezer Dinner Plan turns one Sunday afternoon into weeknight dinners you just heat and serve.'
reasonsIntro='Three reasons to start this Sunday:'
reasons={['It’s free.', 'Every recipe uses supermarket staples.', 'Your shopping list is already written.']}
instruction='Enter your name and email and the plan is yours, free.'
formHeading='Fill your freezer this Sunday'
guideName='The Freezer Dinner Plan'
label='Get {guide}'
productImage={slot(
'product',
__studioImagead08728a,
)}
productAlt='The Hearth & Pantry Freezer Dinner Plan booklet beside two freezer trays'
namePlaceholder='Maya'
privacy={defaults.sample.registration.privacy}
state={state}
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalClosingOptin7 |
React.ReactNode |
|
highlight OptionalClosingOptin7 |
string |
|
quotesIntro OptionalClosingOptin7 |
React.ReactNode |
|
quotesLabel OptionalClosingOptin7 |
string |
|
quotes OptionalClosingOptin7 |
ClosingOptin7Quote[] |
|
promise OptionalClosingOptin7 |
React.ReactNode |
|
reasonsIntro OptionalClosingOptin7 |
React.ReactNode |
|
reasons OptionalClosingOptin7 |
React.ReactNode[] |
|
instruction OptionalClosingOptin7 |
React.ReactNode |
|
formHeading OptionalClosingOptin7 |
React.ReactNode |
|
guideName OptionalClosingOptin7 |
string |
|
label OptionalClosingOptin7 |
string |
|
productImage OptionalClosingOptin7 |
string |
|
productAlt OptionalClosingOptin7 |
string |
|
nameLabel OptionalClosingOptin7 |
string |
|
namePlaceholder OptionalClosingOptin7 |
string |
|
nameOptional OptionalClosingOptin7 |
boolean |
|
emailLabel OptionalClosingOptin7 |
string |
|
emailPlaceholder OptionalClosingOptin7 |
string |
|
privacy OptionalClosingOptin7 |
React.ReactNode |
|
copy OptionalClosingOptin7 |
{
nameRequired?: string
emailRequired?: string
emailInvalid?: string
optional?: string
// '{guide}' is replaced with the guide name
pending?: string
} |
|
texture OptionalClosingOptin7 |
boolean |
|
edge OptionalClosingOptin7 |
boolean |
|
edgeTone OptionalClosingOptin7 |
DividerTone |
|
onSubmit OptionalClosingOptin7 |
(values: ClosingOptin7Values) => void | Promise<unknown> |
|
disabled OptionalClosingOptin7 |
boolean |
|
state OptionalClosingOptin7 |
ClosingOptin7State |
|
id OptionalClosingOptin7 |
string |
|
className OptionalClosingOptin7 |
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).
-
4137412454b17370.webp
image/webp · 94.8 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
c7652dd73b4406c0.webp
image/webp · 207 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB