Free Book Hero 2
Free-plus-shipping book hero: the book, a big FREE against the struck regular price and the first step of the shipping form, read in one glance.
Use it in a prompt
Use hero/free-book-hero-2 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/free-book-hero-2.tsx. - Import it and pass your copy and images (Props tab):
import { FreeBookHero2 } from "@/components/funneldna/hero/free-book-hero-2"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/hero/free-book-hero-2/component.tsx 534 lines
// Free-plus-shipping book hero: the book, a big FREE against the struck regular price and the first step of the shipping form, read in one glance.
'use client'
import * as React from 'react'
import { AlertCircle, Loader2, Lock, MapPin, Package, Truck } from 'lucide-react'
export type FreeBookHero2Props = {
/** Supporting labels and plain-text templates; named placeholders are documented below. */
copy?: Partial<FreeBookHero2Copy>
productName?: string
mastheadLeft?: string
mastheadRight?: string
headline?: string
highlight?: string
lead?: string
/** productImage is the canonical slot image; bookImage is retained for compatibility. */
productImage?: string
bookImage?: string
bookImageAlt?: string
stampImage?: string
stampAlt?: string
/** Optional texture slot, shown at very low opacity behind the band. */
textureImage?: string
caption?: string
cardTitle?: string
/** Struck regular price; only a real, supplied price. Omitted, no anchor is shown. */
retailPrice?: string
retailLabel?: string
todayLabel?: string
freeLabel?: string
shippingPrice?: string
shippingNote?: string
shipTo?: string
stepOneLabel?: string
stepTwoLabel?: string
stepTwoMore?: string
stepTitle?: string
fields?: FreeBookField[]
ctaLabel?: string
ctaNote?: string
loadingLabel?: string
errorMessage?: string
/** @deprecated No longer rendered: the builder wires what happens after a valid submit. */
successTitle?: string
/** @deprecated No longer rendered. */
successBody?: string
/** @deprecated No longer rendered. */
continueLabel?: string
insideTitle?: string
items?: FreeBookItem[]
/** 'success' is accepted for older callers and renders as default. */
state?: FreeBookHeroState
/** Receives validated values. A returned promise shows the loading label until it settles. */
onSubmit?: (values: Record<string, string>) => void | Promise<void>
/** Legacy alias for onSubmit. */
onSubmitted?: (values: Record<string, string>) => void | Promise<void>
/** @deprecated No longer called: the continuation lived in the removed success panel. */
onAction?: () => void
/** @deprecated Legacy alias for onAction; no longer called. */
onContinue?: () => void
className?: string
}
export function FreeBookHero2({
productName = 'The Funnel Starter Kit',
mastheadLeft = 'Free book offer',
mastheadRight = 'Shipped to your door',
headline = 'Build Your First Funnel With',
highlight = 'A Clear Plan',
lead = 'Plan your funnel, write your page copy, and check every step before you launch.',
bookImage: legacyBookImage,
productImage: bookImage = legacyBookImage,
bookImageAlt,
stampImage,
stampAlt = '',
textureImage,
caption,
cardTitle = 'Get Your FREE Book',
retailPrice,
retailLabel = 'Regular',
todayLabel = 'Today',
freeLabel = 'FREE',
shippingPrice,
shippingNote,
shipTo = 'Mailed to your shipping address',
stepOneLabel = 'Your details',
stepTwoLabel = 'Shipping',
stepTwoMore = ' address',
stepTitle = 'Where should we send it?',
fields = DEFAULT_FIELDS,
ctaLabel = 'Yes! Send Me My FREE Book',
ctaNote = 'Continue to shipping details',
loadingLabel = 'Saving your details…',
errorMessage = 'Please fix the highlighted fields to claim your free book.',
insideTitle = 'Everything inside to plan, write and launch',
items: suppliedItems = [],
state = 'default',
onSubmitted,
onSubmit = onSubmitted,
className,
copy,
}: FreeBookHero2Props) {
const text = { ...DEFAULT_COPY, ...copy }
const items = suppliedItems.map((item) => ({ ...item, image: item.itemImage === undefined ? item.image : item.itemImage }))
const uid = React.useId()
const [values, setValues] = React.useState<Record<string, string>>({})
const [errors, setErrors] = React.useState<Record<string, string>>(() => (state === 'error' ? collectErrors(fields, {}, text) : {}))
const [phase, setPhase] = React.useState<'idle' | 'loading'>('idle')
const mounted = React.useRef(true)
React.useEffect(() => {
setValues({})
setErrors(state === 'error' ? collectErrors(fields, {}, text) : {})
setPhase('idle')
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [state])
React.useEffect(() => {
mounted.current = true
return () => {
mounted.current = false
}
}, [])
const disabled = state === 'disabled'
const loading = phase === 'loading'
const hasErrors = Object.keys(errors).length > 0
const forceAttr = state === 'hover' || state === 'active' ? state : undefined
const shipLabel = shippingPrice ? copyText(text.shippingAmount, { amount: shippingPrice }) : text.shipping
const note = shippingNote ?? (shippingPrice ? undefined : text.shippingNote)
const capText = caption ?? copyText(text.caption, { productName })
const bandStyle = textureImage ? ({ '--fbh-texture': `url('${textureImage}')` } as React.CSSProperties) : undefined
function handleChange(field: FreeBookField, value: string) {
setValues((prev) => ({ ...prev, [field.name]: value }))
if (errors[field.name]) {
const msg = fieldError(field, value, text)
setErrors((prev) => {
const next = { ...prev }
if (msg) next[field.name] = msg
else delete next[field.name]
return next
})
}
}
async function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
e.preventDefault()
if (disabled || loading) return
const next = collectErrors(fields, values, text)
setErrors(next)
const first = fields.find((f) => next[f.name])
if (first) {
document.getElementById(`${uid}-${first.name}`)?.focus()
return
}
const result = onSubmit?.(values)
if (!result) return
setPhase('loading')
try {
await result
} finally {
if (mounted.current) setPhase('idle')
}
}
return (
<section className={['cf-free-book-hero-2', className].filter(Boolean).join(' ')} aria-labelledby={`${uid}-h`} style={bandStyle}>
<style>{CSS}</style>
<div className='fbh-sheet'>
<header className='fbh-mast'>
<span className='fbh-mast-side'><Package aria-hidden='true' />{mastheadLeft}</span>
<p className='fbh-mast-title'>{productName}</p>
<span className='fbh-mast-side fbh-mast-right'><MapPin aria-hidden='true' />{mastheadRight}</span>
</header>
<div className='fbh-head'>
<h1 id={`${uid}-h`} className='fbh-h1'>
“{headline}{' '}<span className='fbh-nowrap'><span className='fbh-mark'>{highlight}</span>”</span>
</h1>
<p className='fbh-lead'>{lead}</p>
</div>
<div className='fbh-grid'>
<figure className='fbh-book'>
<div className='fbh-book-stage'>
{bookImage ? (
<img className='fbh-book-img' src={bookImage} alt={bookImageAlt ?? copyText(text.productAlt, { productName })} width={1024} height={1024} loading='eager' />
) : null}
{stampImage ? <img className='fbh-stamp' src={stampImage} alt={stampAlt} width={600} height={400} /> : null}
</div>
<figcaption className='fbh-caption'>{capText}</figcaption>
</figure>
<div className='fbh-card' role='region' aria-labelledby={`${uid}-card`}>
<h2 id={`${uid}-card`} className='fbh-card-title'>{cardTitle}</h2>
<div className={retailPrice ? 'fbh-price' : 'fbh-price no-was'}>
{retailPrice ? (
<>
<span className='fbh-tag fbh-tag-was'>{retailLabel}</span>
<s className='fbh-was-price'>{retailPrice}</s>
</>
) : null}
<span className='fbh-tag fbh-tag-now'>{todayLabel}</span>
<span className='fbh-free'>{freeLabel}</span>
</div>
<p className='fbh-ship'>{shipLabel}</p>
<ul className='fbh-facts'>
{note ? <li><Truck aria-hidden='true' />{note}</li> : null}
<li><MapPin aria-hidden='true' />{shipTo}</li>
</ul>
<div className='fbh-rule' aria-hidden='true' />
<ol className='fbh-steps' aria-label={text.stepsAria}>
<li aria-current='step'>
<span className='fbh-step-num' aria-hidden='true'>1.</span>
<span>{stepOneLabel}</span>
</li>
<li>
<span className='fbh-step-num' aria-hidden='true'>2.</span>
<span>{stepTwoLabel}<span className='fbh-step-more'>{stepTwoMore}</span></span>
</li>
</ol>
<div aria-live='polite'>
<form className='fbh-form' noValidate onSubmit={handleSubmit} aria-labelledby={`${uid}-step`} aria-busy={loading || undefined}>
<h3 id={`${uid}-step`} className='fbh-step-title'>{stepTitle}</h3>
{hasErrors ? (
<p className='fbh-alert' role='alert'><AlertCircle aria-hidden='true' />{errorMessage}</p>
) : null}
{fields.map((f) => {
const id = `${uid}-${f.name}`
const err = errors[f.name]
const isEmail = f.type === 'email'
return (
<div className='fbh-field' key={f.name}>
<label className='fbh-label' htmlFor={id}>{f.label}</label>
<input
id={id}
className='fbh-input'
name={f.name}
type={f.type ?? 'text'}
autoComplete={f.autoComplete}
inputMode={isEmail ? 'email' : undefined}
placeholder={f.placeholder ?? copyText(text.placeholder, { label: f.label.toLowerCase() })}
value={values[f.name] ?? ''}
onChange={(e) => handleChange(f, e.target.value)}
disabled={disabled}
readOnly={loading}
required
aria-invalid={err ? true : undefined}
aria-describedby={err ? `${id}-err` : undefined}
/>
{err ? <p id={`${id}-err`} className='fbh-err'><AlertCircle aria-hidden='true' />{err}</p> : null}
</div>
)
})}
<button type='submit' className='fbh-btn' data-force={forceAttr} disabled={disabled} aria-busy={loading || undefined}>
{loading ? <Loader2 className='fbh-spin' aria-hidden='true' /> : null}
<span className='fbh-btn-label'>{loading ? loadingLabel : ctaLabel}</span>
</button>
<p className='fbh-note'><Lock aria-hidden='true' />{ctaNote}</p>
</form>
</div>
</div>
{items.length ? (
<div className='fbh-inside'>
<h2 className='fbh-inside-title'>{insideTitle}</h2>
<ul className='fbh-items'>
{items.map((it) => (
<li className={it.image ? 'fbh-item' : 'fbh-item no-img'} key={it.name}>
{it.image ? <img src={it.image} alt={it.imageAlt ?? it.name} width={64} height={64} loading='lazy' /> : null}
<div className='fbh-item-copy'>
<b>{it.name}</b>
{it.detail ? <span>{it.detail}</span> : null}
</div>
{it.value ? <span className='fbh-item-val'>{copyText(text.itemValue, { value: it.value })}</span> : null}
</li>
))}
</ul>
{retailPrice ? (
<p className='fbh-total'>
<span>{copyNodes(text.total, { price: <s>{retailPrice}</s> })}</span>
<strong>{copyText(text.today, { label: freeLabel })}</strong>
</p>
) : null}
</div>
) : null}
</div>
</div>
</section>
)
}
export default FreeBookHero2
export type FreeBookField = {
name: string
label: string
type?: string
autoComplete?: string
placeholder?: string
}
export type FreeBookItem = {
name: string
detail?: string
value?: string
/** Image for this item’s item-N slot; takes precedence over legacy image. */
itemImage?: string
image?: string
imageAlt?: string
}
export type FreeBookHeroState = 'default' | 'hover' | 'active' | 'disabled' | 'error' | 'success'
const DEFAULT_FIELDS: FreeBookField[] = [
{ name: 'name', label: 'Full name', autoComplete: 'name', placeholder: 'Jane Smith' },
{ name: 'email', label: 'Email address', type: 'email', autoComplete: 'email', placeholder: 'jane@example.com' },
]
const EMAIL_PATTERN = /^[^@ ]+@[^@ ]+[.][^@ ]{2,}$/
function fieldError(field: FreeBookField, raw: string, text: FreeBookHero2Copy) {
const value = raw.trim()
const isEmail = field.type === 'email' || field.name === 'email'
if (!value) return isEmail ? text.emailRequired : copyText(text.required, { label: field.label.toLowerCase() })
if (isEmail && !EMAIL_PATTERN.test(value)) return text.emailInvalid
return ''
}
function collectErrors(fields: FreeBookField[], values: Record<string, string>, text: FreeBookHero2Copy) {
const out: Record<string, string> = {}
for (const f of fields) {
const msg = fieldError(f, values[f.name] ?? '', text)
if (msg) out[f.name] = msg
}
return out
}
// House recipes only: flat surface band, one featured card, grey wells, Belcher button, tokenised shadows.
const CSS = `
.cf-free-book-hero-2{position:relative;isolation:isolate;overflow:clip;background-color:var(--surface);color:var(--ink);font-family:var(--font-body,system-ui,sans-serif);-webkit-font-smoothing:antialiased}
.cf-free-book-hero-2 *,.cf-free-book-hero-2 *::before,.cf-free-book-hero-2 *::after{box-sizing:border-box}
.cf-free-book-hero-2 svg{stroke-width:2.5}
.cf-free-book-hero-2::before{content:'';position:absolute;inset:0;z-index:-1;background-image:var(--fbh-texture,none);background-size:1200px auto;background-repeat:repeat;opacity:.06;pointer-events:none}
:where(.cf-free-book-hero-2) .fbh-sheet{max-width:calc(1120px + 2 * clamp(16px,5vw,48px));margin:0 auto;padding:clamp(20px,3vw,40px) clamp(16px,5vw,48px) clamp(64px,8.5vw,120px)}
:where(.cf-free-book-hero-2) .fbh-mast{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:16px;padding-bottom:16px;border-bottom:1px solid oklch(from var(--ink) l c h / 0.14)}
:where(.cf-free-book-hero-2) .fbh-mast-side{display:inline-flex;align-items:center;gap:8px;font-weight:800;font-size:.875rem;line-height:1.2;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
:where(.cf-free-book-hero-2) .fbh-mast-side svg{width:16px;height:16px;flex:none;color:var(--accent)}
:where(.cf-free-book-hero-2) .fbh-mast-right{justify-self:end}
:where(.cf-free-book-hero-2) .fbh-mast-title{margin:0;font-family:var(--font-display,system-ui,sans-serif);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-.01em;color:var(--ink);text-align:center;text-wrap:balance;text-transform:var(--display-case,none)}
:where(.cf-free-book-hero-2) .fbh-head{text-align:center;margin-top:clamp(40px,5vw,64px)}
:where(.cf-free-book-hero-2) .fbh-h1{margin:0;font-family:var(--font-display,system-ui,sans-serif);font-weight:var(--display-weight,800);font-size:clamp(2.5rem,5.4vw,4.875rem);line-height:1.04;letter-spacing:var(--display-tracking,-.025em);color:var(--ink);text-wrap:balance;text-transform:var(--display-case,none)}
:where(.cf-free-book-hero-2) .fbh-nowrap{white-space:nowrap}
:where(.cf-free-book-hero-2) .fbh-mark{background-image:linear-gradient(var(--marker,#fae37c),var(--marker,#fae37c));background-repeat:no-repeat;background-size:100% 58%;background-position:0 88%;padding:0 .1em;margin:0 -.02em;border-radius:.3em .6em .45em .25em / .55em .3em .6em .4em;-webkit-box-decoration-break:clone;box-decoration-break:clone}
:where(.cf-free-book-hero-2) .fbh-lead{margin:clamp(16px,1.6vw,24px) auto 0;max-width:46ch;font-weight:500;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;color:var(--ink);text-wrap:pretty}
:where(.cf-free-book-hero-2) .fbh-grid{display:grid;grid-template-columns:minmax(0,1.08fr) minmax(0,.92fr);grid-template-areas:'book card' 'inside card';column-gap:clamp(32px,5vw,72px);row-gap:32px;align-items:start;margin-top:clamp(40px,4.5vw,64px)}
:where(.cf-free-book-hero-2) .fbh-book{grid-area:book;margin:0;display:flex;flex-direction:column;align-items:center}
:where(.cf-free-book-hero-2) .fbh-book-stage{position:relative;width:100%;max-width:520px}
:where(.cf-free-book-hero-2) .fbh-book-img{display:block;width:100%;height:auto;aspect-ratio:1/1;object-fit:cover;object-position:center;border-radius:12px}
:where(.cf-free-book-hero-2) .fbh-stamp{position:absolute;z-index:1;left:2%;bottom:6%;display:block;width:62%;max-width:320px;height:auto;transform:rotate(-12deg);filter:drop-shadow(0 2px 3px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.28)) drop-shadow(0 8px 12px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.16));pointer-events:none}
:where(.cf-free-book-hero-2) .fbh-caption{margin:16px 0 0;max-width:40ch;text-align:center;font-weight:500;font-size:.9375rem;line-height:1.4;color:var(--muted);text-wrap:pretty}
:where(.cf-free-book-hero-2) .fbh-card{grid-area:card;position:sticky;top:24px;container-type:inline-size;background:var(--card);border:1px solid color-mix(in oklch,var(--accent-fill,var(--accent)) 28%,var(--card));border-radius:var(--card-radius,var(--radius,14px));padding:clamp(28px,3vw,40px) clamp(20px,3vw,32px) clamp(24px,3vw,32px);text-align:center;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)))}
:where(.cf-free-book-hero-2) .fbh-card-title{margin:0;font-family:var(--font-display,system-ui,sans-serif);font-weight:var(--display-weight,800);font-size:clamp(1.75rem,7cqi,2.25rem);line-height:1.1;letter-spacing:var(--display-tracking,-.02em);color:var(--ink);text-wrap:balance;text-transform:var(--display-case,none)}
:where(.cf-free-book-hero-2) .fbh-price{display:grid;grid-template-columns:auto auto;justify-content:center;justify-items:center;align-items:baseline;column-gap:clamp(20px,7cqi,40px);row-gap:8px;margin:24px 0 0}
:where(.cf-free-book-hero-2) .fbh-tag-was{grid-area:1/1}
:where(.cf-free-book-hero-2) .fbh-was-price{grid-area:2/1}
:where(.cf-free-book-hero-2) .fbh-tag-now{grid-area:1/2}
:where(.cf-free-book-hero-2) .fbh-free{grid-area:2/2}
:where(.cf-free-book-hero-2) .fbh-price.no-was{grid-template-columns:auto}
:where(.cf-free-book-hero-2) .fbh-price.no-was .fbh-tag-now,:where(.cf-free-book-hero-2) .fbh-price.no-was .fbh-free{grid-column:1}
:where(.cf-free-book-hero-2) .fbh-tag{font-weight:800;font-size:.875rem;line-height:1.2;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
:where(.cf-free-book-hero-2) .fbh-tag-now{color:var(--ink)}
:where(.cf-free-book-hero-2) .fbh-was-price{font-family:var(--font-display,system-ui,sans-serif);font-weight:800;font-size:clamp(1.75rem,8cqi,2.5rem);line-height:1;letter-spacing:-.02em;font-variant-numeric:tabular-nums;color:var(--danger);text-decoration-line:line-through;text-decoration-thickness:.09em;text-decoration-color:var(--danger)}
:where(.cf-free-book-hero-2) .fbh-free{display:block;font-family:var(--font-display,system-ui,sans-serif);font-weight:var(--display-weight,800);font-size:clamp(3rem,16cqi,4.875rem);line-height:.95;letter-spacing:-.03em;color:var(--ink);text-transform:var(--display-case,none)}
:where(.cf-free-book-hero-2) .fbh-ship{margin:24px 0 0;font-family:var(--font-display,system-ui,sans-serif);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-.01em;color:var(--ink);text-wrap:balance;text-transform:var(--display-case,none)}
:where(.cf-free-book-hero-2) .fbh-facts{list-style:none;margin:12px 0 0;padding:0;display:grid;gap:4px}
:where(.cf-free-book-hero-2) .fbh-facts li{display:block;text-align:center;font-size:1.0625rem;line-height:1.45;color:var(--muted);text-wrap:pretty}
:where(.cf-free-book-hero-2) .fbh-facts svg{display:inline-block;width:18px;height:18px;margin-inline-end:.4em;vertical-align:-.2em;color:var(--accent)}
:where(.cf-free-book-hero-2) .fbh-rule{height:1px;margin:24px 0 20px;background:oklch(from var(--ink) l c h / 0.14)}
:where(.cf-free-book-hero-2) .fbh-steps{list-style:none;margin:0 0 20px;padding:0;display:flex;align-items:center;justify-content:center;gap:12px}
:where(.cf-free-book-hero-2) .fbh-steps li{display:flex;align-items:center;gap:8px;min-width:0;margin:0;padding:0;font-weight:500;font-size:1rem;line-height:1.3;color:var(--muted);text-align:left}
:where(.cf-free-book-hero-2) .fbh-steps li:first-child::after{content:'';width:clamp(16px,5cqi,28px);height:1px;flex:none;margin-left:4px;background:oklch(from var(--ink) l c h / 0.24)}
:where(.cf-free-book-hero-2) .fbh-step-num{flex:none;font-family:var(--font-display,system-ui,sans-serif);font-weight:800;font-size:1.3125rem;line-height:1;color:inherit;font-variant-numeric:tabular-nums}
:where(.cf-free-book-hero-2) .fbh-steps li[aria-current]{color:var(--ink);font-weight:700}
:where(.cf-free-book-hero-2) .fbh-steps li[aria-current] .fbh-step-num{color:var(--accent)}
@container (max-width:380px){:where(.cf-free-book-hero-2) .fbh-step-more{display:none}}
:where(.cf-free-book-hero-2) .fbh-form{text-align:left}
:where(.cf-free-book-hero-2) .fbh-step-title{margin:0 0 20px;text-align:center;font-family:var(--font-display,system-ui,sans-serif);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-.01em;color:var(--ink);text-wrap:balance;text-transform:var(--display-case,none)}
:where(.cf-free-book-hero-2) .fbh-alert{display:flex;align-items:flex-start;gap:8px;margin:0 0 16px;padding:12px 16px;border-radius:10px;background:var(--danger-soft);color:var(--danger);font-weight:600;font-size:.9375rem;line-height:1.4;text-wrap:pretty}
:where(.cf-free-book-hero-2) .fbh-alert svg{width:18px;height:18px;flex:none;margin-top:1px}
:where(.cf-free-book-hero-2) .fbh-field{display:grid;gap:8px;margin-bottom:16px}
:where(.cf-free-book-hero-2) .fbh-label{font-weight:700;font-size:1.0625rem;line-height:1.2;color:var(--label-ink,var(--ink))}
:where(.cf-free-book-hero-2) .fbh-input{width:100%;min-height:56px;padding:0 16px;border:1px solid var(--field-border,color-mix(in oklch,var(--ink) 22%,transparent));border-radius:var(--field-radius,var(--radius,12px));background:var(--field,var(--card));color:var(--field-ink,var(--ink));font-family:var(--font-body,system-ui,sans-serif);font-weight:500;font-size:1.0625rem;line-height:1.2;transition:border-color .16s ease,box-shadow .16s ease}
:where(.cf-free-book-hero-2) .fbh-input::placeholder{color:color-mix(in oklch,var(--field-ink) 65%,var(--field));opacity:1}
:where(.cf-free-book-hero-2) .fbh-input:hover:not(:disabled):not(:focus){border-color:oklch(from var(--ink) l c h / 0.42)}
:where(.cf-free-book-hero-2) .fbh-input:focus{outline:none;border-color:var(--field-focus,var(--accent));box-shadow:0 0 0 3px oklch(from var(--field-focus,var(--accent)) l c h / 0.35)}
:where(.cf-free-book-hero-2) .fbh-input[aria-invalid='true'],:where(.cf-free-book-hero-2) .fbh-input[aria-invalid='true']:hover{border-color:var(--danger);box-shadow:0 0 0 3px oklch(from var(--danger) l c h / 0.25)}
:where(.cf-free-book-hero-2) .fbh-input:disabled{background:color-mix(in oklch,var(--ink) 5%,var(--field,var(--card)));color:var(--field-ink,var(--ink));cursor:not-allowed}
:where(.cf-free-book-hero-2) .fbh-err{display:flex;align-items:flex-start;gap:6px;margin:0;font-weight:600;font-size:.9375rem;line-height:1.4;color:var(--danger)}
:where(.cf-free-book-hero-2) .fbh-err svg{width:16px;height:16px;flex:none;margin-top:2px}
:where(.cf-free-book-hero-2) .fbh-btn{--fbh-bg:var(--button-bg,var(--cta));display:flex;align-items:center;justify-content:center;gap:10px;width:100%;min-height:64px;margin:8px 0 0;padding:12px 20px;border:0;border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(180deg,oklch(from var(--fbh-bg) calc(l + 0.04) c h),var(--button-bg-2,oklch(from var(--fbh-bg) calc(l - 0.02) c h)));color:var(--button-ink,var(--cta-ink));font-family:var(--button-font,var(--font-display,system-ui,sans-serif));font-weight:var(--button-weight,800);font-size:clamp(1.0625rem,5.6cqi,1.375rem);line-height:1.15;text-wrap:balance;text-transform:var(--button-case,none);text-shadow:var(--button-text-shadow,none);cursor:pointer;box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--fbh-bg) calc(l + 0.14) c h / 0.7),inset 0 -3px 0 oklch(from var(--fbh-bg) calc(l - 0.16) c h),0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.3),0 8px 16px -6px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.35));transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
:where(.cf-free-book-hero-2) .fbh-btn svg{width:20px;height:20px;flex:none}
:where(.cf-free-book-hero-2) .fbh-btn-label{text-align:center}
:where(.cf-free-book-hero-2) .fbh-btn:hover:not(:disabled),:where(.cf-free-book-hero-2) .fbh-btn[data-force='hover']:not(:disabled){background:linear-gradient(180deg,oklch(from var(--fbh-bg) calc(l - 0.01) c h),oklch(from var(--button-bg-2,oklch(from var(--fbh-bg) calc(l - 0.02) c h)) calc(l - 0.05) c h));transform:translateY(-1px);box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--fbh-bg) calc(l + 0.14) c h / 0.7),inset 0 -3px 0 oklch(from var(--fbh-bg) calc(l - 0.2) c h),0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.32),0 10px 20px -6px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.45))}
:where(.cf-free-book-hero-2) .fbh-btn:active:not(:disabled),:where(.cf-free-book-hero-2) .fbh-btn[data-force='active']:not(:disabled){background:linear-gradient(180deg,oklch(from var(--fbh-bg) calc(l - 0.06) c h),oklch(from var(--button-bg-2,oklch(from var(--fbh-bg) calc(l - 0.02) c h)) calc(l - 0.06) c h));transform:translateY(1px);box-shadow:inset 0 2px 4px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.3),inset 0 -2px 0 oklch(from var(--fbh-bg) calc(l - 0.2) c h),0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.25)}
:where(.cf-free-book-hero-2) .fbh-btn:focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:3px}
:where(.cf-free-book-hero-2) .fbh-btn[aria-busy='true']{cursor:progress}
:where(.cf-free-book-hero-2) .fbh-btn:disabled{cursor:not-allowed;background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));text-shadow:none;box-shadow:none;transform:none}
:where(.cf-free-book-hero-2) .fbh-note{display:block;margin:12px 0 0;font-weight:500;font-size:.9375rem;line-height:1.4;color:var(--muted);text-align:center;text-wrap:pretty}
:where(.cf-free-book-hero-2) .fbh-note svg{display:inline-block;width:16px;height:16px;vertical-align:-.15em;margin-inline-end:.4em}
:where(.cf-free-book-hero-2) .fbh-inside{grid-area:inside;width:100%;background:var(--card);border:1px solid var(--card-border,oklch(from var(--ink) l c h / 0.12));border-radius:var(--card-radius,var(--radius,14px));padding:clamp(20px,3vw,32px);box-shadow:var(--card-shadow,var(--shadow-md,0 1px 2px oklch(0.22 0.03 260 / 0.22),0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)))}
:where(.cf-free-book-hero-2) .fbh-inside-title{margin:0 0 20px;font-family:var(--font-display,system-ui,sans-serif);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-.01em;color:var(--ink);text-wrap:balance;text-transform:var(--display-case,none)}
:where(.cf-free-book-hero-2) .fbh-items{list-style:none;margin:0;padding:0;display:grid;gap:16px}
:where(.cf-free-book-hero-2) .fbh-item{display:grid;grid-template-columns:64px minmax(0,1fr) auto;gap:16px;align-items:start}
:where(.cf-free-book-hero-2) .fbh-item.no-img{grid-template-columns:minmax(0,1fr) auto}
:where(.cf-free-book-hero-2) .fbh-item img{display:block;width:64px;height:64px;object-fit:cover;border-radius:8px;background:color-mix(in oklch,var(--ink) 4%,var(--card))}
:where(.cf-free-book-hero-2) .fbh-item-copy b{display:block;font-weight:700;font-size:1.0625rem;line-height:1.3;color:var(--ink)}
:where(.cf-free-book-hero-2) .fbh-item-copy span{display:block;margin-top:4px;font-size:1rem;line-height:1.45;color:var(--muted);text-wrap:pretty}
:where(.cf-free-book-hero-2) .fbh-item-val{display:inline-flex;align-items:center;min-height:28px;padding:4px 12px;border-radius:999px;background:color-mix(in oklch,var(--ink) 6%,var(--card));font-weight:800;font-size:.875rem;line-height:1.2;font-variant-numeric:tabular-nums;color:var(--ink);white-space:nowrap}
:where(.cf-free-book-hero-2) .fbh-total{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 16px;margin:20px 0 0;padding:14px 16px;border-radius:10px;background:color-mix(in oklch,var(--ink) 5%,var(--card));font-weight:700;font-size:1.0625rem;line-height:1.3;color:var(--ink)}
:where(.cf-free-book-hero-2) .fbh-total s{color:var(--danger);text-decoration-color:var(--danger);text-decoration-thickness:2px}
:where(.cf-free-book-hero-2) .fbh-total strong{font-family:var(--font-display,system-ui,sans-serif);font-weight:800;text-transform:var(--display-case,none)}
@media (max-width:900px){
:where(.cf-free-book-hero-2) .fbh-grid{grid-template-columns:minmax(0,1fr);grid-template-areas:'book' 'card' 'inside'}
:where(.cf-free-book-hero-2) .fbh-book-stage{max-width:360px}
:where(.cf-free-book-hero-2) .fbh-card{position:relative;top:auto;width:100%;max-width:560px;justify-self:center}
:where(.cf-free-book-hero-2) .fbh-inside{max-width:560px;justify-self:center}
}
@media (max-width:720px){
:where(.cf-free-book-hero-2) .fbh-mast{grid-template-columns:minmax(0,1fr);padding-bottom:12px}
:where(.cf-free-book-hero-2) .fbh-mast-side{display:none}
}
@media (max-width:480px){
:where(.cf-free-book-hero-2) .fbh-item{grid-template-columns:56px minmax(0,1fr);gap:12px 16px}
:where(.cf-free-book-hero-2) .fbh-item img{width:56px;height:56px}
:where(.cf-free-book-hero-2) .fbh-item-val{grid-column:2;justify-self:start}
:where(.cf-free-book-hero-2) .fbh-item.no-img{grid-template-columns:minmax(0,1fr)}
:where(.cf-free-book-hero-2) .fbh-item.no-img .fbh-item-val{grid-column:1}
:where(.cf-free-book-hero-2) .fbh-total{flex-direction:column;align-items:flex-start;gap:4px}
}
@keyframes fbh-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes fbh-pop{from{transform:rotate(-12deg) scale(.9)}to{transform:rotate(-12deg) scale(1)}}
@keyframes fbh-spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:no-preference){
:where(.cf-free-book-hero-2) .fbh-head{animation:fbh-rise .45s cubic-bezier(.2,.7,.2,1) both}
:where(.cf-free-book-hero-2) .fbh-book-stage{animation:fbh-rise .45s .07s cubic-bezier(.2,.7,.2,1) both}
:where(.cf-free-book-hero-2) .fbh-stamp{animation:fbh-pop .3s .35s cubic-bezier(.2,.7,.2,1) both}
:where(.cf-free-book-hero-2) .fbh-card{animation:fbh-rise .45s .14s cubic-bezier(.2,.7,.2,1) both}
:where(.cf-free-book-hero-2) .fbh-inside{animation:fbh-rise .45s .21s cubic-bezier(.2,.7,.2,1) both}
:where(.cf-free-book-hero-2) .fbh-spin{animation:fbh-spin .8s linear infinite}
}
@media (prefers-reduced-motion:reduce){
.cf-free-book-hero-2 *,.cf-free-book-hero-2 *::before,.cf-free-book-hero-2 *::after{animation:none!important;transition:none!important}
:where(.cf-free-book-hero-2) .fbh-btn:hover:not(:disabled),:where(.cf-free-book-hero-2) .fbh-btn[data-force='hover']:not(:disabled),:where(.cf-free-book-hero-2) .fbh-btn:active:not(:disabled),:where(.cf-free-book-hero-2) .fbh-btn[data-force='active']:not(:disabled){transform:none}
}
@media (forced-colors:active){
:where(.cf-free-book-hero-2) .fbh-btn,:where(.cf-free-book-hero-2) .fbh-card,:where(.cf-free-book-hero-2) .fbh-inside,:where(.cf-free-book-hero-2) .fbh-input{border:2px solid ButtonText}
}
`
type FreeBookHero2Copy = {
/** Uses {label}. */
placeholder: string
emailRequired: string
/** Uses {label}. */
required: string
emailInvalid: string
/** Uses {amount}. */
shippingAmount: string
shipping: string
shippingNote: string
/** Uses {productName}. */
caption: string
/** Uses {productName}. */
successBody: string
/** Uses {productName}. */
productAlt: string
stepsAria: string
/** Uses {value}. */
itemValue: string
/** {price} renders the original struck price. */
total: string
/** Uses {label}. */
today: string
}
const DEFAULT_COPY: FreeBookHero2Copy = {
placeholder: 'Enter your {label}',
emailRequired: 'Please enter your email address.',
required: 'Please enter your {label}.',
emailInvalid: 'Please enter a valid email address.',
shippingAmount: 'Just cover {amount} shipping',
shipping: 'Just cover shipping',
shippingNote: 'Shipping is calculated at checkout',
caption: '{productName}: yours free, you just cover shipping.',
successBody: 'Next, tell us where to ship your copy of {productName}.',
productAlt: '{productName} hardcover book',
stepsAria: 'Order steps',
itemValue: '{value} value',
total: 'Total value {price}',
today: 'Yours {label} today',
}
function copyText(template: string, values: Record<string, string | number>) {
return template.replace(/[{]([A-Za-z0-9_]+)[}]/g, (match, key: string) => (Object.hasOwn(values, key) ? String(values[key]) : match))
}
function copyNodes(template: string, values: Record<string, React.ReactNode>) {
return template.split(/([{][A-Za-z0-9_]+[}])/g).map((part, index) => {
const key = part.slice(1, -1)
return part.startsWith('{') && Object.hasOwn(values, key) ? <React.Fragment key={index}>{values[key]}</React.Fragment> : part
})
}
pieces/hero/free-book-hero-2/specimen.tsx 35 lines
import __studioImage2f6775be from '../assets/97ce068106c7dd70.webp'
import __studioImage2d05281b from '../assets/bc7c834cdae0401d.webp'
import * as React from 'react'
import { FreeBookHero2, type FreeBookHeroState } from '../free-book-hero-2'
import { slot } from '../../slots'
import defaults from '../../studio-defaults.json'
export const states = ['default', 'hover', 'active', 'disabled', 'error']
export default function FreeBookHeroSpecimen({ state = 'default' }: { state?: string }) {
const s = defaults.sample
const fields = s.fields.map((f) => ({
...f,
placeholder: f.name === 'email' ? 'jane@example.com' : 'Jane Smith',
}))
return (
<div>
<FreeBookHero2
state={state as FreeBookHeroState}
productName={s.name}
headline='Build Your First Funnel With'
highlight='A Clear Plan'
lead={s.lead}
retailPrice={s.regularPrice}
productImage={slot('product', __studioImage2f6775be)}
bookImageAlt={`${s.name} hardcover book`}
stampImage={slot('stamp', __studioImage2d05281b)}
fields={fields}
ctaLabel='Yes! Send Me My FREE Book'
ctaNote='Continue to shipping details'
items={s.items.map((item, i) => ({ ...item, itemImage: slot(`item-${i + 1}`, item.image) }))}
/>
</div>
)
}
| Name | Type | Details |
|---|---|---|
copy OptionalFreeBookHero2 |
Partial<FreeBookHero2Copy> |
|
productName OptionalFreeBookHero2 |
string |
Default 'The Funnel Starter Kit'
|
mastheadLeft OptionalFreeBookHero2 |
string |
Default 'Free book offer'
|
mastheadRight OptionalFreeBookHero2 |
string |
Default 'Shipped to your door'
|
headline OptionalFreeBookHero2 |
string |
Default 'Build Your First Funnel With'
|
highlight OptionalFreeBookHero2 |
string |
Default 'A Clear Plan'
|
lead OptionalFreeBookHero2 |
string |
Default 'Plan your funnel, write your page copy, and check every step before you launch.'
|
productImage OptionalFreeBookHero2 |
string |
Default legacyBookImage
|
bookImage OptionalFreeBookHero2 |
string |
|
bookImageAlt OptionalFreeBookHero2 |
string |
|
stampImage OptionalFreeBookHero2 |
string |
|
stampAlt OptionalFreeBookHero2 |
string |
Default ''
|
textureImage OptionalFreeBookHero2 |
string |
|
caption OptionalFreeBookHero2 |
string |
|
cardTitle OptionalFreeBookHero2 |
string |
Default 'Get Your FREE Book'
|
retailPrice OptionalFreeBookHero2 |
string |
|
retailLabel OptionalFreeBookHero2 |
string |
Default 'Regular'
|
todayLabel OptionalFreeBookHero2 |
string |
Default 'Today'
|
freeLabel OptionalFreeBookHero2 |
string |
Default 'FREE'
|
shippingPrice OptionalFreeBookHero2 |
string |
|
shippingNote OptionalFreeBookHero2 |
string |
|
shipTo OptionalFreeBookHero2 |
string |
Default 'Mailed to your shipping address'
|
stepOneLabel OptionalFreeBookHero2 |
string |
Default 'Your details'
|
stepTwoLabel OptionalFreeBookHero2 |
string |
Default 'Shipping'
|
stepTwoMore OptionalFreeBookHero2 |
string |
Default ' address'
|
stepTitle OptionalFreeBookHero2 |
string |
Default 'Where should we send it?'
|
fields OptionalFreeBookHero2 |
FreeBookField[] |
Default DEFAULT_FIELDS
|
ctaLabel OptionalFreeBookHero2 |
string |
Default 'Yes! Send Me My FREE Book'
|
ctaNote OptionalFreeBookHero2 |
string |
Default 'Continue to shipping details'
|
loadingLabel OptionalFreeBookHero2 |
string |
Default 'Saving your details…'
|
errorMessage OptionalFreeBookHero2 |
string |
Default 'Please fix the highlighted fields to claim your free book.'
|
successTitle OptionalFreeBookHero2 |
string |
|
successBody OptionalFreeBookHero2 |
string |
|
continueLabel OptionalFreeBookHero2 |
string |
|
insideTitle OptionalFreeBookHero2 |
string |
Default 'Everything inside to plan, write and launch'
|
items OptionalFreeBookHero2 |
FreeBookItem[] |
Default []
|
state OptionalFreeBookHero2 |
FreeBookHeroState |
Default 'default'
|
onSubmit OptionalFreeBookHero2 |
(values: Record<string, string>) => void | Promise<void> |
Default onSubmitted
|
onSubmitted OptionalFreeBookHero2 |
(values: Record<string, string>) => void | Promise<void> |
|
onAction OptionalFreeBookHero2 |
() => void |
|
onContinue OptionalFreeBookHero2 |
() => void |
|
className OptionalFreeBookHero2 |
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.
item-*- One image per offer item (item-1, item-2…), shown in stacks and lists.
product- The main product shot or cover (ebook, kit, bottle).
stamp- A stamp or badge graphic, on a transparent background.
-
97ce068106c7dd70.webp
image/webp · 199 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
bc7c834cdae0401d.webp
image/webp · 246 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB