Split VSL Hero 1
Two-column lead-capture opener: eyebrow, promise headline, lead, check bullets, optional presenter line and lead-magnet or device render on one side, the optin-card on the other, with a dark band option for the repeated registration close.
Use it in a prompt
Use hero/split-optin-hero 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/hero/split-optin-hero.tsx. - Import it and pass your copy and images (Props tab):
import { SplitOptinHero } from "@/components/funneldna/hero/split-optin-hero"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/hero/split-optin-hero/component.tsx 481 lines
// Pairs a workshop overview with its registration form and next steps.
'use client'
import * as React from 'react'
import { AlertCircle, Loader2, Lock, Mail, MonitorPlay, Phone, User } from 'lucide-react'
export type SplitOptinHeroProps = {
/** Supporting labels and plain-text templates; named placeholders are documented below. */
copy?: Partial<SplitOptinHeroCopy>
/** The one big promise. */
headline?: string
/** The exact phrase inside the headline that gets the marker stroke. */
highlight?: string
lead?: React.ReactNode
/** Workshop or outcome scene; takes precedence over legacy image. */
sceneImage?: string
image?: string
imageAlt?: string
/** The page's real video embed. It replaces the picture when supplied. */
media?: React.ReactNode
mediaTitle?: string
mediaDetail?: string
stepsTitle?: string
/** What they will walk through, 2 to 4 steps. */
steps?: SplitOptinStep[]
/** Last rail stop, pointing at the form. */
cueLabel?: string
formTitle?: string
formSubtitle?: string
fields?: SplitOptinField[]
ctaLabel?: string
loadingLabel?: string
ctaSublabel?: string
privacy?: string
/** @deprecated No longer rendered: the builder wires what happens after a valid submit. */
successMessage?: string
errorMessage?: string
/** h1 as the page opener; h2 when repeated lower on the page. */
headingLevel?: 'h1' | 'h2'
/** Deep band strip behind the lower part of the cards. */
strip?: boolean
/** Studio preview state. "success" is accepted for older callers and renders as default. */
state?: SplitOptinState
onSubmit?: (values: Record<string, string>) => void | Promise<void>
className?: string
}
export function SplitOptinHero({
headline = 'Map out your first funnel',
highlight = 'your first funnel',
lead,
image: legacyImage,
sceneImage: image = legacyImage,
imageAlt = '',
media,
mediaTitle,
mediaDetail,
stepsTitle = 'Here’s what you’ll walk through',
steps = [],
cueLabel = 'Save your free seat',
formTitle = 'Ready to save your seat?',
formSubtitle,
fields = DEFAULT_FIELDS,
ctaLabel = 'Yes! Save My Seat',
loadingLabel = 'Saving your seat…',
ctaSublabel,
privacy,
errorMessage = 'We couldn’t complete your registration. Please try again.',
headingLevel = 'h1',
strip = true,
state = 'default',
onSubmit,
className,
copy,
}: SplitOptinHeroProps) {
const text = { ...DEFAULT_COPY, ...copy }
const uid = React.useId()
const empty = React.useMemo(() => Object.fromEntries(fields.map((f) => [f.name, ''])) as Record<string, string>, [fields])
const [values, setValues] = React.useState<Record<string, string>>(empty)
const [errors, setErrors] = React.useState<Record<string, string>>({})
const [status, setStatus] = React.useState<Status>('idle')
const [formError, setFormError] = React.useState<string | null>(null)
const inputs = React.useRef<Record<string, HTMLInputElement | null>>({})
const formRef = React.useRef<HTMLDivElement | null>(null)
const mounted = React.useRef(true)
React.useEffect(() => {
mounted.current = true
return () => {
mounted.current = false
}
}, [])
React.useEffect(() => {
if (state === 'error') {
const v = demoValues(fields, text)
const ef = fields.find(isEmail)
if (ef) v[ef.name] = text.demoInvalidEmail
setValues(v)
setErrors(ef ? { [ef.name]: text.emailInvalid } : {})
setFormError(errorMessage)
setStatus('error')
} else {
setErrors({})
setFormError(null)
setStatus('idle')
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [state])
const disabled = state === 'disabled'
const loading = status === 'loading'
function validate(v: Record<string, string>) {
const e: Record<string, string> = {}
for (const f of fields) {
const val = (v[f.name] ?? '').trim()
if (f.required !== false && !val) {
e[f.name] = isEmail(f) ? text.emailRequired : copyText(text.required, { label: f.label.toLowerCase() })
} else if (isEmail(f) && val && !EMAIL.test(val)) {
e[f.name] = text.emailInvalid
}
}
return e
}
async function submit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault()
if (disabled || loading) return
const e = validate(values)
setErrors(e)
setFormError(null)
const firstBad = fields.find((f) => e[f.name])
if (firstBad) {
setStatus('error')
inputs.current[firstBad.name]?.focus()
return
}
if (!onSubmit) {
setStatus('idle')
return
}
setStatus('loading')
try {
await onSubmit(values)
if (mounted.current) setStatus('idle')
} catch {
if (!mounted.current) return
setFormError(errorMessage)
setStatus('error')
}
}
function goToForm() {
const reduce = typeof window !== 'undefined' && window.matchMedia?.('(prefers-reduced-motion: reduce)').matches
formRef.current?.scrollIntoView({ behavior: reduce ? 'auto' : 'smooth', block: 'center' })
const first = fields[0] && inputs.current[fields[0].name]
first?.focus({ preventScroll: true })
}
const H = headingLevel
const Sub = (headingLevel === 'h1' ? 'h2' : 'h3') as 'h2' | 'h3'
const Small = (headingLevel === 'h1' ? 'h3' : 'h4') as 'h3' | 'h4'
const btnClass = ['sph-btn', state === 'hover' && 'is-hover', state === 'active' && 'is-active'].filter(Boolean).join(' ')
const caption = (mediaTitle || mediaDetail) && (
<figcaption className='sph-cap sph-cap--below'>
{mediaTitle && <span className='sph-capt'>{mediaTitle}</span>}
{mediaDetail && <span className='sph-capd'>{mediaDetail}</span>}
</figcaption>
)
return (
<section className={['cf-split-optin-hero', className].filter(Boolean).join(' ')} aria-labelledby={`${uid}-h`}>
<style>{CSS}</style>
{strip && <div className='sph-strip' aria-hidden='true' />}
<div className='sph-in'>
<header className='sph-head'>
<H id={`${uid}-h`} className='sph-h'>
{renderHeadline(headline, highlight)}
</H>
{lead && <p className='sph-lead'>{lead}</p>}
</header>
<div className='sph-grid'>
<article className='sph-card sph-story'>
{(media || image) && (
<figure className='sph-media'>
<div className={media ? 'sph-frame' : 'sph-frame sph-frame--img'}>
{media ? media : <img src={image} alt={imageAlt} className='sph-img' width={1280} height={720} />}
</div>
{caption}
</figure>
)}
<div className='sph-body'>
{stepsTitle && <Small className='sph-rt'>{stepsTitle}</Small>}
<ol className='sph-rail'>
{steps.map((s, i) => (
<li key={s.title} className='sph-step' style={{ '--i': i } as React.CSSProperties}>
<span className='sph-num' aria-hidden='true'>{i + 1}</span>
<div className='sph-stx'>
<p className='sph-st'>
<span className='sph-sr'>{copyText(text.step, { number: i + 1 })}</span>
{s.title}
</p>
{s.detail && <p className='sph-sd'>{s.detail}</p>}
</div>
</li>
))}
{cueLabel && (
<li className='sph-step sph-cue' style={{ '--i': steps.length } as React.CSSProperties}>
<span className='sph-dot' aria-hidden='true' />
<div className='sph-cuex'>
<button type='button' className='sph-cuel' onClick={goToForm}>
{cueLabel}
</button>
</div>
</li>
)}
</ol>
</div>
</article>
<div className='sph-card sph-form' id={`${uid}-form`} ref={formRef}>
<>
<Sub className='sph-ft'>{formTitle}</Sub>
{formSubtitle && (
<p className='sph-fs'>
<MonitorPlay aria-hidden='true' />
{formSubtitle}
</p>
)}
<form className='sph-fm' noValidate onSubmit={submit} aria-busy={loading || undefined}>
{fields.map((f) => {
const Icon = iconFor(f)
const id = `${uid}-${f.name}`
const err = errors[f.name]
return (
<div className='sph-fld' key={f.name}>
<label htmlFor={id} className='sph-lb'>
{f.label}
</label>
<span className={err ? 'sph-ip is-bad' : 'sph-ip'}>
<Icon aria-hidden='true' className='sph-ipi' />
<input
id={id}
ref={(el) => {
inputs.current[f.name] = el
}}
name={f.name}
type={f.type ?? 'text'}
autoComplete={f.autoComplete}
placeholder={f.placeholder ?? copyText(text.placeholder, { label: f.label.toLowerCase() })}
required={f.required !== false}
value={values[f.name] ?? ''}
disabled={disabled}
readOnly={loading}
aria-invalid={err ? true : undefined}
aria-describedby={err ? `${id}-e` : undefined}
onChange={(e) => {
const val = e.target.value
setValues((v) => ({ ...v, [f.name]: val }))
if (errors[f.name]) setErrors((x) => ({ ...x, [f.name]: '' }))
}}
/>
</span>
{err && (
<p id={`${id}-e`} className='sph-fe'>
<AlertCircle aria-hidden='true' />
{err}
</p>
)}
</div>
)
})}
{formError && (
<p className='sph-banner' role='alert'>
<AlertCircle aria-hidden='true' />
{formError}
</p>
)}
<button type='submit' className={btnClass} disabled={disabled} aria-busy={loading || undefined}>
<span className='sph-bl'>{loading ? loadingLabel : ctaLabel}</span>
{loading && (
<span className='sph-bic' aria-hidden='true'>
<Loader2 className='sph-spin' />
</span>
)}
</button>
{ctaSublabel && <p className='sph-sub'>{ctaSublabel}</p>}
</form>
{privacy && (
<p className='sph-pv'>
<Lock aria-hidden='true' />
{privacy}
</p>
)}
</>
</div>
</div>
</div>
</section>
)
}
export default SplitOptinHero
export type SplitOptinField = {
name: string
label: string
type?: string
autoComplete?: string
placeholder?: string
required?: boolean
}
export type SplitOptinStep = { title: string; detail?: string }
export type SplitOptinState = 'default' | 'hover' | 'active' | 'disabled' | 'error' | 'success'
type Status = 'idle' | 'loading' | 'error'
const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/
const DEFAULT_FIELDS: SplitOptinField[] = [
{ name: 'name', label: 'Full name', autoComplete: 'name', placeholder: 'Enter your full name' },
{ name: 'email', label: 'Email address', type: 'email', autoComplete: 'email', placeholder: 'Enter your email address' },
]
function isEmail(f: SplitOptinField) {
return f.type === 'email' || f.name === 'email'
}
function iconFor(f: SplitOptinField) {
if (isEmail(f)) return Mail
if (f.type === 'tel' || f.name === 'phone') return Phone
return User
}
function demoValues(fields: SplitOptinField[], text: SplitOptinHeroCopy) {
const v: Record<string, string> = {}
for (const f of fields) {
if (isEmail(f)) v[f.name] = text.demoEmail
else if (f.type === 'tel' || f.name === 'phone') v[f.name] = text.demoPhone
else v[f.name] = text.demoName
}
return v
}
function renderHeadline(text: string, phrase?: string) {
if (!phrase) return text
const i = text.indexOf(phrase)
if (i < 0) return text
return (
<>
{text.slice(0, i)}
<span className='sph-mk'>{phrase}</span>
{text.slice(i + phrase.length)}
</>
)
}
// Photos use replaceable slots; close shadows derive from the surface token.
const CSS = `
.cf-split-optin-hero{--sph-marker:var(--marker,#fae37c);position:relative;isolation:isolate;overflow-x:clip;background:color-mix(in oklch,var(--ink,#101828) 4%,var(--surface,#ffffff));color:var(--ink,#101828);font-family:var(--font-body,Arial,sans-serif);padding:clamp(48px,7vw,92px) 0 clamp(52px,7vw,100px)}
.cf-split-optin-hero *,.cf-split-optin-hero *::before,.cf-split-optin-hero *::after{box-sizing:border-box}
:where(.cf-split-optin-hero) .sph-strip{position:absolute;left:0;right:0;bottom:0;height:34%;background:var(--band,#0f2747);z-index:-1}
:where(.cf-split-optin-hero) .sph-in{max-width:1200px;margin:0 auto;padding:0 20px}
:where(.cf-split-optin-hero) .sph-head{text-align:center}
:where(.cf-split-optin-hero) .sph-h{margin:0 auto;font-family:var(--font-display,Arial,sans-serif);font-weight:var(--display-weight,800);font-size:clamp(2.6rem,6.8vw,5.75rem);line-height:1.04;letter-spacing:var(--display-tracking,-0.03em);color:var(--ink,#101828);text-wrap:balance;text-transform:var(--display-case,none)}
:where(.cf-split-optin-hero) .sph-mk{background-image:linear-gradient(var(--sph-marker),var(--sph-marker));background-repeat:no-repeat;background-position:0 82%;background-size:100% 70%;padding:0 .12em;margin:0 -.04em;border-radius:.2em .45em .3em .5em / .35em .3em .45em .3em;-webkit-box-decoration-break:clone;box-decoration-break:clone}
:where(.cf-split-optin-hero) .sph-lead{margin:24px auto 0;max-width:44ch;font-size:clamp(1.125rem,1.9vw,1.5rem);line-height:1.45;font-weight:500;color:var(--muted,#4a5565);text-wrap:pretty}
:where(.cf-split-optin-hero) .sph-grid{margin-top:clamp(36px,5vw,60px);display:grid;gap:28px;align-items:start}
@media (min-width:960px){:where(.cf-split-optin-hero) .sph-grid{grid-template-columns:minmax(0,1.12fr) minmax(0,.88fr);gap:36px;align-items:stretch}}
:where(.cf-split-optin-hero) .sph-card{position:relative;background:var(--card,#ffffff);border:1px solid oklch(from var(--ink,#101828) l c h / 0.14);border-radius:var(--card-radius,calc(var(--radius,14px) + 6px));box-shadow:var(--card-shadow,var(--shadow-md, 0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.22), 0 4px 10px -2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.2)));border-color:var(--card-border,oklch(from var(--ink) l c h / 0.12))}
:where(.cf-split-optin-hero) .sph-media{margin:0;padding:10px 10px 0}
:where(.cf-split-optin-hero) .sph-frame{position:relative;overflow:hidden;border-radius:var(--card-radius,calc(var(--radius,14px) - 2px));aspect-ratio:16/9;background:var(--band,#0f2747)}
:where(.cf-split-optin-hero) .sph-frame > iframe,:where(.cf-split-optin-hero) .sph-frame > video{display:block;width:100%;height:100%;border:0}
:where(.cf-split-optin-hero) .sph-img{display:block;width:100%;height:100%;object-fit:cover}
:where(.cf-split-optin-hero) .sph-cap{position:absolute;left:50%;bottom:14px;transform:translateX(-50%);z-index:1;width:max-content;max-width:calc(100% - 28px);text-align:center;padding:10px 18px;border-radius:var(--card-radius,var(--radius,12px));background:var(--band);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);border:1px solid var(--card-border,oklch(from var(--ink) l c h / 0.12));color:var(--band-ink,#ffffff);box-shadow:var(--card-shadow,var(--shadow-md, 0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.22), 0 4px 10px -2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.2)));border-color:var(--card-border,oklch(from var(--ink) l c h / 0.12))}
:where(.cf-split-optin-hero) .sph-cap--below{position:static;transform:none;width:auto;max-width:none;margin-top:10px;background:var(--band,#0f2747)}
:where(.cf-split-optin-hero) .sph-capt{display:block;font-family:var(--font-display,Arial,sans-serif);font-weight:var(--display-weight,800);font-size:clamp(1rem,1.6vw,1.2rem);line-height:1.2;text-wrap:balance;letter-spacing:var(--display-tracking,normal);text-transform:var(--display-case,none)}
:where(.cf-split-optin-hero) .sph-capd{display:block;margin-top:2px;font-size:14px;font-weight:600;color:var(--band-ink,#ffffff);opacity:1}
:where(.cf-split-optin-hero) .sph-body{padding:clamp(20px,3vw,30px) clamp(20px,3vw,32px) clamp(22px,3vw,32px)}
:where(.cf-split-optin-hero) .sph-rt{margin:0;font-family:var(--font-display,Arial,sans-serif);font-weight:var(--display-weight,800);font-size:clamp(1.25rem,2vw,1.5rem);line-height:1.15;color:var(--ink,#101828);text-wrap:balance;letter-spacing:var(--display-tracking,normal);text-transform:var(--display-case,none)}
:where(.cf-split-optin-hero) .sph-rail{list-style:none;margin:14px 0 0;padding:0;position:relative}
:where(.cf-split-optin-hero) .sph-rail::before{content:'';position:absolute;left:29.5px;top:34px;bottom:30px;width:3px;border-radius:3px;background:oklch(from var(--accent-fill,var(--accent,#0f5fc2)) l c h / 0.24);transform-origin:top}
:where(.cf-split-optin-hero) .sph-step{position:relative;display:grid;grid-template-columns:62px minmax(0,1fr);gap:16px;align-items:start;padding:10px 0}
:where(.cf-split-optin-hero) .sph-num{position:relative;z-index:1;display:block;text-align:center;background:var(--card,#ffffff);padding:2px 0 6px;font-family:var(--font-display,Arial,sans-serif);font-weight:800;font-size:clamp(3rem,4.6vw,3.75rem);line-height:.9;letter-spacing:-0.04em;color:var(--accent,#0f5fc2);font-variant-numeric:tabular-nums}
:where(.cf-split-optin-hero) .sph-stx{padding-top:4px;min-width:0}
:where(.cf-split-optin-hero) .sph-st{margin:0;font-family:var(--font-display,Arial,sans-serif);font-weight:var(--display-weight,800);font-size:clamp(1.125rem,1.7vw,1.3rem);line-height:1.2;color:var(--ink,#101828);text-wrap:balance;letter-spacing:var(--display-tracking,normal);text-transform:var(--display-case,none)}
:where(.cf-split-optin-hero) .sph-sd{margin:6px 0 0;font-size:16px;line-height:1.5;color:var(--muted,#4a5565);text-wrap:pretty}
:where(.cf-split-optin-hero) .sph-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
:where(.cf-split-optin-hero) .sph-cue{align-items:center;padding-top:14px}
:where(.cf-split-optin-hero) .sph-dot{position:relative;z-index:1;justify-self:center;width:24px;height:24px;border-radius:999px;background:var(--accent-fill,var(--accent));box-shadow:0 0 0 6px var(--card,#ffffff),0 0 0 9px oklch(from var(--accent-fill,var(--accent)) l c h / 0.22)}
:where(.cf-split-optin-hero) .sph-cuex{display:flex;align-items:center;gap:12px;flex-wrap:wrap;min-width:0}
:where(.cf-split-optin-hero) .sph-cuel{appearance:none;border:0;background:var(--button-2-bg,var(--card));padding:4px 0;margin:0;font:inherit;font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);font-size:clamp(1.2rem,1.9vw,1.45rem);line-height:1.2;color:var(--button-2-ink,var(--ink));cursor:pointer;text-align:left;transition:color .15s;text-transform:var(--button-case,none);border-radius:var(--button-radius,var(--radius,0px));box-shadow:var(--button-shadow,none)}
:where(.cf-split-optin-hero) .sph-cuel:hover{color:var(--button-2-ink,var(--ink))}
:where(.cf-split-optin-hero) .sph-cuel:focus-visible{outline:3px solid var(--accent,#0f5fc2);outline-offset:4px;border-radius:var(--button-radius,var(--radius,6px))}
:where(.cf-split-optin-hero) .sph-form{display:flex;flex-direction:column;padding:clamp(24px,3vw,36px)}
:where(.cf-split-optin-hero) .sph-ft{margin:0;font-family:var(--font-display,Arial,sans-serif);font-weight:var(--display-weight,800);font-size:clamp(1.75rem,2.7vw,2.3rem);line-height:1.08;letter-spacing:var(--display-tracking,-0.02em);color:var(--ink,#101828);text-wrap:balance;text-transform:var(--display-case,none)}
:where(.cf-split-optin-hero) .sph-fs{display:flex;align-items:center;gap:8px;margin:14px 0 0;font-size:18px;font-weight:700;line-height:1.3;color:var(--accent,#0f5fc2)}
:where(.cf-split-optin-hero) .sph-fs svg{width:20px;height:20px;flex:none}
:where(.cf-split-optin-hero) .sph-fm{margin:24px 0 20px;display:grid;gap:18px}
:where(.cf-split-optin-hero) .sph-fld{min-width:0}
:where(.cf-split-optin-hero) .sph-lb{display:block;margin-bottom:8px;font-family:var(--font-body);font-weight:800;font-size:clamp(1.1rem,1.5vw,1.25rem);line-height:1.2;color:var(--label-ink,var(--ink))}
:where(.cf-split-optin-hero) .sph-ip{position:relative;display:block}
:where(.cf-split-optin-hero) .sph-ipi{position:absolute;left:16px;top:50%;width:20px;height:20px;transform:translateY(-50%);color:color-mix(in oklch,var(--field-ink,#101828) 58%,var(--field,#ffffff));pointer-events:none}
:where(.cf-split-optin-hero) .sph-ip input{display:block;width:100%;height:60px;padding:0 16px 0 48px;font:inherit;font-size:18px;font-weight:500;color:var(--field-ink,#101828);background:var(--field,#ffffff);border:1.5px solid var(--field-border,oklch(from var(--ink) l c h / 0.22));border-radius:var(--field-radius,var(--radius,12px));box-shadow:inset 0 2px 3px oklch(from var(--surface) calc(l - 0.12) c h / .06);transition:border-color .15s,box-shadow .15s;outline:none}
:where(.cf-split-optin-hero) .sph-ip input::placeholder{color:color-mix(in oklch, var(--field-ink) 65%, var(--field));opacity:1}
:where(.cf-split-optin-hero) .sph-ip input:hover:not(:disabled){border-color:var(--field-focus,var(--accent))}
:where(.cf-split-optin-hero) .sph-ip input:focus-visible{border-color:var(--field-focus,var(--accent));box-shadow:0 0 0 3px oklch(from var(--field-focus,var(--accent)) l c h / 0.22)}
:where(.cf-split-optin-hero) .sph-ip input:disabled{background:color-mix(in oklch,var(--field,#ffffff) 93%,var(--field-ink,#101828));cursor:not-allowed}
:where(.cf-split-optin-hero) .sph-ip.is-bad input{border-color:var(--danger);box-shadow:0 0 0 3px oklch(from var(--danger) l c h / 0.22)}
:where(.cf-split-optin-hero) .sph-fe{display:flex;align-items:flex-start;gap:7px;margin:8px 0 0;font-size:15px;font-weight:600;line-height:1.4;color:var(--danger);text-wrap:pretty}
:where(.cf-split-optin-hero) .sph-fe svg{width:17px;height:17px;flex:none;margin-top:2px}
:where(.cf-split-optin-hero) .sph-banner{display:flex;gap:10px;align-items:flex-start;margin:0;padding:12px 14px;border-radius:var(--card-radius,var(--radius,12px));background:var(--danger-soft);border:1px solid oklch(from var(--cta,#d92d20) l c h / 0.3);color:var(--danger);font-size:15px;font-weight:600;line-height:1.45;text-wrap:pretty;border-color:var(--card-border,oklch(from var(--ink) l c h / 0.12));box-shadow:var(--card-shadow,var(--shadow-md, 0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.22), 0 4px 10px -2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.2)))}
:where(.cf-split-optin-hero) .sph-banner svg{width:18px;height:18px;flex:none;margin-top:2px}
:where(.cf-split-optin-hero) .sph-btn{position:relative;display:flex;align-items:center;justify-content:center;width:100%;min-height:70px;margin:4px 0 0;padding:12px 60px;border:1px solid var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h));border-radius:var(--button-radius,var(--radius,14px));background:linear-gradient(180deg,var(--button-bg,var(--cta)),var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h)));color:var(--button-ink,var(--cta-ink));font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);font-size:clamp(1.15rem,2.3vw,1.6rem);line-height:1.1;letter-spacing:-0.01em;text-align:center;text-shadow:var(--button-text-shadow, 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.2) c h / 0.75));text-wrap:balance;cursor:pointer;box-shadow:var(--button-shadow,0 3px 3px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.24));transition:transform .14s ease,box-shadow .14s ease,filter .14s ease;border-color:var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h));text-transform:var(--button-case,none)}
:where(.cf-split-optin-hero) .sph-bl{display:block}
:where(.cf-split-optin-hero) .sph-bic{position:absolute;right:12px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:38px;height:38px;border-radius:10px;background:oklch(from var(--button-bg,var(--cta)) calc(l - 0.10) c h);box-shadow:inset 0 1px 2px oklch(from var(--surface) calc(l - 0.12) c h / .22)}
:where(.cf-split-optin-hero) .sph-spin{width:22px;height:22px;flex:none;transition:transform .14s ease}
:where(.cf-split-optin-hero) .sph-btn:hover:not(:disabled),:where(.cf-split-optin-hero) .sph-btn.is-hover{transform:translateY(-2px);background:oklch(from var(--button-bg,var(--cta)) calc(l - 0.06) c h);box-shadow:var(--button-shadow,0 3px 3px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.24))}
:where(.cf-split-optin-hero) .sph-btn:active:not(:disabled),:where(.cf-split-optin-hero) .sph-btn.is-active{transform:translateY(3px);background:oklch(from var(--button-bg,var(--cta)) calc(l - 0.06) c h);box-shadow:var(--button-shadow,0 3px 3px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.24))}
:where(.cf-split-optin-hero) .sph-btn:focus-visible{outline:3px solid var(--accent,#0f5fc2);outline-offset:3px}
:where(.cf-split-optin-hero) .sph-btn:disabled{cursor:not-allowed;background:var(--button-bg,var(--cta));border-color:var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h));color:var(--button-ink,var(--cta-ink));text-shadow:none;filter:none;transform:none;box-shadow:var(--button-shadow,0 3px 3px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.24))}
:where(.cf-split-optin-hero) .sph-btn:disabled .sph-bic{background:oklch(from var(--button-bg,var(--cta)) calc(l - 0.10) c h);box-shadow:none}
:where(.cf-split-optin-hero) .sph-btn[aria-busy='true']{cursor:progress}
:where(.cf-split-optin-hero) .sph-sub{margin:2px 0 0;text-align:center;font-size:16px;font-weight:700;line-height:1.4;color:var(--ink,#101828);text-wrap:pretty}
:where(.cf-split-optin-hero) .sph-pv{display:block;margin:auto 0 0;padding:12px 16px;border-radius:12px;background:color-mix(in oklch,var(--ink) 4%,var(--card,#ffffff));text-align:center;font-size:14px;font-weight:500;line-height:1.45;color:var(--muted,#4a5565);text-wrap:pretty}
:where(.cf-split-optin-hero) .sph-pv svg{display:inline-block;width:15px;height:15px;margin-right:7px;vertical-align:-2px}
@media (max-width:480px){:where(.cf-split-optin-hero) .sph-step{grid-template-columns:52px minmax(0,1fr);gap:12px}:where(.cf-split-optin-hero) .sph-rail::before{left:24.5px}:where(.cf-split-optin-hero) .sph-num{font-size:2.75rem}:where(.cf-split-optin-hero) .sph-btn{padding:12px 50px;min-height:66px}:where(.cf-split-optin-hero) .sph-bic{right:9px;width:34px;height:34px;background:oklch(from var(--button-bg,var(--cta)) calc(l - 0.10) c h)}:where(.cf-split-optin-hero) .sph-spin{width:20px;height:20px}}
@keyframes sph-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes sph-grow{from{transform:scaleY(0)}to{transform:scaleY(1)}}
@keyframes sph-mark{from{background-size:0% 70%}to{background-size:100% 70%}}
@keyframes sph-settle{from{transform:scale(1.07)}to{transform:scale(1)}}
@keyframes sph-spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:no-preference){
:where(.cf-split-optin-hero) .sph-mk{animation:sph-mark .7s cubic-bezier(.3,.7,.2,1) .15s both}
:where(.cf-split-optin-hero) .sph-img{animation:sph-settle 1.6s cubic-bezier(.2,.7,.2,1) both}
:where(.cf-split-optin-hero) .sph-step{animation:sph-rise .45s ease-out both;animation-delay:calc(min(var(--i,0),4) * 70ms)}
:where(.cf-split-optin-hero) .sph-rail::before{animation:sph-grow .9s cubic-bezier(.3,.7,.2,1) .2s both}
:where(.cf-split-optin-hero) .sph-spin{animation:sph-spin .9s linear infinite}
}
`
type SplitOptinHeroCopy = {
demoEmail: string
demoInvalidEmail: string
demoPhone: string
demoName: string
emailInvalid: string
emailRequired: string
/** Uses {label} in lower case. */
required: string
/** Uses {label} in lower case. */
placeholder: string
/** Uses {number}. */
step: string
/** {email} keeps the original strong emphasis. */
registered: string
reset: string
}
const DEFAULT_COPY: SplitOptinHeroCopy = {
"demoEmail": "jordan@example.com",
"demoInvalidEmail": "jordan@example",
"demoPhone": "555 0100",
"demoName": "Jordan Lee",
"emailInvalid": "Enter a full email address, like you@example.com.",
"emailRequired": "Enter your email address to save your seat.",
"required": "Enter your {label} to save your seat.",
"placeholder": "Enter your {label}",
"step": "Step {number}: ",
"registered": "Registered with {email}",
"reset": "Use a different email"
}
function copyText(template: string, values: Record<string, string | number>) {
return template.replace(/\{(\w+)\}/g, (match, key: string) => Object.hasOwn(values, key) ? String(values[key]) : match)
}
pieces/hero/split-optin-hero/specimen.tsx 41 lines
import __studioImage3680d128 from "../assets/56126af967897d46.webp";
import * as React from 'react'
import { slot } from '../../slots'
import defaults from '../../studio-defaults.json'
import { SplitOptinHero, type SplitOptinState } from '../split-optin-hero'
export const states = ['default', 'hover', 'active', 'disabled', 'error']
export default function SplitOptinHeroSpecimen({ state = 'default' }: { state?: string }) {
const s = defaults.sample
const r = s.registration
const fields = s.fields.map((f) => ({ ...f, placeholder: `Enter your ${f.label.toLowerCase()}` }))
return (
<SplitOptinHero
headline={r.headline}
highlight='your first funnel'
lead={r.lead}
sceneImage={slot('scene', __studioImage3680d128)}
imageAlt='A tidy desk with an open notebook and workbook, ready for planning a first funnel'
mediaTitle={r.name}
mediaDetail={r.eyebrow}
stepsTitle='Here’s what you’ll walk through'
steps={[
{ title: 'Your offer', detail: 'Walk through what you sell and who it’s for.' },
{ title: 'Your page copy', detail: 'Walk through the words each page of your funnel needs.' },
{ title: 'Your next steps', detail: 'Leave with a clear plan for what to build first.' },
]}
cueLabel='Save your free seat'
formTitle='Ready to map out your first funnel?'
formSubtitle={r.eyebrow}
fields={fields}
ctaLabel={r.label}
ctaSublabel={r.sublabel}
privacy={r.privacy}
errorMessage={r.error}
state={state as SplitOptinState}
/>
)
}
| Name | Type | Details |
|---|---|---|
copy OptionalSplitOptinHero |
Partial<SplitOptinHeroCopy> |
|
headline OptionalSplitOptinHero |
string |
Default 'Map out your first funnel'
|
highlight OptionalSplitOptinHero |
string |
Default 'your first funnel'
|
lead OptionalSplitOptinHero |
React.ReactNode |
|
sceneImage OptionalSplitOptinHero |
string |
Default legacyImage
|
image OptionalSplitOptinHero |
string |
|
imageAlt OptionalSplitOptinHero |
string |
Default ''
|
media OptionalSplitOptinHero |
React.ReactNode |
|
mediaTitle OptionalSplitOptinHero |
string |
|
mediaDetail OptionalSplitOptinHero |
string |
|
stepsTitle OptionalSplitOptinHero |
string |
Default 'Here’s what you’ll walk through'
|
steps OptionalSplitOptinHero |
SplitOptinStep[] |
Default []
|
cueLabel OptionalSplitOptinHero |
string |
Default 'Save your free seat'
|
formTitle OptionalSplitOptinHero |
string |
Default 'Ready to save your seat?'
|
formSubtitle OptionalSplitOptinHero |
string |
|
fields OptionalSplitOptinHero |
SplitOptinField[] |
Default DEFAULT_FIELDS
|
ctaLabel OptionalSplitOptinHero |
string |
Default 'Yes! Save My Seat'
|
loadingLabel OptionalSplitOptinHero |
string |
Default 'Saving your seat…'
|
ctaSublabel OptionalSplitOptinHero |
string |
|
privacy OptionalSplitOptinHero |
string |
|
successMessage OptionalSplitOptinHero |
string |
|
errorMessage OptionalSplitOptinHero |
string |
Default 'We couldn’t complete your registration. Please try again.'
|
headingLevel OptionalSplitOptinHero |
'h1' | 'h2' |
Default 'h1'
|
strip OptionalSplitOptinHero |
boolean |
Default true
|
state OptionalSplitOptinHero |
SplitOptinState |
Default 'default'
|
onSubmit OptionalSplitOptinHero |
(values: Record<string, string>) => void | Promise<void> |
|
className OptionalSplitOptinHero |
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- 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.
scene- A wide atmosphere photo behind or beside the copy.
-
56126af967897d46.webp
image/webp · 115 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB