Choose Your Gift 1
Choose-your-free-gift opt-in: big selectable gift covers on a spotlit stage. Picking one is the micro-commitment that
Use it in a prompt
Use forms/choose-your-gift 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/choose-your-gift.tsx. - Import it and pass your copy and images (Props tab):
import { ChooseYourGift } from "@/components/funneldna/forms/choose-your-gift"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/forms/choose-your-gift/component.tsx 504 lines
// layout: bento-grid
// Choose-your-free-gift opt-in: big selectable gift covers on a spotlit stage. Picking one is the micro-commitment that
// opens a short contact step naming that gift, so the visitor finishes a step they already started.
import * as React from 'react'
import { AlertCircle, Check, Loader2, Lock } from 'lucide-react'
import { Divider, FX_HOST, Spot, Spotlight } from '../fx/fx'
import bookSpot from '../fx/spots/book'
import checklistSpot from '../fx/spots/checklist'
import giftSpot from '../fx/spots/gift'
import rocketSpot from '../fx/spots/rocket'
export type ChooseYourGiftItem = {
id: string
name: string
// one line on what the gift does for them
detail: string
// cover art for the item-n slot; a transparent cut-out reads best on the stage
image?: string
// fx Spot illustration shown when there is no cover image
spot?: string
}
export type ChooseYourGiftField = {
name: string
label: string
type?: string
autoComplete?: string
placeholder?: string
}
export type ChooseYourGiftLead = { lead: string; text: string }
export type ChooseYourGiftState = 'default' | 'hover' | 'active' | 'disabled' | 'error'
export type ChooseYourGiftProps = {
headline?: string
// phrase inside the headline that gets the marker stroke
highlight?: string
// 1 only when this block is the page's first screen
headingLevel?: 1 | 2
// short paragraphs, each opened by a bold lead-in
lead?: ChooseYourGiftLead[]
// 2 to 4 free gifts
gifts?: ChooseYourGiftItem[]
// screen-reader name of the gift choice
legend?: string
chooseLabel?: string
selectedLabel?: string
promptTitle?: string
// {count} becomes the number of gifts
promptText?: string
facts?: string[]
chosenLabel?: string
changeLabel?: string
// {gift} becomes the chosen gift's name
stepTitle?: string
// {gift} becomes the chosen gift's name; announced to screen readers
announce?: string
fields?: ChooseYourGiftField[]
buttonLabel?: string
busyLabel?: string
privacy?: string
// {label} becomes the field label in lower case
requiredError?: string
emailError?: string
// id of a gift chosen on load
defaultSelected?: string
disabled?: boolean
// shows the spinner while the page's handler works
busy?: boolean
onSelect?: (id: string) => void
onSubmit?: (data: { gift: string; giftName: string; values: Record<string, string> }) => void
state?: ChooseYourGiftState
className?: string
}
export function ChooseYourGift(props: ChooseYourGiftProps) {
const {
headline = 'Which free gift do you want?',
highlight = 'free gift',
headingLevel = 2,
lead = DEFAULT_LEAD,
gifts = DEFAULT_GIFTS,
legend = 'Choose your free gift',
chooseLabel = 'Choose this gift',
selectedLabel = 'Your pick',
promptTitle = 'Your free gift is waiting',
promptText = 'Choose one of the {count} gifts to claim it.',
facts = DEFAULT_FACTS,
chosenLabel = 'You’re claiming',
changeLabel = 'Change',
stepTitle = 'Where should we send your {gift}?',
announce = '{gift} chosen. Enter your details to claim it.',
fields = DEFAULT_FIELDS,
buttonLabel = 'Send My Free Gift',
busyLabel = 'Sending…',
privacy = 'We respect your inbox. Unsubscribe anytime.',
requiredError = 'Please enter your {label}.',
emailError = 'Please enter a valid email address.',
defaultSelected,
disabled = false,
busy = false,
onSelect,
onSubmit,
state = 'default',
className,
} = props
const uid = React.useId().replace(/:/g, '')
const radios = React.useRef<Record<string, HTMLInputElement | null>>({})
const inputs = React.useRef<Record<string, HTMLInputElement | null>>({})
const validate = (vals: Record<string, string>) => {
const out: Record<string, string> = {}
for (const f of fields) {
const v = (vals[f.name] ?? '').trim()
if (!v) out[f.name] = fill(requiredError, { label: f.label.toLowerCase() })
else if (f.type === 'email' && !isEmail(v)) out[f.name] = emailError
}
return out
}
const seed = () => {
const preset = state === 'active' || state === 'error' || state === 'disabled'
const pick = preset ? defaultSelected ?? gifts[1]?.id ?? gifts[0]?.id ?? null : defaultSelected ?? null
const values: Record<string, string> = {}
for (const f of fields) values[f.name] = state === 'error' && f.type === 'email' ? 'jane@' : ''
return { pick, values, errors: state === 'error' ? validate(values) : {} }
}
const [selected, setSelected] = React.useState<string | null>(() => seed().pick)
const [values, setValues] = React.useState<Record<string, string>>(() => seed().values)
const [errors, setErrors] = React.useState<Record<string, string>>(() => seed().errors)
const mounted = React.useRef(false)
React.useEffect(() => {
if (!mounted.current) {
mounted.current = true
return
}
const next = seed()
setSelected(next.pick)
setValues(next.values)
setErrors(next.errors)
// the studio state is the only outside reset
}, [state])
const isDisabled = disabled || state === 'disabled'
const odd = gifts.length % 2 === 1
const chosen = gifts.find((g) => g.id === selected) ?? null
const Title = headingLevel === 1 ? 'h1' : 'h2'
const Sub = headingLevel === 1 ? 'h2' : 'h3'
function choose(id: string) {
if (isDisabled) return
setSelected(id)
setErrors({})
onSelect?.(id)
}
function change() {
const prev = selected
setSelected(null)
setErrors({})
if (prev) radios.current[prev]?.focus()
}
function update(name: string, v: string) {
const nextValues = { ...values, [name]: v }
setValues(nextValues)
if (errors[name]) {
const one = validate(nextValues)[name]
setErrors((prev) => {
const next = { ...prev }
if (one) next[name] = one
else delete next[name]
return next
})
}
}
function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
e.preventDefault()
if (!chosen || isDisabled || busy) return
const found = validate(values)
setErrors(found)
const firstBad = fields.find((f) => found[f.name])
if (firstBad) {
inputs.current[firstBad.name]?.focus()
return
}
onSubmit?.({ gift: chosen.id, giftName: chosen.name, values })
}
return (
<section className={cx('cf-choose-your-gift', className)} style={FX_HOST} aria-labelledby={`${uid}-title`}>
<style>{CSS}</style>
<Spotlight />
<div className='cyg-inner'>
<header className='cyg-head'>
<Title id={`${uid}-title`} className={cx('cyg-title', headingLevel === 1 && 'is-hero')}>
{withHighlight(headline, highlight)}
</Title>
{lead.length > 0 && (
<div className='cyg-lead'>
{lead.map((p, i) => (
<p key={i}>
<strong>{p.lead}</strong> {p.text}
</p>
))}
</div>
)}
</header>
<div className='cyg-bento'>
<fieldset className='cyg-gifts' disabled={isDisabled}>
<legend className='cyg-sr'>{legend}</legend>
{gifts.map((g, i) => {
const on = selected === g.id
return (
<label
key={g.id}
className={cx('cyg-tile', on && 'is-on', odd && i === 0 && 'is-wide', state === 'hover' && i === 0 && 'is-hover')}
>
<input
ref={(el) => {
radios.current[g.id] = el
}}
className='cyg-sr'
type='radio'
name={`${uid}-gift`}
value={g.id}
checked={on}
onChange={() => choose(g.id)}
/>
<span className='cyg-stage'>
{g.image ? (
<img src={g.image} alt='' width={480} height={480} loading='lazy' decoding='async' />
) : (
<span className='cyg-spot'>
<Spot src={g.spot ?? giftSpot} size={112} />
</span>
)}
<span className='cyg-floor' aria-hidden='true' />
</span>
<span className='cyg-copy'>
<span className='cyg-name'>{g.name}</span>
<span className='cyg-detail'>{g.detail}</span>
<span className='cyg-pick' aria-hidden='true'>
<span className='cyg-dot'>{on && <Check size={14} strokeWidth={3} />}</span>
{on ? selectedLabel : chooseLabel}
</span>
</span>
</label>
)
})}
</fieldset>
<div className='cyg-card' role='group' aria-labelledby={`${uid}-step`}>
<p className='cyg-sr' aria-live='polite'>
{chosen ? fill(announce, { gift: chosen.name }) : ''}
</p>
{chosen ? (
<form key={chosen.id} className='cyg-form' noValidate onSubmit={handleSubmit} aria-labelledby={`${uid}-step`}>
<div className='cyg-chosen'>
<span className='cyg-thumb' aria-hidden='true'>
{chosen.image ? (
<img src={chosen.image} alt='' width={112} height={112} />
) : (
<Spot src={chosen.spot ?? giftSpot} size={48} />
)}
</span>
<span className='cyg-chosen-copy'>
<span className='cyg-small'>{chosenLabel}</span>
<span className='cyg-chosen-name'>{chosen.name}</span>
</span>
<button type='button' className='cyg-change' onClick={change} disabled={isDisabled || busy}>
{changeLabel}
</button>
</div>
<Sub id={`${uid}-step`} className='cyg-h3'>
{fill(stepTitle, { gift: chosen.name })}
</Sub>
<fieldset className='cyg-fields' disabled={isDisabled}>
{fields.map((f) => {
const id = `${uid}-${f.name}`
const err = errors[f.name]
return (
<div className='cyg-field' key={f.name}>
<label htmlFor={id}>{f.label}</label>
<input
ref={(el) => {
inputs.current[f.name] = el
}}
id={id}
name={f.name}
type={f.type ?? 'text'}
autoComplete={f.autoComplete}
placeholder={f.placeholder ?? placeholderFor(f)}
value={values[f.name] ?? ''}
onChange={(e) => update(f.name, e.target.value)}
aria-invalid={err ? true : undefined}
aria-describedby={err ? `${id}-err` : undefined}
className={cx('cyg-input', err && 'is-bad')}
/>
{err && (
<p className='cyg-err' id={`${id}-err`}>
<AlertCircle className='cyg-ic' size={16} strokeWidth={2.5} aria-hidden='true' />
{err}
</p>
)}
</div>
)
})}
</fieldset>
<button type='submit' className='cyg-btn' disabled={isDisabled || busy} aria-busy={busy || undefined}>
{busy && <Loader2 className='cyg-spin' size={20} strokeWidth={2.5} aria-hidden='true' />}
<span>{busy ? busyLabel : buttonLabel}</span>
</button>
{privacy && (
<p className='cyg-privacy'>
<Lock className='cyg-ic' size={16} strokeWidth={2.5} aria-hidden='true' />
{privacy}
</p>
)}
</form>
) : (
<div className='cyg-prompt' key='prompt'>
<Spot src={giftSpot} size={72} />
<Sub id={`${uid}-step`} className='cyg-h3'>
{promptTitle}
</Sub>
<p className='cyg-text'>{fill(promptText, { count: String(gifts.length) })}</p>
{facts.length > 0 && (
<ul className='cyg-facts'>
{facts.map((f) => (
<li key={f}>
<span className='cyg-badge' aria-hidden='true'>
<Check size={14} strokeWidth={3} />
</span>
{f}
</li>
))}
</ul>
)}
</div>
)}
</div>
</div>
</div>
<div className='cyg-edge' aria-hidden='true'>
<Divider shape='wave' tone='surface' height={56} />
</div>
</section>
)
}
export default ChooseYourGift
const DEFAULT_LEAD: ChooseYourGiftLead[] = [
{ lead: 'Pick one.', text: 'Every gift is a ready-to-use tool you can put to work today.' },
{ lead: 'It’s free.', text: 'Tell us where to send it and it’s yours.' },
]
const DEFAULT_GIFTS: ChooseYourGiftItem[] = [
{ id: 'guide', name: 'The Planning Guide', detail: 'Map your offer and every page your funnel needs.', spot: bookSpot },
{ id: 'workbook', name: 'The Copy Workbook', detail: 'Fill-in prompts for your headline, offer and call to action.', spot: checklistSpot },
{ id: 'checklist', name: 'The Launch Checklist', detail: 'Check every link, form and next step before you go live.', spot: rocketSpot },
]
const DEFAULT_FACTS = ['Free, no card needed', 'Takes about 30 seconds', 'Sent to the email you enter']
const DEFAULT_FIELDS: ChooseYourGiftField[] = [
{ name: 'name', label: 'First name', autoComplete: 'given-name', placeholder: 'Jane' },
{ name: 'email', label: 'Email address', type: 'email', autoComplete: 'email', placeholder: 'you@example.com' },
]
function cx(...parts: Array<string | false | null | undefined>) {
return parts.filter(Boolean).join(' ')
}
function fill(template: string, map: Record<string, string>) {
return Object.keys(map).reduce((out, key) => out.split('{' + key + '}').join(map[key]), template)
}
function isEmail(v: string) {
const at = v.indexOf('@')
const dot = v.lastIndexOf('.')
return at > 0 && dot > at + 1 && dot < v.length - 1 && !v.includes(' ')
}
function placeholderFor(f: ChooseYourGiftField) {
if (f.type === 'email') return 'you@example.com'
if (f.type === 'tel') return '(555) 123-4567'
if (f.name.toLowerCase().includes('name')) return 'Jane Smith'
return 'Type your answer'
}
function withHighlight(text: string, phrase: string) {
const at = phrase ? text.indexOf(phrase) : -1
if (at < 0) return text
return (
<>
{text.slice(0, at)}
<span className='cyg-hl'>{phrase}</span>
{text.slice(at + phrase.length)}
</>
)
}
const CSS = `
.cf-choose-your-gift{--cyg-shade:var(--shadow,oklch(0.22 0.03 256));position:relative;isolation:isolate;overflow:hidden;background:var(--band);color:var(--band-ink);font-family:var(--font-body);padding:clamp(56px,8vw,112px) clamp(16px,5vw,48px) calc(clamp(64px,8.5vw,120px) + 56px)}
.cf-choose-your-gift *,.cf-choose-your-gift *::before,.cf-choose-your-gift *::after{box-sizing:border-box}
.cf-choose-your-gift .cyg-inner{position:relative;z-index:1;max-width:1120px;margin-inline:auto}
.cf-choose-your-gift .cyg-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.cf-choose-your-gift .cyg-head{max-width:46rem;margin:0 auto clamp(32px,4.5vw,48px);text-align:center}
.cf-choose-your-gift .cyg-title{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;text-wrap:balance;color:var(--band-ink)}
.cf-choose-your-gift .cyg-title.is-hero{font-size:clamp(2.5rem,5.4vw,4.875rem);line-height:1.04}
.cf-choose-your-gift .cyg-hl{--cyg-marker:var(--marker,oklch(from var(--accent-fill,var(--accent)) l c h / 0.6));background-image:linear-gradient(to bottom,transparent 62%,var(--cyg-marker) 62%,var(--cyg-marker) 94%,transparent 94%);-webkit-box-decoration-break:clone;box-decoration-break:clone;padding-inline:0.06em;border-radius:0.1em}
.cf-choose-your-gift .cyg-lead{display:grid;gap:8px;max-width:40rem;margin:clamp(16px,2vw,24px) auto 0}
.cf-choose-your-gift .cyg-lead p{margin:0;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;text-wrap:balance}
.cf-choose-your-gift .cyg-lead strong{font-weight:800}
.cf-choose-your-gift .cyg-bento{display:grid;grid-template-columns:minmax(0,7fr) minmax(0,5fr);gap:clamp(16px,2vw,24px);align-items:start}
.cf-choose-your-gift .cyg-gifts{min-width:0;margin:0;padding:0;border:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.cf-choose-your-gift .cyg-tile{position:relative;display:flex;flex-direction:column;min-width:0;padding:clamp(16px,2vw,24px);border-radius:var(--card-radius,var(--radius,14px));border:1px solid oklch(from var(--band-ink) l c h / 0.16);background:oklch(from var(--band) calc(l + 0.045) c h);color:var(--band-ink);cursor:pointer;box-shadow:inset 0 1px 0 oklch(from var(--band-ink) l c h / 0.08),var(--shadow-sm,0 1px 2px oklch(from var(--cyg-shade) l c h / 0.25));transition:transform .16s ease,background-color .16s ease,border-color .16s ease,box-shadow .16s ease}
.cf-choose-your-gift .cyg-gifts:not(:disabled) .cyg-tile:hover,.cf-choose-your-gift .cyg-tile.is-hover{background:oklch(from var(--band) calc(l + 0.07) c h);border-color:oklch(from var(--band-ink) l c h / 0.36);transform:translateY(-2px);box-shadow:inset 0 1px 0 oklch(from var(--band-ink) l c h / 0.1),var(--shadow-md,0 1px 2px oklch(from var(--cyg-shade) l c h / 0.22),0 4px 10px -2px oklch(from var(--cyg-shade) l c h / 0.2))}
.cf-choose-your-gift .cyg-gifts .cyg-tile.is-on,.cf-choose-your-gift .cyg-gifts:not(:disabled) .cyg-tile.is-on:hover{background:oklch(from var(--band) calc(l + 0.09) c h);border-color:var(--band-ink);box-shadow:inset 0 0 0 1px var(--band-ink),var(--shadow-lg,0 2px 4px oklch(from var(--cyg-shade) l c h / 0.22),0 12px 24px -8px oklch(from var(--cyg-shade) l c h / 0.32))}
.cf-choose-your-gift .cyg-tile:has(input:focus-visible){outline:3px solid var(--band-ink);outline-offset:3px}
.cf-choose-your-gift .cyg-gifts:disabled .cyg-tile{cursor:not-allowed;opacity:0.6}
.cf-choose-your-gift .cyg-stage{position:relative;display:flex;align-items:flex-end;justify-content:center;height:clamp(150px,15vw,190px);margin-bottom:16px}
.cf-choose-your-gift .cyg-stage img{position:relative;z-index:1;display:block;height:100%;width:auto;max-width:82%;object-fit:contain;filter:drop-shadow(0 2px 3px oklch(from var(--cyg-shade) l c h / 0.45)) drop-shadow(0 12px 14px oklch(from var(--cyg-shade) l c h / 0.35));transition:transform .2s ease}
.cf-choose-your-gift .cyg-spot{position:relative;z-index:1;display:block;line-height:0}
.cf-choose-your-gift .cyg-floor{position:absolute;z-index:0;left:50%;bottom:-8px;width:68%;height:18px;transform:translateX(-50%);border-radius:50%;background:radial-gradient(closest-side,oklch(from var(--cyg-shade) calc(l - 0.1) c h / 0.75),transparent);transition:opacity .2s ease}
.cf-choose-your-gift .cyg-gifts:not(:disabled) .cyg-tile:hover .cyg-stage img,.cf-choose-your-gift .cyg-tile.is-hover .cyg-stage img,.cf-choose-your-gift .cyg-tile.is-on .cyg-stage img{transform:translateY(-4px)}
.cf-choose-your-gift .cyg-copy{display:flex;flex-direction:column;flex:1;min-width:0}
.cf-choose-your-gift .cyg-name{display:block;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-0.01em;text-wrap:balance}
.cf-choose-your-gift .cyg-detail{display:block;margin-top:8px;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;text-wrap:pretty}
.cf-choose-your-gift .cyg-pick{display:flex;align-items:center;gap:10px;margin-top:auto;padding-top:16px;font-size:0.9375rem;font-weight:700;line-height:1.4}
.cf-choose-your-gift .cyg-dot{display:grid;place-items:center;flex:none;width:24px;height:24px;border-radius:999px;border:2px solid oklch(from var(--band-ink) l c h / 0.6);color:var(--band)}
.cf-choose-your-gift .cyg-tile.is-on .cyg-dot{background:var(--band-ink);border-color:var(--band-ink);animation:cyg-pop .3s ease both}
.cf-choose-your-gift .cyg-tile.is-wide{grid-column:1 / -1;display:grid;grid-template-columns:minmax(0,0.9fr) minmax(0,1.1fr);gap:24px;align-items:start}
.cf-choose-your-gift .cyg-tile.is-wide .cyg-stage{margin:0;height:clamp(170px,17vw,210px)}
.cf-choose-your-gift .cyg-tile.is-wide .cyg-copy{align-self:stretch;padding-block:8px}
.cf-choose-your-gift .cyg-card{position:sticky;top:24px;min-width:0;padding:clamp(20px,3vw,32px);border-radius:var(--card-radius,var(--radius,14px));border:1px solid var(--card-border,oklch(from var(--ink) l c h / 0.12));background:var(--card);color:var(--ink);box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(from var(--cyg-shade) l c h / 0.22),0 12px 24px -8px oklch(from var(--cyg-shade) l c h / 0.32)))}
.cf-choose-your-gift .cyg-prompt,.cf-choose-your-gift .cyg-form{display:grid;gap:16px;animation:cyg-in .45s cubic-bezier(.2,.7,.2,1) both}
.cf-choose-your-gift .cyg-prompt{justify-items:start;gap:12px}
.cf-choose-your-gift .cyg-h3{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-0.01em;text-wrap:balance;color:var(--ink)}
.cf-choose-your-gift .cyg-text{margin:0;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;color:var(--muted);text-wrap:pretty}
.cf-choose-your-gift .cyg-facts{list-style:none;margin:8px 0 0;padding:0;display:grid;gap:12px}
.cf-choose-your-gift .cyg-facts li{display:flex;align-items:flex-start;gap:12px;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.4;font-weight:600;color:var(--ink)}
.cf-choose-your-gift .cyg-badge{display:grid;place-items:center;flex:none;width:22px;height:22px;margin-top:1px;border-radius:999px;background:var(--success);color:var(--cyg-badge-ink,#fff)}
.cf-choose-your-gift .cyg-chosen{display:flex;align-items:center;gap:12px;padding:12px;border-radius:min(10px,var(--card-radius,var(--radius,10px)));background:color-mix(in oklch,var(--ink) 4%,var(--card))}
.cf-choose-your-gift .cyg-thumb{display:grid;place-items:center;flex:none;width:56px;height:56px}
.cf-choose-your-gift .cyg-thumb img{display:block;max-width:100%;max-height:100%;object-fit:contain;filter:drop-shadow(0 2px 3px oklch(from var(--cyg-shade) l c h / 0.35))}
.cf-choose-your-gift .cyg-chosen-copy{display:grid;gap:2px;flex:1;min-width:0}
.cf-choose-your-gift .cyg-small{font-size:0.9375rem;line-height:1.4;font-weight:500;color:var(--muted)}
.cf-choose-your-gift .cyg-chosen-name{font-family:var(--font-display);font-size:1.0625rem;line-height:1.25;font-weight:var(--display-weight,800);color:var(--ink);text-wrap:balance}
.cf-choose-your-gift .cyg-change{flex:none;min-height:44px;padding:0 16px;border-radius:var(--button-radius,var(--radius,12px));border:1px solid var(--button-2-border,transparent);background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));box-shadow:var(--button-2-shadow,var(--shadow-sm));font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);font-size:0.9375rem;text-transform:var(--button-case,none);cursor:pointer;transition:background-color .16s ease,transform .16s ease}
.cf-choose-your-gift .cyg-change:hover:not(:disabled){background:oklch(from var(--button-2-bg,var(--secondary)) calc(l - 0.04) c h)}
.cf-choose-your-gift .cyg-change:active:not(:disabled){transform:translateY(1px)}
.cf-choose-your-gift .cyg-change:focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:2px}
.cf-choose-your-gift .cyg-change:disabled{opacity:0.55;cursor:not-allowed}
.cf-choose-your-gift .cyg-fields{min-width:0;margin:0;padding:0;border:0;display:grid;gap:16px}
.cf-choose-your-gift .cyg-field{display:grid;gap:8px}
.cf-choose-your-gift .cyg-field label{font-size:1rem;font-weight:700;line-height:1.3;color:var(--label-ink,var(--ink))}
.cf-choose-your-gift .cyg-input{width:100%;height:56px;padding:0 16px;font-family:var(--font-body);font-size:17px;color:var(--field-ink);background:var(--field);border:1px solid var(--field-border,color-mix(in oklch,var(--ink) 22%,transparent));border-radius:var(--field-radius,var(--radius,12px));outline:none;transition:border-color .16s ease,box-shadow .16s ease}
.cf-choose-your-gift .cyg-input::placeholder{color:color-mix(in oklch,var(--field-ink) 65%,var(--field));opacity:1}
.cf-choose-your-gift .cyg-input:focus{border-color:var(--field-focus,var(--accent));box-shadow:0 0 0 3px oklch(from var(--field-focus,var(--accent)) l c h / 0.35)}
.cf-choose-your-gift .cyg-input.is-bad{border-color:var(--danger)}
.cf-choose-your-gift .cyg-input.is-bad:focus{box-shadow:0 0 0 3px oklch(from var(--danger) l c h / 0.3)}
.cf-choose-your-gift .cyg-input:disabled{cursor:not-allowed;background:color-mix(in oklch,var(--ink) 5%,var(--field));opacity:0.7}
.cf-choose-your-gift .cyg-err{margin:0;font-size:0.9375rem;line-height:1.4;font-weight:600;color:var(--danger);text-wrap:pretty}
.cf-choose-your-gift .cyg-ic{display:inline-block;vertical-align:-0.15em;margin-inline-end:0.4em}
.cf-choose-your-gift .cyg-btn{--cyg-bg:var(--button-bg,var(--cta));--cyg-bg2:var(--button-bg-2,var(--cta-2));display:inline-flex;align-items:center;justify-content:center;gap:10px;width:100%;min-height:56px;padding:12px 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(oklch(from var(--cyg-bg) calc(l + 0.04) c h),oklch(from var(--cyg-bg2) calc(l - 0.02) c h));color:var(--button-ink,var(--cta-ink));text-shadow:var(--button-text-shadow,none);font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:clamp(1.125rem,1.55vw,1.375rem);line-height:1.15;text-align:center;text-wrap:balance;cursor:pointer;box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--cyg-bg) calc(l + 0.14) c h / 0.7),inset 0 -3px 0 oklch(from var(--cyg-bg) calc(l - 0.16) c h),0 1px 2px oklch(from var(--cyg-shade) l c h / 0.3),0 8px 16px -6px oklch(from var(--cyg-shade) l c h / 0.45));transition:background .16s ease,box-shadow .16s ease,transform .16s ease}
.cf-choose-your-gift .cyg-btn:hover:not(:disabled){background:linear-gradient(oklch(from var(--cyg-bg) calc(l - 0.01) c h),oklch(from var(--cyg-bg2) calc(l - 0.07) c h));box-shadow:inset 0 1px 0 oklch(from var(--cyg-bg) calc(l + 0.1) c h / 0.7),inset 0 -3px 0 oklch(from var(--cyg-bg) calc(l - 0.2) c h),0 1px 2px oklch(from var(--cyg-shade) l c h / 0.32),0 10px 18px -6px oklch(from var(--cyg-shade) l c h / 0.55)}
.cf-choose-your-gift .cyg-btn:active:not(:disabled){transform:translateY(1px);box-shadow:inset 0 2px 4px oklch(from var(--cyg-bg) calc(l - 0.2) c h / 0.5),inset 0 -2px 0 oklch(from var(--cyg-bg) calc(l - 0.16) c h),0 1px 2px oklch(from var(--cyg-shade) l c h / 0.3)}
.cf-choose-your-gift .cyg-btn:focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:3px}
.cf-choose-your-gift .cyg-btn:disabled{cursor:not-allowed;opacity:0.55;box-shadow:0 1px 2px oklch(from var(--cyg-shade) l c h / 0.25)}
.cf-choose-your-gift .cyg-btn[aria-busy=true]{opacity:0.85;cursor:progress}
.cf-choose-your-gift .cyg-spin{flex:none;animation:cyg-spin .8s linear infinite}
.cf-choose-your-gift .cyg-privacy{margin:0;text-align:center;font-size:0.9375rem;line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
.cf-choose-your-gift .cyg-edge{position:absolute;z-index:0;left:0;right:0;bottom:0;height:56px;pointer-events:none}
@keyframes cyg-in{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes cyg-pop{from{transform:scale(.9)}to{transform:scale(1)}}
@keyframes cyg-spin{to{transform:rotate(360deg)}}
@media (max-width:960px){
.cf-choose-your-gift .cyg-bento{grid-template-columns:minmax(0,1fr)}
.cf-choose-your-gift .cyg-card{position:relative;top:auto;width:100%;max-width:46rem;margin-inline:auto}
}
@media (max-width:640px){
.cf-choose-your-gift .cyg-gifts{grid-template-columns:minmax(0,1fr);gap:12px}
.cf-choose-your-gift .cyg-tile,.cf-choose-your-gift .cyg-tile.is-wide{grid-column:auto;display:grid;grid-template-columns:112px minmax(0,1fr);gap:16px;align-items:start;padding:16px}
.cf-choose-your-gift .cyg-stage,.cf-choose-your-gift .cyg-tile.is-wide .cyg-stage{height:120px;margin:0}
.cf-choose-your-gift .cyg-stage img{max-width:100%}
.cf-choose-your-gift .cyg-tile.is-wide .cyg-copy{padding-block:0}
.cf-choose-your-gift .cyg-pick{padding-top:12px}
}
@media (prefers-reduced-motion:reduce){
.cf-choose-your-gift :is(.cyg-tile,.cyg-stage img,.cyg-floor,.cyg-btn,.cyg-change,.cyg-input){transition:none}
.cf-choose-your-gift :is(.cyg-prompt,.cyg-form,.cyg-spin){animation:none}
.cf-choose-your-gift .cyg-tile.is-on .cyg-dot{animation:none}
.cf-choose-your-gift .cyg-gifts:not(:disabled) .cyg-tile:hover,.cf-choose-your-gift .cyg-tile.is-hover,.cf-choose-your-gift .cyg-gifts:not(:disabled) .cyg-tile:hover .cyg-stage img,.cf-choose-your-gift .cyg-tile.is-hover .cyg-stage img,.cf-choose-your-gift .cyg-tile.is-on .cyg-stage img,.cf-choose-your-gift .cyg-btn:active:not(:disabled),.cf-choose-your-gift .cyg-change:active:not(:disabled){transform:none}
}
`
pieces/forms/choose-your-gift/specimen.tsx 53 lines
import __studioImage91afcf00 from "../assets/64efcd012ac685f0.webp";
import __studioImage2187a417 from "../assets/92a0431f85ce0a84.webp";
import __studioImage9c50af76 from "../assets/5f3f0216d819c011.webp";
import * as React from 'react'
import { ChooseYourGift, type ChooseYourGiftState } from '../choose-your-gift'
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
const COVERS = [
__studioImage2187a417,
__studioImage91afcf00,
__studioImage9c50af76,
]
const IDS = ['guide', 'workbook', 'checklist']
export const states = ['default', 'hover', 'active', 'error', 'disabled']
export default function ChooseYourGiftDemo({ state = 'default' }: { state?: ChooseYourGiftState }) {
const sample = defaults.sample
const gifts = sample.items.map((item, i) => ({
id: IDS[i] ?? `gift-${i + 1}`,
name: item.name,
detail: item.detail,
image: slot(`item-${i + 1}`, COVERS[i] ?? COVERS[0]),
}))
const fields = sample.fields.map((f) => ({
...f,
placeholder: f.name === 'email' ? 'you@example.com' : 'Jane Smith',
}))
return (
<ChooseYourGift
state={state}
headingLevel={1}
headline='Which free funnel tool do you want first?'
highlight='free funnel tool'
lead={[
{ lead: 'Pick one.', text: `Each tool comes straight out of ${sample.name}, ready to use tonight.` },
{ lead: 'It’s free.', text: 'Tell us where to send it and it’s yours.' },
]}
gifts={gifts}
legend='Choose your free funnel tool'
chooseLabel='Choose this tool'
promptTitle='Your free tool is waiting'
promptText='Choose one of the {count} tools to claim it.'
fields={fields}
buttonLabel='Send My Free Tool'
privacy={sample.registration.privacy}
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalChooseYourGift |
string |
|
highlight OptionalChooseYourGift |
string |
|
headingLevel OptionalChooseYourGift |
1 | 2 |
|
lead OptionalChooseYourGift |
ChooseYourGiftLead[] |
|
gifts OptionalChooseYourGift |
ChooseYourGiftItem[] |
|
legend OptionalChooseYourGift |
string |
|
chooseLabel OptionalChooseYourGift |
string |
|
selectedLabel OptionalChooseYourGift |
string |
|
promptTitle OptionalChooseYourGift |
string |
|
promptText OptionalChooseYourGift |
string |
|
facts OptionalChooseYourGift |
string[] |
|
chosenLabel OptionalChooseYourGift |
string |
|
changeLabel OptionalChooseYourGift |
string |
|
stepTitle OptionalChooseYourGift |
string |
|
announce OptionalChooseYourGift |
string |
|
fields OptionalChooseYourGift |
ChooseYourGiftField[] |
|
buttonLabel OptionalChooseYourGift |
string |
|
busyLabel OptionalChooseYourGift |
string |
|
privacy OptionalChooseYourGift |
string |
|
requiredError OptionalChooseYourGift |
string |
|
emailError OptionalChooseYourGift |
string |
|
defaultSelected OptionalChooseYourGift |
string |
|
disabled OptionalChooseYourGift |
boolean |
|
busy OptionalChooseYourGift |
boolean |
|
onSelect OptionalChooseYourGift |
(id: string) => void |
|
onSubmit OptionalChooseYourGift |
(data: { gift: string; giftName: string; values: Record<string, string> }) => void |
|
state OptionalChooseYourGift |
ChooseYourGiftState |
|
className OptionalChooseYourGift |
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-border--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.
item-*- One image per offer item (item-1, item-2…), shown in stacks and lists.
-
5f3f0216d819c011.webp
image/webp · 103 KB
-
63571cb07acc4626.webp
image/webp · 17.3 KB
-
64efcd012ac685f0.webp
image/webp · 64.4 KB
-
92a0431f85ce0a84.webp
image/webp · 66.1 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
bc3d360c88eeac0e.webp
image/webp · 23.9 KB
-
d0943b629c0b1324.webp
image/webp · 8.87 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
d7814fce240ddf0e.webp
image/webp · 17.6 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB