Two Choices Close 4
Two itemised receipts close the sale: the reader ticks what staying put has already cost them and that bill adds up live beside the offer, which ends on today's single price and the action.
Use it in a prompt
Use content/two-choices-close-4 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-4.tsx. - Import it and pass your copy and images (Props tab):
import { TwoChoicesClose4 } from "@/components/funneldna/content/two-choices-close-4"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/content/two-choices-close-4/component.tsx 556 lines
// layout: ledger-receipt
// Two itemised receipts close the sale: the reader ticks what staying put has already cost them and that bill adds up live beside the offer, which ends on today's single price and the action.
'use client'
import * as React from 'react'
import { motion, useReducedMotion } from 'motion/react'
import { AlertCircle, Check, Loader2, ShieldCheck, ShoppingCart } from 'lucide-react'
import { Pattern } from '../fx/fx'
export type CostLine = {
label: string
detail?: string
/** What this line costs, e.g. '$389'. */
amount: string
/** Start ticked. */
defaultChecked?: boolean
}
export type ReceiptItem = {
name: string
detail?: string
/** Optional value; without one the line reads includedLabel. */
value?: string
}
export type TwoChoicesClose4State = 'default' | 'hover' | 'active' | 'disabled' | 'error'
export type TwoChoicesClose4Props = {
headline?: string
/** Phrase inside the headline that gets the marker stroke. */
emphasis?: string
lead?: string
/** Used when no cost lines are supplied (single offer receipt). */
singleHeadline?: string
singleEmphasis?: string
singleLead?: string
costTitle?: string
costHint?: string
/** The cost of staying put, line by line; none = the left receipt hides. */
costLines?: CostLine[]
/** Screen-reader prefix read before each cost line's checkbox label. */
checkLabel?: string
possibleLabel?: string
tallyLabel?: string
emptyNote?: string
/** Placeholders: {amount}, {product}. */
differenceTemplate?: string
/** Announced when the tally changes. Placeholder: {amount}. */
announceTemplate?: string
offerTitle?: string
productName?: string
productImage?: string
productImageAlt?: string
items?: ReceiptItem[]
includedLabel?: string
todayLabel?: string
pricePrefix?: string
price?: string
/** Shown small after the price, e.g. 'a year'. */
pricePeriod?: string
/** The value said in words beside the price. */
priceNote?: string
ctaLabel?: string
loadingLabel?: string
reassurance?: string
errorMessage?: string
/** Label on the phone's sticky price bar. */
barLabel?: string
state?: TwoChoicesClose4State
disabled?: boolean
/** Navigation destination; the button renders as a link when set. */
href?: string
/** A returned promise shows the loading label; false or a rejection shows errorMessage. */
onAction?: () => void | boolean | Promise<void | boolean>
id?: string
className?: string
}
export function TwoChoicesClose4({
headline = 'Two receipts. Only one of them is worth paying.',
emphasis = 'Only one of them is worth paying.',
lead = 'Tick every line that’s already happened to you, then compare the total with what it costs to fix it today.',
singleHeadline = 'Everything you get, on one receipt.',
singleEmphasis = 'on one receipt',
singleLead = '',
costTitle = 'What staying put keeps costing you',
costHint = 'Tick every line that’s happened to you.',
costLines = [],
checkLabel = 'This happens to me',
possibleLabel = 'Every line on this receipt',
tallyLabel = 'Costing you',
emptyNote = 'Tick a line above to add it up.',
differenceTemplate = 'That’s {amount} more than {product} costs today.',
announceTemplate = 'Costing you {amount}.',
offerTitle = 'Everything that comes in the kit',
productName = 'The Funnel Starter Kit',
productImage,
productImageAlt = '',
items = [],
includedLabel = 'Included',
todayLabel = 'Today',
pricePrefix = 'Just',
price = '$47',
pricePeriod = '',
priceNote = '',
ctaLabel = 'Add To Cart',
loadingLabel = 'Adding to cart…',
reassurance = '',
errorMessage = 'We couldn’t add it to your cart. Please try again.',
barLabel = 'Your total today',
state = 'default',
disabled = false,
href,
onAction,
id,
className = '',
}: TwoChoicesClose4Props) {
const reduce = useReducedMotion()
const uid = React.useId()
const headId = uid + '-h'
const costId = uid + '-cost'
const hintId = uid + '-hint'
const offerId = uid + '-offer'
const errId = uid + '-err'
const two = costLines.length > 0
const title = two ? headline : singleHeadline
const titleEmph = two ? emphasis : singleEmphasis
const leadText = two ? lead : singleLead
const linesKey = costLines.map((l) => `${l.label}|${l.amount}|${l.defaultChecked ? 1 : 0}`).join('~')
const [ticked, setTicked] = React.useState<boolean[]>(() => costLines.map((l) => !!l.defaultChecked))
const [announce, setAnnounce] = React.useState('')
const changed = React.useRef(false)
React.useEffect(() => {
setTicked(costLines.map((l) => !!l.defaultChecked))
changed.current = false
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [linesKey])
const [phase, setPhase] = React.useState<'idle' | 'loading' | 'error'>(state === 'error' ? 'error' : 'idle')
React.useEffect(() => {
setPhase(state === 'error' ? 'error' : 'idle')
}, [state])
const alive = React.useRef(true)
React.useEffect(() => {
alive.current = true
return () => {
alive.current = false
}
}, [])
const actionRef = React.useRef<HTMLDivElement>(null)
const [actionInView, setActionInView] = React.useState(false)
React.useEffect(() => {
const el = actionRef.current
if (!two || !el || typeof IntersectionObserver === 'undefined') return
const io = new IntersectionObserver(([entry]) => setActionInView(entry.isIntersecting), { threshold: 0.5 })
io.observe(el)
return () => io.disconnect()
}, [two])
const s = sym(costLines[0]?.amount) || sym(price)
const amounts = costLines.map((l) => safe(num(l.amount)))
const possible = amounts.reduce((a, b) => a + b, 0)
const tally = amounts.reduce((a, v, i) => a + (ticked[i] ? v : 0), 0)
const priceN = num(price)
const diff = isFinite(priceN) ? tally - priceN : 0
const diffText = tally <= 0 ? emptyNote : diff > 0 ? fill(differenceTemplate, { amount: money(s, diff), product: productName }) : ''
const toggle = (i: number) => {
changed.current = true
const next = costLines.map((_, j) => (j === i ? !ticked[j] : !!ticked[j]))
const t = amounts.reduce((a, v, j) => a + (next[j] ? v : 0), 0)
setTicked(next)
setAnnounce(fill(announceTemplate, { amount: money(s, t) }))
}
const isDisabled = disabled || state === 'disabled'
const loading = phase === 'loading'
const force = state === 'hover' ? ' is-hover' : state === 'active' ? ' is-active' : ''
async function handle(e: React.MouseEvent<HTMLElement>) {
if (isDisabled || loading) {
e.preventDefault()
return
}
if (!onAction) return
try {
const r: unknown = onAction()
if (r === false) {
e.preventDefault()
setPhase('error')
return
}
if (!isThenable(r)) {
setPhase('idle')
return
}
setPhase('loading')
const v = await r
if (alive.current) setPhase(v === false ? 'error' : 'idle')
} catch {
if (alive.current) setPhase('error')
}
}
const button = (compact: boolean) => {
const cls = `tc4-btn${compact ? ' is-compact' : ''}${force}`
const inner = (
<>
{loading ? (
<Loader2 className='tc4-spin' size={20} strokeWidth={2.5} aria-hidden='true' />
) : (
<ShoppingCart size={20} strokeWidth={2.5} aria-hidden='true' />
)}
<span className='tc4-btn-label'>{loading && !compact ? loadingLabel : ctaLabel}</span>
{!compact && !loading && price ? <span className='tc4-btn-price'>{price}</span> : null}
</>
)
const described = phase === 'error' ? errId : undefined
return href ? (
<a
className={cls}
href={isDisabled ? undefined : href}
aria-disabled={isDisabled || undefined}
aria-busy={loading || undefined}
aria-describedby={described}
onClick={handle}
>
{inner}
</a>
) : (
<button
type='button'
className={cls}
disabled={isDisabled}
aria-busy={loading || undefined}
aria-describedby={described}
onClick={handle}
>
{inner}
</button>
)
}
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: EASE },
}
return (
<section
id={id}
className={`cf-two-choices-close-4 tc4${two ? '' : ' is-single'}${className ? ' ' + className : ''}`}
aria-labelledby={headId}
>
<style>{CSS}</style>
<div className='tc4-fx' aria-hidden='true'>
<Pattern name='grid' fade='edges' />
</div>
<div className='tc4-wrap'>
<header className='tc4-head'>
<h2 id={headId} className='tc4-h'>
<Emph text={title} phrase={titleEmph} />
</h2>
{leadText ? <p className='tc4-lead'>{leadText}</p> : null}
</header>
<div className='tc4-grid'>
{two ? (
<motion.div className='tc4-cell' {...rise(0)}>
<article className='tc4-card tc4-cost' aria-labelledby={costId}>
<div className='tc4-rhead'>
<div>
<h3 id={costId} className='tc4-rh'>{costTitle}</h3>
{costHint ? <p id={hintId} className='tc4-hint'>{costHint}</p> : null}
</div>
</div>
<fieldset aria-labelledby={costId} aria-describedby={costHint ? hintId : undefined}>
<ul className='tc4-rows'>
{costLines.map((line, i) => {
const on = !!ticked[i]
const inputId = `${uid}-c${i}`
return (
<li key={`${line.label}-${i}`}>
<label htmlFor={inputId} className={`tc4-row${on ? ' is-on' : ''}`}>
<input id={inputId} className='tc4-input' type='checkbox' checked={on} onChange={() => toggle(i)} />
<span className='tc4-box' aria-hidden='true'>
<Check size={16} strokeWidth={3} />
</span>
<span className='tc4-text'>
<span className='tc4-line'>
<span className='tc4-name'>
<span className='tc4-sr'>{checkLabel}: </span>
{line.label}
</span>
<span className='tc4-leader' aria-hidden='true' />
<span className='tc4-amt'>{line.amount}</span>
</span>
{line.detail ? <span className='tc4-detail'>{line.detail}</span> : null}
</span>
</label>
</li>
)
})}
</ul>
</fieldset>
{costLines.length > 1 ? (
<p className='tc4-sum'>
<span>{possibleLabel}</span>
<span className='tc4-leader' aria-hidden='true' />
<span className='tc4-sum-amt'>{money(s, possible)}</span>
</p>
) : null}
<div className='tc4-well'>
<p className='tc4-tline'>
<span className='tc4-tlabel'>{tallyLabel}</span>
<span className='tc4-leader' aria-hidden='true' />
<motion.span
key={tally}
className='tc4-num tc4-num-cost'
initial={reduce || !changed.current ? false : { opacity: 0.82, y: -6 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.3, ease: EASE }}
>
{money(s, tally)}
</motion.span>
</p>
{diffText ? <p className='tc4-diff'>{diffText}</p> : null}
</div>
<p className='tc4-sr' aria-live='polite' aria-atomic='true'>{announce}</p>
</article>
</motion.div>
) : null}
<motion.div className='tc4-cell tc4-offer-wrap' {...rise(two ? 1 : 0)}>
<article className='tc4-card tc4-offer' aria-labelledby={offerId}>
<div className='tc4-rhead'>
{productImage ? (
<img className='tc4-prod' src={productImage} alt={productImageAlt} width={96} height={96} loading='lazy' />
) : null}
<div>
<h3 id={offerId} className='tc4-rh'>{offerTitle}</h3>
{productName ? <p className='tc4-hint tc4-pname'>{productName}</p> : null}
</div>
</div>
{items.length > 0 ? (
<ul className='tc4-items'>
{items.map((it, i) => (
<li key={`${it.name}-${i}`} className='tc4-item'>
<span className='tc4-tick' aria-hidden='true'>
<Check size={16} strokeWidth={3} />
</span>
<span className='tc4-text'>
<span className='tc4-line'>
<span className='tc4-name'>{it.name}</span>
<span className='tc4-leader' aria-hidden='true' />
<span className={`tc4-amt${it.value ? '' : ' tc4-inc'}`}>{it.value || includedLabel}</span>
</span>
{it.detail ? <span className='tc4-detail'>{it.detail}</span> : null}
</span>
</li>
))}
</ul>
) : null}
<div ref={actionRef} className='tc4-close'>
<div className='tc4-well'>
<p className='tc4-tline'>
<span className='tc4-tlabel'>{todayLabel}</span>
<span className='tc4-leader' aria-hidden='true' />
<span className='tc4-price'>
{pricePrefix ? <span className='tc4-just'>{pricePrefix}</span> : null}
<span className='tc4-num'>{price}</span>
{pricePeriod ? <span className='tc4-per'>{pricePeriod}</span> : null}
</span>
</p>
{priceNote ? <p className='tc4-pnote'>{priceNote}</p> : null}
</div>
<div className='tc4-cta'>{button(false)}</div>
{phase === 'error' ? (
<p id={errId} className='tc4-error' role='alert'>
<AlertCircle className='tc4-ico' size={16} strokeWidth={2.5} aria-hidden='true' />
{errorMessage}
</p>
) : null}
{reassurance ? (
<p className='tc4-reassure'>
<ShieldCheck className='tc4-ico' size={16} strokeWidth={2.5} aria-hidden='true' />
{reassurance}
</p>
) : null}
</div>
</article>
</motion.div>
</div>
{two ? (
<div className={`tc4-bar${actionInView ? ' is-hidden' : ''}`} aria-hidden={actionInView || undefined}>
<p className='tc4-bar-copy'>
<span className='tc4-bar-label'>{barLabel}</span>
<span className='tc4-bar-price'>{pricePrefix ? pricePrefix + ' ' : ''}{price}</span>
</p>
{button(true)}
</div>
) : null}
</div>
</section>
)
}
export default TwoChoicesClose4
const EASE: [number, number, number, number] = [0.2, 0.7, 0.2, 1]
function Emph({ text, phrase }: { text: string; phrase?: string }) {
const at = phrase ? text.indexOf(phrase) : -1
if (!phrase || at < 0) return <>{text}</>
return (
<>
{text.slice(0, at)}
<span className='tc4-mark'>{phrase}</span>
{text.slice(at + phrase.length)}
</>
)
}
function isThenable(x: unknown): x is PromiseLike<unknown> {
return !!x && typeof (x as { then?: unknown }).then === 'function'
}
function num(v?: string) {
if (!v) return NaN
return parseFloat(v.replace(/[^0-9.]/g, ''))
}
function safe(n: number) {
return isFinite(n) ? n : 0
}
function sym(v?: string) {
return ((v || '').match(/^[^0-9]*/)?.[0] ?? '').trim()
}
function money(s: string, n: number) {
return s + n.toLocaleString('en-US', { minimumFractionDigits: Number.isInteger(n) ? 0 : 2, maximumFractionDigits: 2 })
}
function fill(t: string, map: Record<string, string>) {
return t.replace(/[{]([a-z]+)[}]/g, (m, k: string) => (k in map ? map[k] : m))
}
const CSS = `
.tc4{--tc4-ink:var(--ink,oklch(.21 .034 263));--tc4-muted:var(--muted,oklch(.446 .03 258));--tc4-card:var(--card,oklch(1 0 0));--tc4-sh:var(--shadow,oklch(.22 .03 256));--tc4-b:var(--button-bg,var(--cta,oklch(.576 .209 29.5)));--tc4-b2:var(--button-bg-2,var(--cta-2,oklch(.506 .206 29.5)));--tc4-r:var(--card-radius,var(--radius,14px));--tc4-line:oklch(from var(--tc4-ink) l c h / .12);--tc4-well:color-mix(in oklch,var(--tc4-ink) 4%,var(--tc4-card));--tc4-dot:oklch(from var(--tc4-ink) l c h / .36);--tc4-focus:oklch(from var(--field-focus,var(--accent,oklch(.5 .17 257))) l c h / .55);--tc4-marker:oklch(from var(--marker,#fae37c) l c h / .85);--tc4-glyph:var(--status-glyph,oklch(1 0 0));position:relative;isolation:isolate;overflow-x:clip;background:var(--surface,oklch(1 0 0));color:var(--tc4-ink);font-family:var(--font-body,system-ui,sans-serif);padding:clamp(56px,8vw,112px) clamp(16px,5vw,48px) clamp(64px,8.5vw,120px)}
.tc4 *,.tc4 *::before,.tc4 *::after{box-sizing:border-box}
.tc4 :where(h2,h3,p,ul,li,fieldset){margin:0}
.tc4 :where(ul){padding:0;list-style:none}
.tc4 fieldset{border:0;padding:0;min-width:0}
.tc4-sr{position:absolute;width:1px;height:1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}
.tc4-fx{position:absolute;inset:0;z-index:-1;overflow:hidden;pointer-events:none}
.tc4-wrap{position:relative;max-width:1120px;margin:0 auto}
.tc4-head{max-width:46rem;margin:0 auto;text-align:center}
.tc4-h{color:var(--tc4-ink);font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-.025em);text-transform:var(--display-case,none);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;text-wrap:balance}
.tc4-mark{padding:0 .08em;border-radius:.14em;background-image:linear-gradient(176deg,transparent 0 58%,var(--tc4-marker) 58% 93%,transparent 93%);-webkit-box-decoration-break:clone;box-decoration-break:clone}
.tc4-lead{max-width:60ch;margin:16px auto 0;color:var(--tc4-muted);font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;text-wrap:pretty}
.tc4-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:clamp(24px,4vw,48px);align-items:start;margin-top:clamp(32px,5vw,56px)}
.tc4.is-single .tc4-grid{grid-template-columns:minmax(0,36rem);justify-content:center}
.tc4-cell{min-width:0}
.tc4-card{position:relative;padding:clamp(20px,3vw,32px);background:var(--tc4-card);color:var(--tc4-ink);border:1px solid var(--card-border,var(--tc4-line));border-radius:var(--tc4-r);box-shadow:var(--card-shadow,var(--shadow-md,0 1px 2px oklch(from var(--tc4-sh) l c h / .22),0 4px 10px -2px oklch(from var(--tc4-sh) l c h / .2)))}
.tc4-offer-wrap{position:relative;isolation:isolate}
.tc4-offer-wrap::before{content:'';position:absolute;inset:16px 20px -12px;z-index:-1;background:var(--tc4-card);border:1px solid var(--tc4-line);border-radius:var(--tc4-r);box-shadow:var(--shadow-sm,0 1px 1px oklch(from var(--tc4-sh) l c h / .18),0 1px 3px oklch(from var(--tc4-sh) l c h / .14))}
.tc4-offer{border-color:color-mix(in oklch,var(--accent,oklch(.5 .17 257)) 38%,var(--tc4-card));box-shadow:var(--shadow-lg,0 2px 4px oklch(from var(--tc4-sh) l c h / .22),0 12px 24px -8px oklch(from var(--tc4-sh) l c h / .32))}
.tc4-rhead{display:flex;align-items:flex-start;gap:16px;margin-bottom:20px}
.tc4-prod{flex:none;width:clamp(72px,9vw,96px);height:auto;aspect-ratio:1;object-fit:contain;filter:drop-shadow(0 2px 3px oklch(from var(--tc4-sh) l c h / .28)) drop-shadow(0 10px 12px oklch(from var(--tc4-sh) l c h / .16))}
.tc4-rh{font-family:var(--font-display,inherit);font-weight:800;letter-spacing:-.01em;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;text-wrap:balance}
.tc4-hint{margin-top:8px;color:var(--tc4-muted);font-size:.9375rem;line-height:1.4;font-weight:600;text-wrap:pretty}
.tc4-pname{color:var(--tc4-ink);font-weight:700}
.tc4-rows{display:grid;gap:4px}
.tc4-row{position:relative;display:grid;grid-template-columns:28px minmax(0,1fr);gap:14px;align-items:start;margin-inline:-12px;padding:12px;border-radius:10px;cursor:pointer;transition:background .16s ease}
.tc4-row:hover{background:var(--tc4-well)}
.tc4-row.is-on{background:var(--danger-soft,color-mix(in oklch,var(--danger,oklch(.5 .17 27)) 14%,var(--tc4-card)))}
.tc4-input{position:absolute;top:12px;left:12px;width:28px;height:28px;margin:0;opacity:0;cursor:pointer}
.tc4-box{display:grid;place-items:center;width:28px;height:28px;border-radius:8px;border:2px solid oklch(from var(--tc4-ink) l c h / .38);background:var(--field,oklch(1 0 0));color:var(--tc4-glyph);transition:background .16s ease,border-color .16s ease}
.tc4-box svg{opacity:0;transform:scale(.7);transition:opacity .16s ease,transform .16s ease}
.tc4-row:hover .tc4-input:not(:checked)+.tc4-box{border-color:oklch(from var(--tc4-ink) l c h / .62)}
.tc4-input:checked+.tc4-box{background:var(--danger,oklch(.5 .17 27));border-color:var(--danger,oklch(.5 .17 27))}
.tc4-input:checked+.tc4-box svg{opacity:1;transform:none}
.tc4-input:focus-visible+.tc4-box{outline:3px solid var(--tc4-focus);outline-offset:2px}
.tc4-items{display:grid;gap:16px}
.tc4-item{display:grid;grid-template-columns:26px minmax(0,1fr);gap:14px;align-items:start}
.tc4-tick{display:grid;place-items:center;width:26px;height:26px;border-radius:50%;background:var(--success,oklch(.5 .138 150));color:var(--tc4-glyph)}
.tc4-text{display:block;min-width:0}
.tc4-line{display:flex;align-items:flex-end;align-items:last baseline;gap:8px}
.tc4-name{flex:0 1 auto;min-width:0;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.4;font-weight:700;text-wrap:pretty}
.tc4-leader{flex:1 1 20px;min-width:20px;height:2px;background-image:radial-gradient(circle,var(--tc4-dot) 1px,transparent 1.3px);background-size:7px 2px;background-repeat:repeat-x;background-position:left center}
.tc4-amt{flex:none;font-family:var(--font-display,inherit);font-weight:800;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.4;font-variant-numeric:tabular-nums;white-space:nowrap}
.tc4-row.is-on .tc4-amt{color:var(--danger,oklch(.5 .17 27))}
.tc4-inc{color:var(--tc4-muted);font-weight:700}
.tc4-detail{display:block;margin-top:2px;color:var(--tc4-muted);font-size:.9375rem;line-height:1.4;font-weight:500;text-wrap:pretty}
.tc4-row.is-on .tc4-detail{color:var(--tc4-ink)}
.tc4-sum{display:flex;align-items:flex-end;align-items:last baseline;gap:8px;margin-top:16px;color:var(--tc4-muted);font-size:.9375rem;line-height:1.4;font-weight:600}
.tc4-sum-amt{flex:none;color:var(--tc4-ink);font-weight:800;font-variant-numeric:tabular-nums}
.tc4-well{margin-top:12px;padding:18px 20px;border-radius:10px;background:var(--tc4-well)}
.tc4-offer .tc4-well{margin-top:24px}
.tc4-tline{display:flex;flex-wrap:wrap;align-items:flex-end;align-items:last baseline;gap:12px 8px}
.tc4-tlabel{flex:0 1 auto;min-width:0;font-family:var(--font-display,inherit);font-weight:800;letter-spacing:-.01em;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15}
.tc4-num{display:inline-block;flex:none;font-family:var(--font-display,inherit);font-weight:800;letter-spacing:-.03em;font-variant-numeric:tabular-nums;font-size:clamp(2.5rem,4.2vw,3.75rem);line-height:1;white-space:nowrap}
.tc4-num-cost{color:var(--danger,oklch(.5 .17 27))}
.tc4-price{flex:none;margin-left:auto;display:inline-flex;flex-wrap:nowrap;align-items:baseline;gap:8px;padding-inline:2px}
.tc4-just{font-family:var(--font-display,inherit);font-weight:800;letter-spacing:-.01em;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15}
.tc4-per{color:var(--tc4-muted);font-size:.9375rem;font-weight:600;line-height:1.4;white-space:nowrap}
.tc4-diff,.tc4-pnote{margin-top:12px;font-size:.9375rem;line-height:1.4;font-weight:600;text-wrap:pretty}
.tc4-diff{color:var(--tc4-ink)}
.tc4-pnote{color:var(--tc4-muted)}
.tc4-cta{margin-top:20px}
.tc4-btn{position:relative;display:flex;align-items:center;justify-content:center;gap:10px;width:100%;min-height:64px;padding:0 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(oklch(from var(--tc4-b) calc(l + .04) c h),oklch(from var(--tc4-b2) calc(l - .02) c h));color:var(--button-ink,var(--cta-ink,oklch(1 0 0)));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-decoration:none;text-shadow:var(--button-text-shadow,none);white-space:nowrap;cursor:pointer;box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--tc4-b) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--tc4-b) calc(l - .16) c h),0 1px 2px oklch(from var(--tc4-sh) l c h / .3),0 8px 16px -6px oklch(from var(--tc4-sh) l c h / .45));transition:background .16s ease,box-shadow .16s ease,transform .16s ease}
.tc4-btn svg{flex:none}
.tc4-btn-price{padding-left:12px;border-left:1px solid color-mix(in oklch,currentColor 45%,transparent);font-variant-numeric:tabular-nums}
.tc4-btn.is-hover,.tc4-btn:not(:disabled):not([aria-disabled=true]):hover{background:linear-gradient(oklch(from var(--tc4-b) calc(l - .01) c h),oklch(from var(--tc4-b2) calc(l - .07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--tc4-b) calc(l + .12) c h / .6),inset 0 -3px 0 oklch(from var(--tc4-b) calc(l - .18) c h),0 1px 2px oklch(from var(--tc4-sh) l c h / .32),0 12px 20px -6px oklch(from var(--tc4-sh) l c h / .5));transform:translateY(-1px)}
.tc4-btn.is-active,.tc4-btn:not(:disabled):not([aria-disabled=true]):active{background:linear-gradient(oklch(from var(--tc4-b) calc(l - .04) c h),oklch(from var(--tc4-b2) calc(l - .08) c h));box-shadow:inset 0 2px 4px oklch(from var(--tc4-b) calc(l - .22) c h / .45),inset 0 -2px 0 oklch(from var(--tc4-b) calc(l - .16) c h),0 1px 2px oklch(from var(--tc4-sh) l c h / .3);transform:translateY(1px)}
.tc4-btn:focus-visible{outline:3px solid var(--tc4-focus);outline-offset:3px}
.tc4-btn:disabled,.tc4-btn[aria-disabled=true]{background:var(--secondary,oklch(.93 .015 263));color:var(--secondary-ink,var(--tc4-ink));text-shadow:none;box-shadow:var(--button-2-shadow,var(--shadow-sm,0 1px 1px oklch(from var(--tc4-sh) l c h / .18),0 1px 3px oklch(from var(--tc4-sh) l c h / .14)));transform:none;cursor:not-allowed}
.tc4-btn.is-compact{width:auto;flex:none;min-height:56px;padding:0 16px;gap:8px;font-size:1.125rem}
.tc4-spin{animation:tc4-spin .8s linear infinite}
@keyframes tc4-spin{to{transform:rotate(360deg)}}
.tc4-ico{display:inline-block;vertical-align:-.15em;margin-inline-end:.4em}
.tc4-error{margin-top:12px;padding:12px 14px;border-radius:10px;background:var(--danger-soft,color-mix(in oklch,var(--danger,oklch(.5 .17 27)) 14%,var(--tc4-card)));color:var(--danger,oklch(.5 .17 27));font-size:.9375rem;line-height:1.4;font-weight:700;text-wrap:pretty}
.tc4-reassure{margin-top:12px;text-align:center;color:var(--tc4-muted);font-size:.9375rem;line-height:1.4;font-weight:600;text-wrap:pretty}
.tc4-reassure .tc4-ico{color:var(--success,oklch(.5 .138 150))}
.tc4-bar{display:none}
@media (max-width:820px){
.tc4 .tc4-grid,.tc4.is-single .tc4-grid{grid-template-columns:minmax(0,1fr)}
.tc4-bar{position:sticky;bottom:calc(12px + env(safe-area-inset-bottom,0px));z-index:5;display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:28px;padding:10px 10px 10px 16px;background:var(--tc4-card);color:var(--tc4-ink);border:1px solid var(--tc4-line);border-radius:var(--tc4-r);box-shadow:var(--shadow-lg,0 2px 4px oklch(from var(--tc4-sh) l c h / .22),0 12px 24px -8px oklch(from var(--tc4-sh) l c h / .32));transition:opacity .2s ease,transform .2s ease,visibility 0s linear 0s}
.tc4-bar.is-hidden{opacity:0;transform:translateY(12px);visibility:hidden;pointer-events:none;transition:opacity .2s ease,transform .2s ease,visibility 0s linear .2s}
.tc4-bar-copy{display:grid;gap:2px;min-width:0}
.tc4-bar-label{overflow:hidden;color:var(--tc4-muted);font-size:.9375rem;line-height:1.3;font-weight:600;white-space:nowrap;text-overflow:ellipsis}
.tc4-bar-price{font-family:var(--font-display,inherit);font-weight:800;letter-spacing:-.01em;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;font-variant-numeric:tabular-nums;white-space:nowrap}
}
@media (max-width:480px){
.tc4-well{padding:16px}
.tc4-rhead{gap:12px}
.tc4-line .tc4-leader{display:none}
.tc4-line{gap:12px}
.tc4-name{flex:1 1 auto}
.tc4-tline .tc4-leader{display:block}
}
@media (prefers-reduced-motion:reduce){
.tc4 .tc4-btn,.tc4 .tc4-row,.tc4 .tc4-box,.tc4 .tc4-box svg,.tc4 .tc4-bar,.tc4 .tc4-bar.is-hidden{transition:none}
.tc4 .tc4-btn.is-hover,.tc4 .tc4-btn.is-active,.tc4 .tc4-btn:hover,.tc4 .tc4-btn:active,.tc4 .tc4-bar.is-hidden{transform:none}
.tc4 .tc4-spin{animation:none}
}
`
pieces/content/two-choices-close-4/specimen.tsx 56 lines
import __studioImagea934323e from "../assets/136b9606e7b760e8.webp";
import * as React from 'react'
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
import { TwoChoicesClose4, type TwoChoicesClose4State } from '../two-choices-close-4'
export const states = ['default', 'hover', 'active', 'disabled', 'error']
const COST_LINES = [
{ label: 'Weekend no-heat emergency call', detail: 'After-hours dispatch plus diagnosis', amount: '$389', defaultChecked: true },
{ label: 'Failed furnace igniter, replaced', detail: 'Parts and labour, with no warning', amount: '$265' },
{ label: 'Extra on your energy bills for a year', detail: 'A clogged filter and dirty coil make it work harder', amount: '$310', defaultChecked: true },
{ label: 'AC capacitor swap in the July heat', detail: 'Same-week booking at peak-season rates', amount: '$195' },
{ label: 'Thaw-and-service visit for a frozen coil', detail: 'The AC iced over overnight', amount: '$180' },
]
const ITEMS = [
{ name: 'Spring AC tune-up', detail: 'Coil clean, refrigerant check, capacitor test', value: '$129' },
{ name: 'Fall furnace tune-up', detail: 'Igniter, burners, heat exchanger and safety checks', value: '$129' },
{ name: 'Priority booking', detail: 'Members go to the front of the line, even in July' },
{ name: 'No after-hours fees', detail: 'Nights and weekends at the standard rate' },
{ name: '15% off every repair', detail: 'Parts and labour, on every visit' },
]
export default function TwoChoicesClose4Specimen({ state = 'default' }: { state?: TwoChoicesClose4State }) {
return (
<TwoChoicesClose4
headline='Two receipts. You’ll pay one of them.'
emphasis='You’ll pay one of them.'
lead='Tick every line that’s already happened to your system. Then see what a full year of the Clearpath Comfort Plan costs instead.'
costTitle='What putting it off keeps costing you'
costHint='Tick every line that’s happened to you.'
costLines={COST_LINES}
tallyLabel='Costing you'
emptyNote='Tick a line above to see what it’s costing you.'
differenceTemplate='That’s {amount} more than a full year of the Comfort Plan.'
announceTemplate='Costing you {amount} so far.'
offerTitle='Everything a year of the Comfort Plan covers'
productName='Clearpath HVAC Comfort Plan'
productImage={slot('product', __studioImagea934323e)}
productImageAlt='A well-kept home air conditioning unit'
items={ITEMS}
todayLabel='Today'
pricePrefix='Just'
price='$199'
pricePeriod='a year'
priceNote='Less than one weekend emergency call.'
ctaLabel='Add To Cart'
loadingLabel='Adding to cart…'
reassurance={defaults.sample.guarantee}
barLabel='Comfort Plan'
state={state}
onAction={() => undefined}
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalTwoChoicesClose4 |
string |
Default 'Two receipts. Only one of them is worth paying.'
|
emphasis OptionalTwoChoicesClose4 |
string |
Default 'Only one of them is worth paying.'
|
lead OptionalTwoChoicesClose4 |
string |
Default 'Tick every line that’s already happened to you, then compare the total with what it costs to fix it today.'
|
singleHeadline OptionalTwoChoicesClose4 |
string |
Default 'Everything you get, on one receipt.'
|
singleEmphasis OptionalTwoChoicesClose4 |
string |
Default 'on one receipt'
|
singleLead OptionalTwoChoicesClose4 |
string |
Default ''
|
costTitle OptionalTwoChoicesClose4 |
string |
Default 'What staying put keeps costing you'
|
costHint OptionalTwoChoicesClose4 |
string |
Default 'Tick every line that’s happened to you.'
|
costLines OptionalTwoChoicesClose4 |
CostLine[] |
Default []
|
checkLabel OptionalTwoChoicesClose4 |
string |
Default 'This happens to me'
|
possibleLabel OptionalTwoChoicesClose4 |
string |
Default 'Every line on this receipt'
|
tallyLabel OptionalTwoChoicesClose4 |
string |
Default 'Costing you'
|
emptyNote OptionalTwoChoicesClose4 |
string |
Default 'Tick a line above to add it up.'
|
differenceTemplate OptionalTwoChoicesClose4 |
string |
Default 'That’s {amount} more than {product} costs today.'
|
announceTemplate OptionalTwoChoicesClose4 |
string |
Default 'Costing you {amount}.'
|
offerTitle OptionalTwoChoicesClose4 |
string |
Default 'Everything that comes in the kit'
|
productName OptionalTwoChoicesClose4 |
string |
Default 'The Funnel Starter Kit'
|
productImage OptionalTwoChoicesClose4 |
string |
|
productImageAlt OptionalTwoChoicesClose4 |
string |
Default ''
|
items OptionalTwoChoicesClose4 |
ReceiptItem[] |
Default []
|
includedLabel OptionalTwoChoicesClose4 |
string |
Default 'Included'
|
todayLabel OptionalTwoChoicesClose4 |
string |
Default 'Today'
|
pricePrefix OptionalTwoChoicesClose4 |
string |
Default 'Just'
|
price OptionalTwoChoicesClose4 |
string |
Default '$47'
|
pricePeriod OptionalTwoChoicesClose4 |
string |
Default ''
|
priceNote OptionalTwoChoicesClose4 |
string |
Default ''
|
ctaLabel OptionalTwoChoicesClose4 |
string |
Default 'Add To Cart'
|
loadingLabel OptionalTwoChoicesClose4 |
string |
Default 'Adding to cart…'
|
reassurance OptionalTwoChoicesClose4 |
string |
Default ''
|
errorMessage OptionalTwoChoicesClose4 |
string |
Default 'We couldn’t add it to your cart. Please try again.'
|
barLabel OptionalTwoChoicesClose4 |
string |
Default 'Your total today'
|
state OptionalTwoChoicesClose4 |
TwoChoicesClose4State |
Default 'default'
|
disabled OptionalTwoChoicesClose4 |
boolean |
Default false
|
href OptionalTwoChoicesClose4 |
string |
|
onAction OptionalTwoChoicesClose4 |
() => void | boolean | Promise<void | boolean> |
|
id OptionalTwoChoicesClose4 |
string |
|
className OptionalTwoChoicesClose4 |
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-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-focus- Form inputs: background, ink, border, radius and focus colour.
--marker- The highlighter colour behind key phrases.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
product- The main product shot or cover (ebook, kit, bottle).
-
136b9606e7b760e8.webp
image/webp · 37.5 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB