Two Choices Close 5
Closes a giving page with two honest choices, then a monthly gift card whose impact line follows the amount the reader picks.
Use it in a prompt
Use content/two-choices-close-5 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/content/two-choices-close-5.tsx. - Import it and pass your copy and images (Props tab):
import { TwoChoicesClose5 } from "@/components/funneldna/content/two-choices-close-5"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/content/two-choices-close-5/component.tsx 616 lines
// layout: diagonal-split
// Closes a giving page with two honest choices, then a monthly gift card whose impact line follows the amount the reader picks.
'use client'
import * as React from 'react'
import { AnimatePresence, motion, useReducedMotion } from 'motion/react'
import { AlertCircle, Check, HeartHandshake, Loader2, Lock } from 'lucide-react'
export type GiftAmount = {
/** Monthly amount in whole currency units, e.g. 25. */
value: number
/** What this amount does, from the organisation's own amount-to-impact map. Empty shows no impact line. */
impact?: React.ReactNode
/** Supplied per-day figure (e.g. '82¢'); computed from the value when omitted. */
perDay?: string
}
export type LetterParagraph = {
/** Bold lead-in phrase that opens the paragraph. */
lead: string
body?: React.ReactNode
}
export type GiftSubmission = { amount: number; custom: boolean; committed: boolean }
export type TwoChoicesClose5State = 'default' | 'hover' | 'active' | 'disabled' | 'error'
export type TwoChoicesClose5Props = {
headline?: string
/** Letter paragraphs before the turn: choice one, closing the page. */
before?: LetterParagraph[]
/** The turn line between the two choices. */
turn?: string
/** Letter paragraphs after the turn: choice two, becoming a monthly giver. */
after?: LetterParagraph[]
signoff?: string
signerName?: string
signerRole?: string
/** Full-bleed scene photo (slot: scene). */
sceneImage?: string
sceneImageAlt?: string
/** object-position of the scene photo: the focal point. */
scenePosition?: string
cardTitle?: string
cardLead?: string
legend?: string
amounts?: GiftAmount[]
/** Preselected amount value. */
defaultAmount?: number
currency?: string
periodShort?: string
periodLong?: string
/** Template: {perDay}. */
perDayTemplate?: string
customLabel?: string
customPlaceholder?: string
minAmount?: number
/** Template: {min}. */
minError?: string
invalidError?: string
/** Impact line for a custom amount. Template: {amount}. Empty shows none. */
customImpact?: string
/** Commit checkbox line above the button; empty hides it. */
commitLabel?: string
commitDefault?: boolean
commitError?: string
/** Template: {amount}. */
ctaLabel?: string
/** Button label while no valid amount is chosen. */
ctaFallback?: string
loadingLabel?: string
reassurance?: string
/** Matching-gift note: only when a real match exists. */
matchNote?: React.ReactNode
taxNote?: React.ReactNode
errorMessage?: string
state?: TwoChoicesClose5State
disabled?: boolean
/** Checkout destination; the validated amount is sent as ?amount= when no onSubmit is given. */
href?: string
/** Validated gift. A returned promise shows the loading label; false or a rejection shows errorMessage. */
onSubmit?: (gift: GiftSubmission) => void | boolean | Promise<void | boolean>
id?: string
className?: string
}
export function TwoChoicesClose5({
headline = 'You can close this page, and that’s okay.',
before = DEFAULT_BEFORE,
turn = 'Or you can…',
after = DEFAULT_AFTER,
signoff = '',
signerName = '',
signerRole = '',
sceneImage,
sceneImageAlt = '',
scenePosition = '72% 40%',
cardTitle = 'Become a monthly giver',
cardLead = 'Pick the amount that fits your month.',
legend = 'Choose your monthly gift',
amounts = DEFAULT_AMOUNTS,
defaultAmount = 25,
currency = '$',
periodShort = '/mo',
periodLong = 'a month',
perDayTemplate = 'about {perDay} a day',
customLabel = 'Or enter your own monthly amount',
customPlaceholder = '40',
minAmount = 5,
minError = 'Enter at least {min} a month.',
invalidError = 'Enter an amount in numbers, like 40.',
customImpact = '',
commitLabel = 'I understand this is a monthly gift.',
commitDefault = true,
commitError = 'Tick the box to confirm your monthly gift.',
ctaLabel = 'Give {amount} a month',
ctaFallback = 'Start my monthly gift',
loadingLabel = 'Opening secure checkout…',
reassurance = '',
matchNote,
taxNote,
errorMessage = 'We couldn’t start your gift. Please try again.',
state = 'default',
disabled = false,
href,
onSubmit,
id,
className = '',
}: TwoChoicesClose5Props) {
const reduce = useReducedMotion()
const uid = React.useId().replace(/:/g, '')
const headId = 'tcf-h-' + uid
const cardHeadId = 'tcf-ch-' + uid
const fieldId = 'tcf-f-' + uid
const fieldErrId = 'tcf-fe-' + uid
const commitErrId = 'tcf-ce-' + uid
const noteId = 'tcf-n-' + uid
const startPreset = amounts.some((a) => a.value === defaultAmount) ? defaultAmount : amounts[0]?.value
const [preset, setPreset] = React.useState<number | undefined>(startPreset)
const [custom, setCustom] = React.useState('')
const [useCustom, setUseCustom] = React.useState(false)
const [touched, setTouched] = React.useState(false)
const [committed, setCommitted] = React.useState(commitDefault)
const [commitTried, setCommitTried] = React.useState(false)
const [phase, setPhase] = React.useState<'idle' | 'loading' | 'error'>('idle')
const fieldRef = React.useRef<HTMLInputElement>(null)
const commitRef = React.useRef<HTMLInputElement>(null)
const alive = React.useRef(true)
React.useEffect(() => {
alive.current = true
return () => {
alive.current = false
}
}, [])
React.useEffect(() => {
if (state === 'error') {
setCustom(String(Math.max(0, Math.floor(minAmount) - 1)))
setUseCustom(true)
setTouched(true)
}
}, [state, minAmount])
const isDisabled = disabled || state === 'disabled'
const loading = phase === 'loading'
const money = (n: number) => currency + (Number.isInteger(n) ? n.toLocaleString('en-US') : n.toFixed(2))
const parsed = parseAmount(custom)
const customError = !useCustom
? ''
: !isFinite(parsed) || parsed <= 0
? invalidError
: parsed < minAmount
? fill(minError, { min: money(minAmount) })
: ''
const showFieldError = touched && customError !== ''
const amount = useCustom ? (isFinite(parsed) && parsed > 0 ? parsed : undefined) : preset
const ready = amount !== undefined && customError === ''
const current = useCustom ? undefined : amounts.find((a) => a.value === preset)
const impact: React.ReactNode = current
? current.impact
: useCustom && amount !== undefined && customImpact
? fill(customImpact, { amount: money(amount) })
: null
const perDay = amount !== undefined ? fill(perDayTemplate, { perDay: current?.perDay ?? dayRate(amount, currency) }) : ''
const label = ready && amount !== undefined ? fill(ctaLabel, { amount: money(amount) }) : ctaFallback
const swapKey = useCustom ? 'custom' : 'p' + String(preset)
const forced = state === 'hover' ? ' is-hover' : state === 'active' ? ' is-active' : ''
const commitBad = !!commitLabel && commitTried && !committed
function pick(value: number) {
setPreset(value)
setUseCustom(false)
setCustom('')
setTouched(false)
if (phase === 'error') setPhase('idle')
}
function typeCustom(raw: string) {
const v = raw.replace(/[^0-9.,]/g, '')
setCustom(v)
setUseCustom(v.trim() !== '')
if (v.trim() === '') setTouched(false)
if (phase === 'error') setPhase('idle')
}
async function submit(e: React.FormEvent<HTMLFormElement>) {
if (isDisabled || loading) {
e.preventDefault()
return
}
let ok = true
if (customError) {
setTouched(true)
fieldRef.current?.focus()
ok = false
}
if (commitLabel && !committed) {
setCommitTried(true)
if (ok) commitRef.current?.focus()
ok = false
}
if (!ok || amount === undefined) {
e.preventDefault()
return
}
if (!onSubmit) {
if (!href) e.preventDefault()
return
}
e.preventDefault()
try {
const result = onSubmit({ amount, custom: useCustom, committed })
if (result === false) {
setPhase('error')
return
}
if (!result || result === true) {
setPhase('idle')
return
}
setPhase('loading')
const value = await result
if (alive.current) setPhase(value === false ? 'error' : 'idle')
} catch {
if (alive.current) setPhase('error')
}
}
const ease: [number, number, number, number] = [0.2, 0.7, 0.2, 1]
const rise = (i: number) =>
reduce
? {}
: {
initial: { opacity: 0.82, y: 8 },
whileInView: { opacity: 1, y: 0 },
viewport: { once: true, amount: 0.2 },
transition: { duration: 0.45, delay: Math.min(i * 0.07, 0.28), ease },
}
const rootClass = 'cf-two-choices-close-5 tcf' + (sceneImage ? '' : ' tcf-noimg') + (className ? ' ' + className : '')
return (
<section id={id} className={rootClass} aria-labelledby={headId} style={{ '--tcf-pos': scenePosition } as React.CSSProperties}>
<style>{CSS}</style>
{sceneImage ? (
<div className='tcf-media'>
<img src={sceneImage} alt={sceneImageAlt} width={1536} height={1024} loading='lazy' decoding='async' />
</div>
) : null}
<div className='tcf-edge' aria-hidden='true' />
<div className='tcf-field' aria-hidden='true' />
<div className='tcf-wrap'>
<div className='tcf-letter'>
<motion.h2 id={headId} className='tcf-h' {...rise(0)}>
{headline}
</motion.h2>
{before.map((p, i) => (
<motion.p key={'b' + i} className='tcf-p' {...rise(i + 1)}>
<strong>{p.lead}</strong>
{p.body ? <>{' '}{p.body}</> : null}
</motion.p>
))}
{turn ? (
<motion.p className='tcf-turn' {...rise(before.length + 1)}>
{turn}
</motion.p>
) : null}
{after.map((p, i) => (
<motion.p key={'a' + i} className='tcf-p' {...rise(before.length + 2 + i)}>
<strong>{p.lead}</strong>
{p.body ? <>{' '}{p.body}</> : null}
</motion.p>
))}
{signerName ? (
<motion.p className='tcf-sign' {...rise(before.length + after.length + 2)}>
{signoff ? <span className='tcf-sign-off'>{signoff}</span> : null}
<b>{signerName}</b>
{signerRole ? <span>{signerRole}</span> : null}
</motion.p>
) : null}
</div>
<motion.form
className='tcf-card'
action={href}
method={href ? 'get' : undefined}
noValidate
onSubmit={submit}
aria-labelledby={cardHeadId}
{...rise(1)}
>
<h3 id={cardHeadId} className='tcf-card-h'>
{cardTitle}
</h3>
{cardLead ? <p className='tcf-card-lead'>{cardLead}</p> : null}
<fieldset className='tcf-fs' disabled={isDisabled}>
{amounts.length > 0 ? (
<fieldset className='tcf-amounts'>
<legend className='tcf-legend'>{legend}</legend>
<div className='tcf-chips'>
{amounts.map((a) => (
<label key={a.value} className='tcf-chip'>
<input
type='radio'
name={'tcf-amount-' + uid}
value={a.value}
checked={!useCustom && preset === a.value}
onChange={() => pick(a.value)}
/>
<span className='tcf-face'>
<span className='tcf-amt'>{money(a.value)}</span>
<span className='tcf-per'>{periodShort}</span>
</span>
<span className='tcf-tick' aria-hidden='true'>
<Check size={12} strokeWidth={3} />
</span>
</label>
))}
</div>
</fieldset>
) : null}
<div className='tcf-custom'>
<label className='tcf-label' htmlFor={fieldId}>
{customLabel}
</label>
<div className='tcf-box'>
<span className='tcf-cur' aria-hidden='true'>
{currency}
</span>
<input
ref={fieldRef}
id={fieldId}
className={'tcf-input' + (useCustom && !customError ? ' is-on' : '')}
type='text'
inputMode='decimal'
autoComplete='off'
placeholder={customPlaceholder}
value={custom}
onChange={(e) => typeCustom(e.target.value)}
onBlur={() => {
if (useCustom) setTouched(true)
}}
aria-invalid={showFieldError || undefined}
aria-describedby={showFieldError ? fieldErrId : undefined}
/>
</div>
{showFieldError ? (
<p id={fieldErrId} className='tcf-err' role='alert'>
<AlertCircle size={16} strokeWidth={2.5} aria-hidden='true' />
{customError}
</p>
) : null}
</div>
{amount !== undefined ? (
<div className='tcf-well'>
<div className='tcf-sum'>
<motion.span
key={useCustom ? 'c' : swapKey}
className='tcf-big'
initial={reduce ? false : { opacity: 0.4, y: 4 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.22, ease }}
>
{money(amount)}
</motion.span>
<span className='tcf-sum-t'>
<b>{periodLong}</b>
{perDay ? <span>{perDay}</span> : null}
</span>
</div>
<div className='tcf-impact-box' aria-live='polite' aria-atomic='true'>
<AnimatePresence mode='wait' initial={false}>
{impact ? (
<motion.p
key={swapKey}
className='tcf-impact'
initial={reduce ? false : { opacity: 0, y: 6 }}
animate={{ opacity: 1, y: 0 }}
exit={reduce ? undefined : { opacity: 0, y: -4 }}
transition={{ duration: 0.22, ease }}
>
<HeartHandshake size={18} strokeWidth={2.5} aria-hidden='true' />
{impact}
</motion.p>
) : null}
</AnimatePresence>
</div>
</div>
) : null}
{commitLabel ? (
<>
<label className={'tcf-commit' + (commitBad ? ' is-bad' : '')}>
<input
ref={commitRef}
type='checkbox'
checked={committed}
onChange={(e) => setCommitted(e.target.checked)}
aria-invalid={commitBad || undefined}
aria-describedby={commitBad ? commitErrId : undefined}
/>
<span className='tcf-cbox' aria-hidden='true'>
<Check size={16} strokeWidth={3} />
</span>
<span className='tcf-commit-t'>{commitLabel}</span>
</label>
{commitBad ? (
<p id={commitErrId} className='tcf-err' role='alert'>
<AlertCircle size={16} strokeWidth={2.5} aria-hidden='true' />
{commitError}
</p>
) : null}
</>
) : null}
{href && amount !== undefined ? <input type='hidden' name='amount' value={String(amount)} /> : null}
<button
type='submit'
className={'tcf-btn' + forced}
aria-busy={loading || undefined}
aria-describedby={reassurance ? noteId : undefined}
>
{loading ? (
<>
<Loader2 className='tcf-spin' size={20} strokeWidth={2.5} aria-hidden='true' />
<span>{loadingLabel}</span>
</>
) : (
<span>{label}</span>
)}
</button>
{phase === 'error' ? (
<p className='tcf-alert' role='alert'>
<AlertCircle size={16} strokeWidth={2.5} aria-hidden='true' />
{errorMessage}
</p>
) : null}
{reassurance ? (
<p id={noteId} className='tcf-note'>
<Lock size={16} strokeWidth={2.5} aria-hidden='true' />
{reassurance}
</p>
) : null}
{matchNote ? <p className='tcf-fine'>{matchNote}</p> : null}
{taxNote ? <p className='tcf-fine'>{taxNote}</p> : null}
</fieldset>
</motion.form>
</div>
</section>
)
}
export default TwoChoicesClose5
const DEFAULT_BEFORE: LetterParagraph[] = [
{ lead: 'You already did something.', body: 'You read this far. This cause crossed your mind today, and that counts.' },
]
const DEFAULT_AFTER: LetterParagraph[] = [
{ lead: 'Become someone who shows up every month.', body: 'A monthly gift turns that thought into steady help, without you having to remember.' },
{ lead: 'Pick what feels right.', body: 'Choose the amount that fits your month.' },
]
const DEFAULT_AMOUNTS: GiftAmount[] = [{ value: 15 }, { value: 25 }, { value: 50 }, { value: 100 }]
function fill(template: string, vars: Record<string, string>) {
return template.replace(/[{]([a-zA-Z]+)[}]/g, (m: string, k: string) => (k in vars ? vars[k] : m))
}
function parseAmount(raw: string) {
const clean = raw.replace(/,/g, '').trim()
if (clean === '' || clean === '.' || !/^[0-9]*[.]?[0-9]{0,2}$/.test(clean)) return NaN
return Number(clean)
}
function dayRate(monthly: number, currency: string) {
const d = (monthly * 12) / 365
if (currency === '$' && d < 1) return Math.max(1, Math.round(d * 100)) + '¢'
return currency + d.toFixed(2)
}
const R = '.cf-two-choices-close-5'
const HOVER = `background:linear-gradient(oklch(from var(--tcf-bg) calc(l - 0.01) c h),oklch(from var(--tcf-bg2) calc(l - 0.07) c h));box-shadow:inset 0 1px 0 oklch(from var(--tcf-bg) calc(l + 0.1) c h / 0.6),inset 0 -3px 0 oklch(from var(--tcf-bg) calc(l - 0.2) c h),0 1px 2px oklch(from var(--tcf-sh) l c h / 0.32),0 12px 20px -8px oklch(from var(--tcf-sh) l c h / 0.5);transform:translateY(-1px)`
const CSS = `
${R}{--tcf-band:var(--band,#1b2a4a);--tcf-on:var(--band-ink,#ffffff);--tcf-soft:color-mix(in oklab,var(--band-ink,#ffffff) 84%,var(--band,#1b2a4a));--tcf-ink:var(--ink,#101828);--tcf-muted:var(--muted,#475467);--tcf-card:var(--card,#ffffff);--tcf-accent:var(--accent,#2563eb);--tcf-sh:var(--shadow,oklch(0.22 0.03 260));--tcf-bg:var(--button-bg,var(--cta,#d92d20));--tcf-bg2:var(--button-bg-2,var(--cta-2,#b42318));position:relative;isolation:isolate;overflow:hidden;background:var(--tcf-band);color:var(--tcf-on);font-family:var(--font-body,system-ui,sans-serif)}
${R} *,${R} *::before,${R} *::after{box-sizing:border-box}
${R} :where(h2,h3,p,fieldset,legend){margin:0;padding:0}
${R} :where(fieldset){border:0;min-width:0}
${R} .tcf-media{position:relative;height:clamp(220px,48vw,420px);overflow:hidden;background:oklch(from var(--tcf-band) calc(l - 0.04) c h)}
${R} .tcf-media img{display:block;width:100%;height:100%;object-fit:cover;object-position:var(--tcf-pos,72% 40%)}
${R} .tcf-media::after{content:'';position:absolute;left:0;right:0;bottom:-1px;height:clamp(32px,8vw,64px);background:var(--tcf-band);clip-path:polygon(0 100%,100% 0,100% 100%)}
${R} .tcf-field,${R} .tcf-edge{display:none}
${R} .tcf-wrap{position:relative;display:grid;gap:clamp(32px,5vw,48px);width:100%;max-width:736px;margin:0 auto;padding:clamp(24px,4vw,40px) clamp(16px,5vw,48px) clamp(64px,8.5vw,120px)}
${R}.tcf-noimg .tcf-wrap{padding-top:clamp(56px,8vw,112px)}
${R} .tcf-letter{min-width:0}
${R} .tcf-h{font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);letter-spacing:var(--display-tracking,-0.025em);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;color:var(--tcf-on);text-wrap:balance}
${R} .tcf-p{margin-top:16px;max-width:64ch;font-size:clamp(1.0625rem,1.3vw,1.1875rem);line-height:1.6;color:var(--tcf-soft);text-wrap:pretty}
${R} .tcf-p strong{color:var(--tcf-on);font-weight:800}
${R} .tcf-turn{margin-top:clamp(24px,3vw,32px);font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);letter-spacing:var(--display-tracking,-0.025em);font-size:clamp(1.625rem,2.6vw,2.25rem);line-height:1.1;color:var(--tcf-on);text-wrap:balance}
${R} .tcf-turn + .tcf-p{margin-top:12px}
${R} .tcf-sign{margin-top:clamp(24px,3vw,32px);font-size:1.0625rem;line-height:1.45;color:var(--tcf-soft)}
${R} .tcf-sign-off{display:block}
${R} .tcf-sign b{display:block;margin-top:8px;color:var(--tcf-on);font-weight:800}
${R} .tcf-sign span:not(.tcf-sign-off){display:block;font-size:0.9375rem}
${R} .tcf-card{position:relative;min-width:0;background:var(--tcf-card);color:var(--tcf-ink);border:1px solid var(--card-border,oklch(from var(--ink,#101828) l c h / 0.12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(0.22 0.03 260 / 0.22),0 12px 24px -8px oklch(0.22 0.03 260 / 0.32)));padding:clamp(20px,3vw,32px)}
${R} .tcf-card-h{font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-0.01em;color:var(--tcf-ink);text-wrap:balance}
${R} .tcf-card-lead{margin-top:8px;font-size:1rem;line-height:1.45;font-weight:500;color:var(--tcf-muted);text-wrap:pretty}
${R} .tcf-amounts{margin-top:clamp(20px,2.4vw,24px)}
${R} .tcf-legend{float:left;width:100%;margin-bottom:12px;font-size:1rem;font-weight:700;line-height:1.3;color:var(--label-ink,var(--tcf-ink))}
${R} .tcf-chips{clear:both;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
${R} .tcf-chip{position:relative;display:block;cursor:pointer;-webkit-tap-highlight-color:transparent}
${R} .tcf-chip input{position:absolute;inset:0;z-index:1;width:100%;height:100%;margin:0;opacity:0;cursor:inherit}
${R} .tcf-face{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-height:64px;padding:8px 12px;border-radius:var(--radius,12px);background:color-mix(in oklch,var(--ink,#101828) 4%,var(--card,#ffffff));border:1px solid oklch(from var(--ink,#101828) l c h / 0.14);color:var(--tcf-ink);transition:transform .16s ease,background .16s ease,border-color .16s ease,box-shadow .16s ease}
${R} .tcf-amt{font-family:var(--font-display,inherit);font-weight:800;font-size:1.375rem;line-height:1;letter-spacing:-0.02em;font-variant-numeric:tabular-nums;white-space:nowrap}
${R} .tcf-per{font-size:0.875rem;font-weight:700;line-height:1.2;color:var(--tcf-muted)}
${R} .tcf-chip:hover input:not(:disabled):not(:checked) + .tcf-face{background:color-mix(in oklch,var(--ink,#101828) 7%,var(--card,#ffffff));border-color:oklch(from var(--ink,#101828) l c h / 0.3);transform:translateY(-1px)}
${R} .tcf-chip input:checked + .tcf-face{background:color-mix(in oklch,var(--accent,#2563eb) 10%,var(--card,#ffffff));border-color:var(--tcf-accent);box-shadow:inset 0 0 0 1px var(--tcf-accent),var(--shadow-sm,0 1px 2px oklch(0.22 0.03 260 / 0.2))}
${R} .tcf-chip input:focus-visible + .tcf-face{outline:3px solid oklch(from var(--field-focus,var(--accent,#2563eb)) l c h / 0.55);outline-offset:2px}
${R} .tcf-chip input:disabled{cursor:not-allowed}
${R} .tcf-chip input:disabled + .tcf-face{opacity:0.55}
${R} .tcf-tick{position:absolute;top:-8px;right:-8px;z-index:2;display:grid;place-items:center;width:22px;height:22px;border-radius:999px;background:var(--accent-fill,var(--accent,#2563eb));color:var(--accent-fill-ink,var(--card,#ffffff));border:2px solid var(--tcf-card);opacity:0;transform:scale(.9);pointer-events:none;transition:opacity .2s ease,transform .3s ease}
${R} .tcf-chip input:checked ~ .tcf-tick{opacity:1;transform:scale(1)}
${R} .tcf-custom{margin-top:16px}
${R} .tcf-label{display:block;margin-bottom:8px;font-size:1rem;font-weight:700;line-height:1.3;color:var(--label-ink,var(--tcf-ink))}
${R} .tcf-box{position:relative}
${R} .tcf-cur{position:absolute;left:16px;top:50%;transform:translateY(-50%);font-size:1.0625rem;font-weight:700;color:var(--field-ink,#101828);pointer-events:none}
${R} .tcf-input{display:block;width:100%;height:56px;padding:0 16px 0 34px;font:inherit;font-size:1.0625rem;font-weight:600;font-variant-numeric:tabular-nums;color:var(--field-ink,#101828);background:var(--field,#ffffff);border:1px solid var(--field-border,color-mix(in oklch,var(--ink,#101828) 22%,transparent));border-radius:var(--field-radius,var(--radius,12px));transition:border-color .16s ease,box-shadow .16s ease}
${R} .tcf-input::placeholder{color:color-mix(in oklch,var(--field-ink,#101828) 65%,var(--field,#ffffff));opacity:1}
${R} .tcf-input:hover:not(:disabled){border-color:color-mix(in oklch,var(--ink,#101828) 40%,transparent)}
${R} .tcf-input:focus{outline:none;border-color:var(--field-focus,var(--accent,#2563eb));box-shadow:0 0 0 3px oklch(from var(--field-focus,var(--accent,#2563eb)) l c h / 0.35)}
${R} .tcf-input.is-on{border-color:var(--tcf-accent);box-shadow:inset 0 0 0 1px var(--tcf-accent)}
${R} .tcf-input.is-on:focus{box-shadow:inset 0 0 0 1px var(--tcf-accent),0 0 0 3px oklch(from var(--field-focus,var(--accent,#2563eb)) l c h / 0.35)}
${R} .tcf-input[aria-invalid='true']{border-color:var(--danger,#b42318);box-shadow:inset 0 0 0 1px var(--danger,#b42318)}
${R} .tcf-input[aria-invalid='true']:focus{box-shadow:inset 0 0 0 1px var(--danger,#b42318),0 0 0 3px oklch(from var(--danger,#b42318) l c h / 0.3)}
${R} .tcf-input:disabled{opacity:0.6;cursor:not-allowed}
${R} .tcf-err{margin-top:8px;font-size:0.9375rem;font-weight:600;line-height:1.4;color:var(--danger,#b42318);text-wrap:pretty}
${R} .tcf-err svg,${R} .tcf-alert svg,${R} .tcf-note svg{display:inline-block;vertical-align:-0.15em;margin-inline-end:0.4em}
${R} .tcf-well{margin-top:20px;padding:16px 18px;border-radius:10px;background:color-mix(in oklch,var(--ink,#101828) 4%,var(--card,#ffffff))}
${R} .tcf-sum{display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px}
${R} .tcf-big{display:inline-block;font-family:var(--font-display,inherit);font-weight:800;font-size:clamp(2.5rem,3.4vw,3rem);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums;color:var(--tcf-ink)}
${R} .tcf-sum-t{display:flex;flex-direction:column;gap:2px}
${R} .tcf-sum-t b{font-size:1.0625rem;font-weight:800;line-height:1.2;color:var(--tcf-ink)}
${R} .tcf-sum-t span{font-size:0.9375rem;font-weight:600;line-height:1.3;color:var(--tcf-muted)}
${R} .tcf-impact-box{font-size:1.0625rem}
${R} .tcf-impact{margin-top:12px;font-size:1.0625rem;line-height:1.45;font-weight:600;color:var(--tcf-ink);text-wrap:pretty}
${R} .tcf-impact svg{display:inline-block;vertical-align:-0.2em;margin-inline-end:0.4em;color:var(--tcf-accent)}
${R} .tcf-commit{position:relative;display:grid;grid-template-columns:24px minmax(0,1fr);gap:12px;align-items:start;margin-top:20px;cursor:pointer;font-size:1rem;font-weight:600;line-height:1.4;color:var(--tcf-ink)}
${R} .tcf-commit input{position:absolute;left:0;top:0;width:24px;height:24px;margin:0;opacity:0;cursor:pointer}
${R} .tcf-cbox{grid-column:1;grid-row:1;display:grid;place-items:center;width:24px;height:24px;border-radius:6px;border:2px solid oklch(from var(--ink,#101828) l c h / 0.4);background:var(--field,#ffffff);color:transparent;transition:background .16s ease,border-color .16s ease}
${R} .tcf-commit-t{grid-column:2;grid-row:1;text-wrap:pretty}
${R} .tcf-commit input:checked + .tcf-cbox{background:var(--accent-fill,var(--accent,#2563eb));border-color:var(--accent-fill,var(--accent,#2563eb));color:var(--accent-fill-ink,var(--card,#ffffff))}
${R} .tcf-commit input:focus-visible + .tcf-cbox{outline:3px solid oklch(from var(--field-focus,var(--accent,#2563eb)) l c h / 0.55);outline-offset:2px}
${R} .tcf-commit.is-bad .tcf-cbox{border-color:var(--danger,#b42318)}
${R} .tcf-commit input:disabled{cursor:not-allowed}
${R} .tcf-commit input:disabled ~ *{opacity:0.6}
${R} .tcf-btn{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;min-height:64px;margin-top:16px;padding:12px 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));cursor:pointer;font-family:var(--button-font,var(--font-display,inherit));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:clamp(1.125rem,1.55vw,1.375rem);line-height:1.15;text-align:center;text-wrap:balance;color:var(--button-ink,var(--cta-ink,#ffffff));text-shadow:var(--button-text-shadow,none);background:linear-gradient(oklch(from var(--tcf-bg) calc(l + 0.04) c h),oklch(from var(--tcf-bg2) calc(l - 0.02) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--tcf-bg) calc(l + 0.14) c h / 0.7),inset 0 -3px 0 oklch(from var(--tcf-bg) calc(l - 0.16) c h),0 1px 2px oklch(from var(--tcf-sh) l c h / 0.3),0 8px 16px -6px oklch(from var(--tcf-sh) l c h / 0.45));transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
@media (hover:hover){${R} .tcf-btn:hover:not(:disabled){${HOVER}}}
${R} .tcf-btn.is-hover:not(:disabled){${HOVER}}
${R} .tcf-btn:active:not(:disabled),${R} .tcf-btn.is-active:not(:disabled){transform:translateY(1px);background:linear-gradient(oklch(from var(--tcf-bg2) calc(l - 0.02) c h),oklch(from var(--tcf-bg2) calc(l - 0.06) c h));box-shadow:inset 0 2px 4px oklch(from var(--tcf-bg) calc(l - 0.22) c h / 0.55),inset 0 -2px 0 oklch(from var(--tcf-bg) calc(l - 0.16) c h),0 1px 2px oklch(from var(--tcf-sh) l c h / 0.3)}
${R} .tcf-btn:focus-visible{outline:3px solid var(--tcf-accent);outline-offset:3px}
${R} .tcf-btn[aria-busy='true']{cursor:progress}
${R} .tcf-btn:disabled{cursor:not-allowed;transform:none;background:var(--button-2-bg,var(--secondary,#e8ebf0));color:var(--button-2-ink,var(--secondary-ink,#101828));text-shadow:none;box-shadow:var(--button-2-shadow,var(--shadow-sm,0 1px 2px oklch(0.22 0.03 260 / 0.2)))}
${R} .tcf-spin{animation:tcf-spin .8s linear infinite}
@keyframes tcf-spin{to{transform:rotate(360deg)}}
${R} .tcf-alert{margin-top:12px;padding:10px 14px;border-radius:10px;background:var(--danger-soft,color-mix(in oklch,var(--danger,#b42318) 14%,var(--card,#ffffff)));color:var(--danger,#b42318);font-size:0.9375rem;font-weight:600;line-height:1.4;text-wrap:pretty}
${R} .tcf-note{margin-top:12px;text-align:center;font-size:0.9375rem;font-weight:600;line-height:1.4;color:var(--tcf-muted);text-wrap:pretty}
${R} .tcf-fine{margin-top:8px;text-align:center;font-size:0.875rem;line-height:1.45;color:var(--tcf-muted);text-wrap:pretty}
@media (max-width:479px){${R} .tcf-chips{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (min-width:1200px){
${R} .tcf-media{position:absolute;inset:0;z-index:-3;height:auto}
${R} .tcf-media::after{display:none}
${R} .tcf-field,${R} .tcf-edge{display:block;position:absolute;top:0;bottom:0;left:0;pointer-events:none;clip-path:polygon(0 0,100% 0,82% 100%,0 100%)}
${R} .tcf-field{z-index:-1;width:62%;background:oklch(from var(--tcf-band) l c h / 0.96)}
${R} .tcf-edge{z-index:-2;width:66%;background:oklch(from var(--tcf-band) l c h / 0.5)}
${R} .tcf-wrap{max-width:1416px;grid-template-columns:minmax(380px,1fr) 440px minmax(140px,.5fr);gap:48px;align-items:start;padding:clamp(56px,8vw,112px) 48px clamp(64px,8.5vw,120px)}
${R}.tcf-noimg .tcf-wrap{padding-top:clamp(56px,8vw,112px)}
}
@media (prefers-reduced-motion:reduce){
${R} .tcf-face,${R} .tcf-btn,${R} .tcf-tick,${R} .tcf-cbox,${R} .tcf-input{transition:none}
${R} .tcf-spin{animation:none}
${R} .tcf-chip:hover input:not(:disabled):not(:checked) + .tcf-face{transform:none}
${R} .tcf-btn:hover:not(:disabled),${R} .tcf-btn.is-hover:not(:disabled),${R} .tcf-btn:active:not(:disabled),${R} .tcf-btn.is-active:not(:disabled){transform:none}
}
`
pieces/content/two-choices-close-5/specimen.tsx 55 lines
import __studioImagef92c2fe4 from "../assets/508a6c82191461c7.webp";
// Specimen: Open Table Food Bank's monthly-giver drive, closing on two honest choices.
import { TwoChoicesClose5, type TwoChoicesClose5State } from '../two-choices-close-5'
import { slot } from '../../slots'
export const states = ['default', 'hover', 'active', 'disabled', 'error']
export default function TwoChoicesClose5Specimen({ state = 'default' }: { state?: TwoChoicesClose5State }) {
return (
<TwoChoicesClose5
state={state}
sceneImage={slot(
'scene',
__studioImagef92c2fe4
)}
sceneImageAlt='A volunteer hands a full grocery bag across a table to a mother and her child at a food bank'
scenePosition='76% 38%'
headline='You can close this page, and that’s okay.'
before={[
{
lead: 'You already did something.',
body: 'You read this far. A neighbour’s dinner crossed your mind tonight, and that counts for more than you think.',
},
]}
turn='Or you can…'
after={[
{
lead: 'Be the reason the table is set every Saturday.',
body: 'A monthly gift turns that thought into a full grocery bag, week after week, without you having to remember.',
},
{ lead: 'Pick what feels right.', body: 'Every amount on the card shows exactly what it does.' },
]}
signoff='With gratitude,'
signerName='Rosa Delgado'
signerRole='Saturday volunteer lead, Open Table Food Bank'
cardTitle='Keep the table set, every month'
cardLead='Pick an amount. See exactly what it does.'
legend='Choose your monthly gift'
defaultAmount={25}
amounts={[
{ value: 15, impact: 'Your gift puts fresh fruit and vegetables in a family’s bag at one Saturday distribution each month.' },
{ value: 25, impact: 'Your gift fills a family’s grocery bag every Saturday of the month: rice, beans, bread and fresh produce.' },
{ value: 50, impact: 'Your gift keeps the walk-in fridge stocked with milk, eggs and produce for the families who come in that week.' },
{ value: 100, impact: 'Your gift stocks a full shelf at the weekday pantry, open to any neighbour who walks through the door.' },
]}
minAmount={5}
customImpact='Your {amount} each month goes to groceries for neighbours at Open Table.'
commitLabel='I understand this is a monthly gift I can change or cancel anytime.'
ctaLabel='Give {amount} a month'
reassurance='Secure checkout on the next step'
taxNote='Open Table Food Bank is a registered 501(c)(3). Your gift is tax-deductible as allowed by law.'
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalTwoChoicesClose5 |
string |
Default 'You can close this page, and that’s okay.'
|
before OptionalTwoChoicesClose5 |
LetterParagraph[] |
Default DEFAULT_BEFORE
|
turn OptionalTwoChoicesClose5 |
string |
Default 'Or you can…'
|
after OptionalTwoChoicesClose5 |
LetterParagraph[] |
Default DEFAULT_AFTER
|
signoff OptionalTwoChoicesClose5 |
string |
Default ''
|
signerName OptionalTwoChoicesClose5 |
string |
Default ''
|
signerRole OptionalTwoChoicesClose5 |
string |
Default ''
|
sceneImage OptionalTwoChoicesClose5 |
string |
|
sceneImageAlt OptionalTwoChoicesClose5 |
string |
Default ''
|
scenePosition OptionalTwoChoicesClose5 |
string |
Default '72% 40%'
|
cardTitle OptionalTwoChoicesClose5 |
string |
Default 'Become a monthly giver'
|
cardLead OptionalTwoChoicesClose5 |
string |
Default 'Pick the amount that fits your month.'
|
legend OptionalTwoChoicesClose5 |
string |
Default 'Choose your monthly gift'
|
amounts OptionalTwoChoicesClose5 |
GiftAmount[] |
Default DEFAULT_AMOUNTS
|
defaultAmount OptionalTwoChoicesClose5 |
number |
Default 25
|
currency OptionalTwoChoicesClose5 |
string |
Default '$'
|
periodShort OptionalTwoChoicesClose5 |
string |
Default '/mo'
|
periodLong OptionalTwoChoicesClose5 |
string |
Default 'a month'
|
perDayTemplate OptionalTwoChoicesClose5 |
string |
Default 'about {perDay} a day'
|
customLabel OptionalTwoChoicesClose5 |
string |
Default 'Or enter your own monthly amount'
|
customPlaceholder OptionalTwoChoicesClose5 |
string |
Default '40'
|
minAmount OptionalTwoChoicesClose5 |
number |
Default 5
|
minError OptionalTwoChoicesClose5 |
string |
Default 'Enter at least {min} a month.'
|
invalidError OptionalTwoChoicesClose5 |
string |
Default 'Enter an amount in numbers, like 40.'
|
customImpact OptionalTwoChoicesClose5 |
string |
Default ''
|
commitLabel OptionalTwoChoicesClose5 |
string |
Default 'I understand this is a monthly gift.'
|
commitDefault OptionalTwoChoicesClose5 |
boolean |
Default true
|
commitError OptionalTwoChoicesClose5 |
string |
Default 'Tick the box to confirm your monthly gift.'
|
ctaLabel OptionalTwoChoicesClose5 |
string |
Default 'Give {amount} a month'
|
ctaFallback OptionalTwoChoicesClose5 |
string |
Default 'Start my monthly gift'
|
loadingLabel OptionalTwoChoicesClose5 |
string |
Default 'Opening secure checkout…'
|
reassurance OptionalTwoChoicesClose5 |
string |
Default ''
|
matchNote OptionalTwoChoicesClose5 |
React.ReactNode |
|
taxNote OptionalTwoChoicesClose5 |
React.ReactNode |
|
errorMessage OptionalTwoChoicesClose5 |
string |
Default 'We couldn’t start your gift. Please try again.'
|
state OptionalTwoChoicesClose5 |
TwoChoicesClose5State |
Default 'default'
|
disabled OptionalTwoChoicesClose5 |
boolean |
Default false
|
href OptionalTwoChoicesClose5 |
string |
|
onSubmit OptionalTwoChoicesClose5 |
(gift: GiftSubmission) => void | boolean | Promise<void | boolean> |
|
id OptionalTwoChoicesClose5 |
string |
|
className OptionalTwoChoicesClose5 |
string |
Default ''
|
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-bg--button-2-ink--button-2-shadow- Secondary button.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field--field-border--field-focus--field-ink--field-radius- Form inputs: background, ink, border, radius and focus colour.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
scene- A wide atmosphere photo behind or beside the copy.
-
508a6c82191461c7.webp
image/webp · 58.3 KB