One Click Downsell 3
Downsell after a declined bundle: the bundle’s receipt trims itself to the core item. The add-ons strike and fold away,
Use it in a prompt
Use checkout/one-click-downsell-3 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/checkout/one-click-downsell-3.tsx. - Import it and pass your copy and images (Props tab):
import { OneClickDownsell3 } from "@/components/funneldna/checkout/one-click-downsell-3"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/checkout/one-click-downsell-3/component.tsx 661 lines
// layout: ledger-receipt
// Downsell after a declined bundle: the bundle’s receipt trims itself to the core item. The add-ons strike and fold away,
// the total rolls down to the lighter price, and a 30-day risk reversal leads into a one-click yes.
'use client'
import * as React from 'react'
import { AlertCircle, Check, Loader2, Lock, Minus, ReceiptText, ShieldCheck } from 'lucide-react'
import { FX_HOST, Texture } from '../fx/fx'
import topo from '../fx/textures/topo'
export type OneClickDownsell3Line = {
name: string
/** One short line under the name; it folds away on removed lines. */
detail?: string
/** Line price as shown, e.g. '$89'. */
price: string
/** The line the downsell keeps; every other line is struck and folded. */
kept?: boolean
}
export type OneClickDownsell3Point = {
/** Bold lead-in that opens the paragraph. */
lead: string
text: string
}
export type OneClickDownsell3State = 'default' | 'hover' | 'active' | 'disabled' | 'error'
export type OneClickDownsell3Props = {
headline?: string
/** Phrase inside the headline that carries one marker stroke. */
highlight?: string
lead?: string
/** Short paragraphs, each opening with a bold lead-in. */
points?: OneClickDownsell3Point[]
/** Slot 'product': the kept item on a transparent background. Without it the receipt sits beside the copy. */
productImage?: string
productImageAlt?: string
/** Plain caption under the product photo; hidden when empty. */
productCaption?: string
/** Heading on the receipt. */
receiptTitle?: string
/** Accessible name for the receipt lines. */
linesLabel?: string
/** The full bundle, line by line. */
lines?: OneClickDownsell3Line[]
/** Screen-reader status after a kept line. */
keptLabel?: string
/** Screen-reader status after a removed line. */
removedLabel?: string
/** Sub-total line for what came off; hidden when removedAmount is empty. */
removedLine?: string
/** Amount that came off, e.g. '−$65'. */
removedAmount?: string
/** Bundle price before trimming: the total rolls down from it, and it is slashed beside the new total. */
bundleTotal?: string
/** Screen-reader prefix for the slashed bundle price. */
bundleTotalLabel?: string
totalLabel?: string
/** Today’s price for the kept item. */
total?: string
totalNote?: string
/** Risk reversal that leads into the button. */
riskTitle?: string
riskText?: string
/** Button label; carries the price. */
ctaLabel?: string
/** Button text while a returned onAction promise is pending. */
loadingLabel?: string
/** One short line under the button. */
reassurance?: string
/** Shown when onAction rejects, or in the error state. */
errorMessage?: string
/** Quiet decline link; hidden when empty. */
declineLabel?: string
/** Decline destination; '#' links stay on the page. */
declineHref?: string
/** Accept destination: when set the button renders as a link. */
href?: string
/** Accept action. A returned promise shows loadingLabel; a rejection shows errorMessage. */
onAction?: () => void | Promise<void>
/** Decline action; when set it replaces declineHref navigation. */
onDecline?: () => void
headingAs?: 'h1' | 'h2'
disabled?: boolean
state?: OneClickDownsell3State
className?: string
}
const DEFAULT_LINES: OneClickDownsell3Line[] = [
{ name: 'Trailhead Hand Grinder', detail: 'The grinder from your bundle, exactly as offered.', price: '$89', kept: true },
{ name: 'Travel Sleeve', detail: 'Padded carry case for the grinder.', price: '$19' },
{ name: 'Pour-Over Scale', detail: 'Weighs beans and water to the gram.', price: '$34' },
{ name: 'Brush & Burr Care Kit', detail: 'Keeps the burrs clean between brews.', price: '$12' },
]
const DEFAULT_POINTS: OneClickDownsell3Point[] = [
{ lead: 'Same grinder.', text: 'You keep the exact Trailhead grinder from the bundle. Only the accessory pack comes off.' },
{ lead: 'Smaller price.', text: 'Without the extras, your total drops from $154 to $89.' },
{ lead: 'One click.', text: 'It joins the order you just placed. No new form, nothing to type in.' },
]
export function OneClickDownsell3({
headline = 'No problem. Keep the grinder, skip the extras.',
highlight = 'Keep the grinder',
lead = 'We took the accessory pack off your bundle. Same Trailhead grinder, a smaller total, one click to add.',
points = DEFAULT_POINTS,
productImage,
productImageAlt = 'The Trailhead hand coffee grinder',
productCaption = 'The same Trailhead grinder, on its own.',
receiptTitle = 'Your bundle, trimmed to the grinder',
linesLabel = 'Your revised order',
lines = DEFAULT_LINES,
keptLabel = 'kept in your order',
removedLabel = 'removed',
removedLine = 'Accessory pack removed',
removedAmount = '−$65',
bundleTotal = '$154',
bundleTotalLabel = 'Bundle price',
totalLabel = 'Just the grinder, today',
total = '$89',
totalNote = 'One payment · No subscription',
riskTitle = 'Try it for 30 days.',
riskText = 'If it isn’t the right grinder for you, send it back for a full refund.',
ctaLabel = 'Add the Grinder for $89',
loadingLabel = 'Adding the grinder…',
reassurance = 'One click · Added to the order you just placed',
errorMessage = 'We couldn’t add the grinder to your order. Please try again.',
declineLabel = 'No thanks, continue without the grinder',
declineHref = '#decline',
href,
onAction,
onDecline,
headingAs = 'h2',
disabled = false,
state = 'default',
className,
}: OneClickDownsell3Props) {
const headingId = React.useId()
const errorId = React.useId()
const reassureId = React.useId()
const receiptRef = React.useRef<HTMLDivElement>(null)
const forcedError = state === 'error'
const [status, setStatus] = React.useState<'idle' | 'loading' | 'error'>(forcedError ? 'error' : 'idle')
const [phase, setPhase] = React.useState<Phase>('done')
const alive = React.useRef(true)
React.useEffect(() => {
alive.current = true
return () => {
alive.current = false
}
}, [])
React.useEffect(() => {
setStatus(forcedError ? 'error' : 'idle')
}, [forcedError])
useIsoLayoutEffect(() => {
const el = receiptRef.current
if (!el || typeof IntersectionObserver === 'undefined') return
if (window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches) return
let raf = 0
let timer = 0
setPhase('pre')
const io = new IntersectionObserver(
(entries) => {
if (!entries.some((entry) => entry.isIntersecting)) return
io.disconnect()
raf = window.requestAnimationFrame(() => {
raf = window.requestAnimationFrame(() => {
setPhase('play')
timer = window.setTimeout(() => setPhase('done'), PLAY_MS)
})
})
},
{ threshold: 0.25 },
)
io.observe(el)
return () => {
io.disconnect()
window.cancelAnimationFrame(raf)
window.clearTimeout(timer)
}
}, [])
const isDisabled = disabled || state === 'disabled'
const loading = status === 'loading'
const blocked = isDisabled || loading
const Heading = headingAs
const SubHeading = headingAs === 'h1' ? 'h2' : 'h3'
async function run() {
if (!onAction) return
try {
const result: unknown = onAction()
if (result && typeof (result as PromiseLike<void>).then === 'function') {
setStatus('loading')
await result
if (alive.current) setStatus('idle')
} else {
setStatus('idle')
}
} catch {
if (alive.current) setStatus('error')
}
}
function accept(event: React.MouseEvent<HTMLElement>) {
if (blocked) {
event.preventDefault()
return
}
void run()
}
function decline(event: React.MouseEvent<HTMLAnchorElement>) {
if (onDecline) {
event.preventDefault()
onDecline()
return
}
if (!declineHref || declineHref.startsWith('#')) event.preventDefault()
}
const at = highlight ? headline.indexOf(highlight) : -1
const title =
at < 0 ? (
headline
) : (
<>
{headline.slice(0, at)}
<span className='ds3-mark'>{highlight}</span>
{headline.slice(at + highlight.length)}
</>
)
const btnClass = ['ds3-btn', state === 'hover' ? 'is-hover' : '', state === 'active' ? 'is-active' : '']
.filter(Boolean)
.join(' ')
const describedBy =
[reassurance ? reassureId : '', status === 'error' ? errorId : ''].filter(Boolean).join(' ') || undefined
const inner = loading ? (
<>
<Loader2 className='ds3-spin' size={22} strokeWidth={2.5} aria-hidden='true' />
<span>{loadingLabel}</span>
</>
) : (
<span>{ctaLabel}</span>
)
let dropIndex = 0
return (
<section
className={['cf-one-click-downsell-3', className].filter(Boolean).join(' ')}
aria-labelledby={headingId}
data-ds3={phase}
>
<style>{CSS}</style>
<div className={['ds3-wrap', productImage ? '' : 'no-stage'].filter(Boolean).join(' ')}>
<header className='ds3-head'>
<Heading className='ds3-title' id={headingId}>
{title}
</Heading>
{lead ? <p className='ds3-lead'>{lead}</p> : null}
</header>
{productImage ? (
<figure className='ds3-stage'>
<div className='ds3-shot'>
<div className='ds3-tex' style={{ ...FX_HOST, position: 'absolute', inset: 0 }} aria-hidden='true'>
<Texture src={topo} tone='ink' />
</div>
<img
className='ds3-product'
src={productImage}
alt={productImageAlt}
width={640}
height={640}
decoding='async'
/>
</div>
{productCaption ? <figcaption className='ds3-caption'>{productCaption}</figcaption> : null}
</figure>
) : null}
{points.length ? (
<ul className='ds3-points'>
{points.map((point) => (
<li key={point.lead}>
<strong>{point.lead}</strong> {point.text}
</li>
))}
</ul>
) : null}
<div className='ds3-receipt' ref={receiptRef}>
<div className='ds3-rhead'>
<ReceiptText className='ds3-rhead-icon' size={24} strokeWidth={2.5} aria-hidden='true' />
<SubHeading className='ds3-rtitle'>{receiptTitle}</SubHeading>
</div>
<ul className='ds3-lines' aria-label={linesLabel}>
{lines.map((line, i) => {
const dropped = !line.kept
const delay = dropped ? Math.min(dropIndex++ * 0.07, 0.28) : 0
return (
<li
key={`${line.name}-${i}`}
className={dropped ? 'ds3-line is-dropped' : 'ds3-line is-kept'}
style={dropped ? ({ '--ds3-delay': `${delay}s` } as React.CSSProperties) : undefined}
>
<span className='ds3-badge' aria-hidden='true'>
<Check className='ds3-ico ds3-ico-check' size={14} strokeWidth={3} />
{dropped ? <Minus className='ds3-ico ds3-ico-minus' size={14} strokeWidth={3} /> : null}
</span>
<div className='ds3-body'>
<div className='ds3-row'>
<span className='ds3-name'>
<span className='ds3-strike'>{line.name}</span>
<span className='ds3-sr'>, {dropped ? removedLabel : keptLabel}</span>
</span>
<span className='ds3-leader' aria-hidden='true' />
<span className='ds3-price'>
<span className='ds3-strike'>{line.price}</span>
</span>
</div>
{line.detail ? (
<div className='ds3-fold'>
<div>
<p className='ds3-detail'>{line.detail}</p>
</div>
</div>
) : null}
</div>
</li>
)
})}
</ul>
{removedAmount ? (
<div className='ds3-fold ds3-subfold'>
<div>
<p className='ds3-sub'>
<span className='ds3-sub-label'>{removedLine}</span>
<span className='ds3-leader' aria-hidden='true' />
<span className='ds3-sub-amount'>{removedAmount}</span>
</p>
</div>
</div>
) : null}
<div className='ds3-total'>
<div className='ds3-total-copy'>
<p className='ds3-total-label'>{totalLabel}</p>
{totalNote ? <p className='ds3-total-note'>{totalNote}</p> : null}
</div>
<p className='ds3-figs'>
{bundleTotal ? (
<span className='ds3-was'>
<span className='ds3-sr'>{bundleTotalLabel} </span>
{bundleTotal}
</span>
) : null}
<span className='ds3-sr'>
{totalLabel}: {total}
</span>
<span className='ds3-big' aria-hidden='true'>
<RollPrice from={bundleTotal || total} to={total} phase={phase} />
</span>
</p>
</div>
{riskTitle || riskText ? (
<p className='ds3-risk'>
<ShieldCheck className='ds3-inline ds3-risk-icon' size={20} strokeWidth={2.5} aria-hidden='true' />
{riskTitle ? <strong>{riskTitle}</strong> : null} {riskText}
</p>
) : null}
<div className='ds3-dock'>
{href ? (
<a
className={btnClass}
href={isDisabled ? undefined : href}
onClick={accept}
aria-disabled={isDisabled || undefined}
aria-busy={loading || undefined}
aria-describedby={describedBy}
>
{inner}
</a>
) : (
<button
type='button'
className={btnClass}
onClick={accept}
disabled={isDisabled}
aria-busy={loading || undefined}
aria-describedby={describedBy}
>
{inner}
</button>
)}
{reassurance ? (
<p className='ds3-reassure' id={reassureId}>
<Lock className='ds3-inline' size={16} strokeWidth={2.5} aria-hidden='true' />
{reassurance}
</p>
) : null}
{status === 'error' ? (
<p className='ds3-error' id={errorId} role='alert'>
<AlertCircle className='ds3-inline' size={18} strokeWidth={2.5} aria-hidden='true' />
{errorMessage}
</p>
) : null}
</div>
{declineLabel ? (
<p className='ds3-decline'>
<a href={declineHref || '#'} onClick={decline}>
{declineLabel}
</a>
</p>
) : null}
</div>
</div>
</section>
)
}
export default OneClickDownsell3
type Phase = 'pre' | 'play' | 'done'
const PLAY_MS = 1600
const DIGITS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
const useIsoLayoutEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect
type Slot = { kind: 'reel'; from: number; to: number } | { kind: 'static' | 'out' | 'in'; ch: string }
function isDigit(c: string) {
return c >= '0' && c <= '9'
}
function splitFigure(value: string) {
let i = 0
while (i < value.length && !isDigit(value.charAt(i))) i += 1
let j = value.length
while (j > i && !isDigit(value.charAt(j - 1))) j -= 1
if (i >= j) return null
return { prefix: value.slice(0, i), num: value.slice(i, j), suffix: value.slice(j) }
}
/** Lines the two prices up from the right so each digit can roll on its own reel. */
function planRoll(from: string, to: string): { prefix: string; suffix: string; slots: Slot[] } | null {
const a = splitFigure(from)
const b = splitFigure(to)
if (!a || !b || a.prefix !== b.prefix || a.suffix !== b.suffix) return null
const n = Math.max(a.num.length, b.num.length)
const slots: Slot[] = []
for (let i = 0; i < n; i += 1) {
const fc = a.num.charAt(i - (n - a.num.length))
const tc = b.num.charAt(i - (n - b.num.length))
if (fc && tc && isDigit(fc) && isDigit(tc)) slots.push({ kind: 'reel', from: Number(fc), to: Number(tc) })
else if (fc && fc === tc) slots.push({ kind: 'static', ch: fc })
else if (fc && !tc) slots.push({ kind: 'out', ch: fc })
else if (!fc && tc) slots.push({ kind: 'in', ch: tc })
else return null
}
return { prefix: a.prefix, suffix: a.suffix, slots }
}
/** Visual price: the final value as text once settled; digit reels only while the reveal plays. */
function RollPrice({ from, to, phase }: { from: string; to: string; phase: Phase }) {
const plan = React.useMemo(() => planRoll(from, to), [from, to])
if (phase === 'done' || from === to) return <>{to}</>
if (!plan) {
return (
<span className='ds3-swap'>
<span className='ds3-swap-from'>{from}</span>
<span className='ds3-swap-to'>{to}</span>
</span>
)
}
return (
<span className='ds3-roll'>
{plan.prefix ? <span>{plan.prefix}</span> : null}
{plan.slots.map((slot, i) => {
if (slot.kind === 'reel') {
const d = phase === 'pre' ? slot.from : slot.to
return (
<span key={i} className='ds3-reel'>
<span className='ds3-col' style={{ '--d': d } as React.CSSProperties}>
{DIGITS.map((digit) => (
<span key={digit}>{digit}</span>
))}
</span>
</span>
)
}
return (
<span key={i} className={slot.kind === 'static' ? undefined : `ds3-${slot.kind}`}>
{slot.ch}
</span>
)
})}
{plan.suffix ? <span>{plan.suffix}</span> : null}
</span>
)
}
const CSS = `
.cf-one-click-downsell-3{--ds3-shadow:var(--shadow, oklch(0.22 0.03 260));--ds3-marker:color-mix(in oklch, var(--marker, #fae37c) 45%, var(--surface));position:relative;overflow-x:clip;background:var(--surface);color:var(--ink);font-family:var(--font-body);padding:clamp(56px, 8vw, 112px) clamp(16px, 5vw, 48px) clamp(64px, 8.5vw, 120px)}
.cf-one-click-downsell-3 *,.cf-one-click-downsell-3 *::before,.cf-one-click-downsell-3 *::after{box-sizing:border-box}
.cf-one-click-downsell-3 :where(h1,h2,h3,p,ul,figure){margin:0}
.ds3-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.ds3-wrap{max-width:1120px;margin:0 auto;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,34rem);grid-template-areas:'head head' 'stage receipt' 'points receipt';grid-template-rows:auto auto 1fr;column-gap:clamp(32px, 5vw, 72px);row-gap:clamp(24px, 3vw, 40px);align-items:start}
.ds3-wrap.no-stage{grid-template-areas:'head head' 'points receipt';grid-template-rows:auto 1fr}
.ds3-head{grid-area:head;max-width:52rem;animation:ds3-rise .45s cubic-bezier(.2,.7,.2,1) both}
.ds3-title{font-family:var(--font-display);font-size:clamp(2rem, 3.6vw, 3.25rem);line-height:1.06;font-weight:var(--display-weight, 800);letter-spacing:var(--display-tracking, -0.025em);text-transform:var(--display-case, none);color:var(--ink);text-wrap:balance}
.ds3-mark{background-image:linear-gradient(transparent 56%, var(--ds3-marker) 56%, var(--ds3-marker) 94%, transparent 94%);-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:0 .08em;margin:0 -.04em}
.ds3-lead{margin-top:16px;max-width:60ch;font-size:clamp(1.125rem, 1.5vw, 1.375rem);line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
.ds3-stage{grid-area:stage;display:grid;justify-items:center;gap:12px;animation:ds3-rise .45s cubic-bezier(.2,.7,.2,1) .07s both}
.ds3-shot{position:relative;display:grid;place-items:center;width:100%;aspect-ratio:1/0.9;max-height:480px}
.ds3-tex{z-index:0;-webkit-mask-image:radial-gradient(closest-side, currentColor 35%, transparent 100%);mask-image:radial-gradient(closest-side, currentColor 35%, transparent 100%)}
.ds3-product{position:relative;z-index:1;display:block;width:min(88%, 440px);height:auto;aspect-ratio:1;object-fit:contain;filter:drop-shadow(0 2px 3px oklch(from var(--ds3-shadow) l c h / 0.3)) drop-shadow(0 18px 18px oklch(from var(--ds3-shadow) l c h / 0.24))}
.ds3-caption{font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted);text-align:center;text-wrap:pretty}
.ds3-points{grid-area:points;list-style:none;padding:0;display:grid;gap:16px;max-width:64ch}
.ds3-points li{font-size:clamp(1.0625rem, 1.25vw, 1.125rem);line-height:1.5;color:var(--ink);text-wrap:pretty}
.ds3-points strong{font-weight:800}
.ds3-receipt{grid-area:receipt;--ds3-pad:clamp(20px, 3vw, 32px);position:relative;padding:var(--ds3-pad);background:var(--card);color:var(--ink);border:1px solid color-mix(in oklch, var(--accent) 24%, var(--card));border-radius:var(--card-radius, var(--radius, 14px));box-shadow:var(--card-shadow, var(--shadow-lg, 0 2px 4px oklch(from var(--ds3-shadow) l c h / 0.22), 0 12px 24px -8px oklch(from var(--ds3-shadow) l c h / 0.32)))}
.ds3-rhead{display:flex;align-items:flex-start;gap:12px;margin-bottom:20px}
.ds3-rhead-icon{flex:none;margin-top:2px;color:var(--accent)}
.ds3-rtitle{margin:0;font-family:var(--font-display);font-size:clamp(1.3125rem, 1.8vw, 1.625rem);line-height:1.15;font-weight:var(--display-weight, 800);letter-spacing:-0.01em;text-transform:var(--display-case, none);color:var(--ink);text-wrap:balance}
.ds3-lines{list-style:none;padding:0;display:grid;gap:4px}
.ds3-line{display:grid;grid-template-columns:24px minmax(0,1fr);column-gap:12px;align-items:start;padding:12px;border-radius:10px;background:transparent}
.ds3-line.is-kept{background:color-mix(in oklch, var(--accent) 10%, var(--card))}
.ds3-line.is-dropped{padding-block:6px}
.ds3-badge{position:relative;display:block;width:24px;height:24px;margin:0;border-radius:999px;background:var(--success);color:var(--ds3-glyph, #fff)}
.is-dropped .ds3-badge{width:20px;height:20px;margin:2px;background:var(--danger)}
.ds3-ico{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}
.is-dropped .ds3-ico-check{opacity:0}
.ds3-row{display:flex;align-items:flex-end;gap:8px;min-width:0;font-size:1.0625rem}
.ds3-name{flex:0 1 auto;min-width:0;font-size:1.0625rem;line-height:1.35;font-weight:700;color:var(--ink);text-wrap:pretty}
.is-kept .ds3-name{font-weight:800}
.ds3-leader{flex:1 1 16px;min-width:16px;height:6px;margin-bottom:.4em;background-image:radial-gradient(circle, oklch(from var(--ink) l c h / 0.4) 1.1px, transparent 1.6px);background-size:7px 6px;background-repeat:repeat-x;background-position:left center}
.ds3-price{flex:none;font-size:1.0625rem;line-height:1.35;font-weight:800;font-variant-numeric:tabular-nums;color:var(--ink)}
.ds3-strike{background-image:linear-gradient(currentColor, currentColor);background-repeat:no-repeat;background-position:0 58%;background-size:0% 1.5px;-webkit-box-decoration-break:clone;box-decoration-break:clone}
.is-dropped .ds3-strike{background-size:100% 1.5px}
.is-dropped .ds3-name,.is-dropped .ds3-price{font-size:.9375rem;font-weight:500;color:var(--muted)}
.ds3-fold{display:grid;grid-template-rows:1fr}
.ds3-fold>div{min-height:0;overflow:hidden}
.ds3-detail{padding-top:4px;font-size:.9375rem;line-height:1.4;color:var(--muted);text-wrap:pretty}
.is-dropped .ds3-fold{grid-template-rows:0fr;visibility:hidden}
.ds3-subfold{margin-top:4px}
.ds3-sub{display:flex;align-items:flex-end;gap:8px;padding:8px 12px 8px 48px;font-size:1rem;line-height:1.35}
.ds3-sub-label{flex:0 1 auto;min-width:0;font-weight:700;color:var(--ink);text-wrap:pretty}
.ds3-sub-amount{flex:none;font-weight:800;font-variant-numeric:tabular-nums;color:var(--success)}
.ds3-total{margin-top:16px;display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:8px 16px;padding:16px 18px;border-radius:10px;background:color-mix(in oklch, var(--ink) 4%, var(--card))}
.ds3-total-copy{flex:1 1 10rem;min-width:0}
.ds3-total-label{font-size:1.0625rem;line-height:1.3;font-weight:800;color:var(--ink);text-wrap:balance}
.ds3-total-note{margin-top:4px;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--ink);text-wrap:pretty}
.ds3-figs{display:flex;align-items:baseline;justify-content:flex-end;gap:12px;margin-left:auto;font-variant-numeric:tabular-nums}
.ds3-was{position:relative;display:inline-block;padding:0 .12em;font-family:var(--font-display);font-size:clamp(1.3125rem, 1.8vw, 1.625rem);line-height:1.1;font-weight:800;color:var(--muted)}
.ds3-was::after{content:'';position:absolute;left:-.06em;right:-.06em;top:52%;height:3px;border-radius:3px;background:var(--danger);transform:rotate(-18deg) scaleX(1);transform-origin:left center}
.ds3-big{display:inline-block;font-family:var(--font-display);font-size:clamp(2.5rem, 4.2vw, 3.75rem);line-height:1.1;font-weight:var(--display-weight, 800);letter-spacing:-0.03em;color:var(--ink);white-space:nowrap}
.ds3-roll,.ds3-swap{display:inline-flex;align-items:flex-start;height:1.1em;line-height:1.1;overflow:hidden;vertical-align:bottom;white-space:pre}
.ds3-roll>span{display:block;flex:none}
.ds3-reel{height:1.1em;overflow:hidden}
.ds3-col{display:flex;flex-direction:column;transform:translateY(calc(var(--d, 0) * -1.1em))}
.ds3-col>span{display:block;height:1.1em;line-height:1.1}
.ds3-out{max-width:0;opacity:0;overflow:hidden}
.ds3-in{max-width:1ch;opacity:1;overflow:hidden}
.ds3-swap{display:inline-grid}
.ds3-swap>span{grid-area:1/1;text-align:right}
.ds3-swap-from{transform:translateY(100%);opacity:0}
.ds3-risk{margin-top:24px;font-size:1.0625rem;line-height:1.45;color:var(--ink);text-wrap:pretty}
.ds3-risk strong{font-weight:800}
.ds3-inline{display:inline-block;vertical-align:-0.2em;margin-inline-end:.4em}
.ds3-risk-icon{color:var(--success)}
.ds3-dock{margin-top:16px}
.ds3-btn{--ds3-b:var(--button-bg, var(--cta));--ds3-b2:var(--button-bg-2, var(--cta-2));display:flex;width:100%;min-height:64px;align-items:center;justify-content:center;gap:10px;padding:12px 24px;border:0;border-radius:var(--button-radius, var(--radius, 12px));background:linear-gradient(oklch(from var(--ds3-b) calc(l + 0.04) c h), oklch(from var(--ds3-b2) calc(l - 0.02) c h));color:var(--button-ink, var(--cta-ink));font-family:var(--button-font, var(--font-display));font-size:clamp(1.125rem, 1.55vw, 1.375rem);font-weight:var(--button-weight, 800);text-transform:var(--button-case, none);line-height:1.15;text-align:center;text-wrap:balance;text-decoration:none;text-shadow:var(--button-text-shadow, none);cursor:pointer;box-shadow:var(--button-shadow, inset 0 1px 0 oklch(from var(--ds3-b) calc(l + 0.14) c h / 0.7), inset 0 -3px 0 oklch(from var(--ds3-b) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--ds3-shadow) l c h / 0.3), 0 8px 16px -6px oklch(from var(--ds3-shadow) l c h / 0.42));transition:transform .16s ease, box-shadow .16s ease, background .16s ease;-webkit-tap-highlight-color:transparent}
.ds3-btn:hover:not(:disabled):not([aria-disabled='true']),.ds3-btn.is-hover{background:linear-gradient(oklch(from var(--ds3-b) calc(l - 0.01) c h), oklch(from var(--ds3-b2) calc(l - 0.07) c h));box-shadow:var(--button-shadow, inset 0 1px 0 oklch(from var(--ds3-b) calc(l + 0.12) c h / 0.6), inset 0 -3px 0 oklch(from var(--ds3-b) calc(l - 0.2) c h), 0 1px 2px oklch(from var(--ds3-shadow) l c h / 0.34), 0 10px 20px -6px oklch(from var(--ds3-shadow) l c h / 0.5))}
.ds3-btn:active:not(:disabled):not([aria-disabled='true']),.ds3-btn.is-active{transform:translateY(1px);background:linear-gradient(oklch(from var(--ds3-b) calc(l - 0.04) c h), oklch(from var(--ds3-b2) calc(l - 0.08) c h));box-shadow:inset 0 2px 4px oklch(from var(--ds3-b) calc(l - 0.24) c h / 0.55), inset 0 -2px 0 oklch(from var(--ds3-b) calc(l - 0.16) c h), 0 1px 1px oklch(from var(--ds3-shadow) l c h / 0.3)}
.ds3-btn:focus-visible{outline:3px solid var(--field-focus, var(--accent));outline-offset:3px}
.ds3-btn:disabled,.ds3-btn[aria-disabled='true']{background:var(--button-2-bg, var(--secondary));color:var(--button-2-ink, var(--secondary-ink));text-shadow:none;box-shadow:none;cursor:not-allowed;transform:none}
.ds3-btn[aria-busy='true']{cursor:progress}
.ds3-spin{flex:none;animation:ds3-spin .8s linear infinite}
.ds3-reassure{margin-top:10px;text-align:center;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted);text-wrap:pretty}
.ds3-error{margin-top:12px;padding:10px 12px;border-radius:10px;background:var(--danger-soft);color:var(--danger);font-size:.9375rem;line-height:1.4;font-weight:600;text-wrap:pretty}
.ds3-decline{margin-top:8px;text-align:center}
.ds3-decline a{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:4px 8px;border-radius:6px;font-size:.9375rem;font-weight:500;line-height:1.4;text-align:center;color:var(--muted);text-decoration:underline;text-decoration-color:oklch(from var(--muted) l c h / 0.5);text-underline-offset:.18em;text-wrap:pretty}
.ds3-decline a:hover{color:var(--ink);text-decoration-color:currentColor}
.ds3-decline a:focus-visible{outline:3px solid var(--field-focus, var(--accent));outline-offset:2px}
[data-ds3='pre'] .ds3-line.is-dropped{padding-block:12px}
[data-ds3='pre'] .ds3-line.is-kept{background:transparent}
[data-ds3='pre'] .is-dropped .ds3-badge{width:24px;height:24px;margin:0;background:var(--success)}
[data-ds3='pre'] .is-dropped .ds3-ico-check{opacity:1}
[data-ds3='pre'] .is-dropped .ds3-ico-minus{opacity:0}
[data-ds3='pre'] .is-dropped .ds3-strike{background-size:0% 1.5px}
[data-ds3='pre'] .is-dropped .ds3-name,[data-ds3='pre'] .is-dropped .ds3-price{font-size:1.0625rem;font-weight:700;color:var(--ink)}
[data-ds3='pre'] .is-dropped .ds3-price{font-weight:800}
[data-ds3='pre'] .is-dropped .ds3-fold{grid-template-rows:1fr;visibility:visible}
[data-ds3='pre'] .ds3-subfold{grid-template-rows:0fr;visibility:hidden}
[data-ds3='pre'] .ds3-was{opacity:0}
[data-ds3='pre'] .ds3-was::after{transform:rotate(-18deg) scaleX(0)}
[data-ds3='pre'] .ds3-out{max-width:1ch;opacity:1}
[data-ds3='pre'] .ds3-in{max-width:0;opacity:0}
[data-ds3='pre'] .ds3-swap-from{transform:none;opacity:1}
[data-ds3='pre'] .ds3-swap-to{transform:translateY(-100%);opacity:0}
[data-ds3='play'] .is-dropped .ds3-strike{transition:background-size .35s cubic-bezier(.2,.7,.2,1) var(--ds3-delay, 0s)}
[data-ds3='play'] .ds3-line.is-dropped,[data-ds3='play'] .is-dropped .ds3-name,[data-ds3='play'] .is-dropped .ds3-price{transition:padding .4s cubic-bezier(.2,.7,.2,1), font-size .4s cubic-bezier(.2,.7,.2,1), color .4s ease;transition-delay:calc(var(--ds3-delay, 0s) + .32s)}
[data-ds3='play'] .is-dropped .ds3-fold{transition:grid-template-rows .4s cubic-bezier(.2,.7,.2,1) calc(var(--ds3-delay, 0s) + .32s), visibility 0s linear calc(var(--ds3-delay, 0s) + .72s)}
[data-ds3='play'] .is-dropped .ds3-badge{transition:background-color .25s ease calc(var(--ds3-delay, 0s) + .12s), width .4s ease calc(var(--ds3-delay, 0s) + .32s), height .4s ease calc(var(--ds3-delay, 0s) + .32s), margin .4s ease calc(var(--ds3-delay, 0s) + .32s)}
[data-ds3='play'] .is-dropped .ds3-ico{transition:opacity .2s ease calc(var(--ds3-delay, 0s) + .12s)}
[data-ds3='play'] .ds3-line.is-kept{transition:background-color .4s ease .6s}
[data-ds3='play'] .ds3-subfold{transition:grid-template-rows .4s cubic-bezier(.2,.7,.2,1) .7s, visibility 0s linear .7s}
[data-ds3='play'] .ds3-col{transition:transform .75s cubic-bezier(.2,.7,.2,1) .55s}
[data-ds3='play'] .ds3-out,[data-ds3='play'] .ds3-in{transition:max-width .5s cubic-bezier(.2,.7,.2,1) .6s, opacity .3s ease .6s}
[data-ds3='play'] .ds3-swap>span{transition:transform .5s cubic-bezier(.2,.7,.2,1) .55s, opacity .3s ease .55s}
[data-ds3='play'] .ds3-was{transition:opacity .3s ease .95s}
[data-ds3='play'] .ds3-was::after{transition:transform .3s cubic-bezier(.2,.7,.2,1) 1.1s}
@media (max-width: 760px){
.ds3-wrap,.ds3-wrap.no-stage{grid-template-columns:minmax(0,1fr);grid-template-areas:'head' 'stage' 'points' 'receipt';grid-template-rows:none;row-gap:24px}
.ds3-wrap.no-stage{grid-template-areas:'head' 'points' 'receipt'}
.ds3-shot{aspect-ratio:auto;max-height:none}
.ds3-product{width:min(72%, 300px)}
.ds3-dock{position:sticky;bottom:0;z-index:3;margin-inline:calc(var(--ds3-pad) * -1);padding:12px var(--ds3-pad) calc(12px + env(safe-area-inset-bottom, 0px));background:var(--card);box-shadow:0 -10px 16px -12px oklch(from var(--ds3-shadow) l c h / 0.4)}
.ds3-btn{padding-inline:16px}
.ds3-total{padding:14px 16px}
}
@media (max-width: 380px){
.ds3-figs{gap:8px}
.ds3-sub{padding-left:12px}
}
@media (prefers-reduced-motion: reduce){
.ds3-head,.ds3-stage,.ds3-spin{animation:none}
.ds3-btn{transition:none}
.ds3-btn:active:not(:disabled),.ds3-btn.is-active{transform:none}
}
@keyframes ds3-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes ds3-spin{to{transform:rotate(360deg)}}
`
pieces/checkout/one-click-downsell-3/specimen.tsx 20 lines
import __studioImagec42bc0f8 from "../assets/982e30bac2a65853.webp";
import { OneClickDownsell3, type OneClickDownsell3State } from '../one-click-downsell-3'
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
export const states = ['default', 'hover', 'active', 'disabled', 'error']
export default function OneClickDownsell3Specimen({ state = 'default' }: { state?: OneClickDownsell3State }) {
return (
<OneClickDownsell3
state={state}
productImage={slot(
'product',
__studioImagec42bc0f8,
)}
productImageAlt='Trailhead hand coffee grinder in brushed steel with a walnut crank knob'
riskText={`If it isn’t the right grinder for you, send it back. You’re covered by our ${defaults.sample.guarantee}.`}
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalOneClickDownsell3 |
string |
Default 'No problem. Keep the grinder, skip the extras.'
|
highlight OptionalOneClickDownsell3 |
string |
Default 'Keep the grinder'
|
lead OptionalOneClickDownsell3 |
string |
Default 'We took the accessory pack off your bundle. Same Trailhead grinder, a smaller total, one click to add.'
|
points OptionalOneClickDownsell3 |
OneClickDownsell3Point[] |
Default DEFAULT_POINTS
|
productImage OptionalOneClickDownsell3 |
string |
|
productImageAlt OptionalOneClickDownsell3 |
string |
Default 'The Trailhead hand coffee grinder'
|
productCaption OptionalOneClickDownsell3 |
string |
Default 'The same Trailhead grinder, on its own.'
|
receiptTitle OptionalOneClickDownsell3 |
string |
Default 'Your bundle, trimmed to the grinder'
|
linesLabel OptionalOneClickDownsell3 |
string |
Default 'Your revised order'
|
lines OptionalOneClickDownsell3 |
OneClickDownsell3Line[] |
Default DEFAULT_LINES
|
keptLabel OptionalOneClickDownsell3 |
string |
Default 'kept in your order'
|
removedLabel OptionalOneClickDownsell3 |
string |
Default 'removed'
|
removedLine OptionalOneClickDownsell3 |
string |
Default 'Accessory pack removed'
|
removedAmount OptionalOneClickDownsell3 |
string |
Default '−$65'
|
bundleTotal OptionalOneClickDownsell3 |
string |
Default '$154'
|
bundleTotalLabel OptionalOneClickDownsell3 |
string |
Default 'Bundle price'
|
totalLabel OptionalOneClickDownsell3 |
string |
Default 'Just the grinder, today'
|
total OptionalOneClickDownsell3 |
string |
Default '$89'
|
totalNote OptionalOneClickDownsell3 |
string |
Default 'One payment · No subscription'
|
riskTitle OptionalOneClickDownsell3 |
string |
Default 'Try it for 30 days.'
|
riskText OptionalOneClickDownsell3 |
string |
Default 'If it isn’t the right grinder for you, send it back for a full refund.'
|
ctaLabel OptionalOneClickDownsell3 |
string |
Default 'Add the Grinder for $89'
|
loadingLabel OptionalOneClickDownsell3 |
string |
Default 'Adding the grinder…'
|
reassurance OptionalOneClickDownsell3 |
string |
Default 'One click · Added to the order you just placed'
|
errorMessage OptionalOneClickDownsell3 |
string |
Default 'We couldn’t add the grinder to your order. Please try again.'
|
declineLabel OptionalOneClickDownsell3 |
string |
Default 'No thanks, continue without the grinder'
|
declineHref OptionalOneClickDownsell3 |
string |
Default '#decline'
|
href OptionalOneClickDownsell3 |
string |
|
onAction OptionalOneClickDownsell3 |
() => void | Promise<void> |
|
onDecline OptionalOneClickDownsell3 |
() => void |
|
headingAs OptionalOneClickDownsell3 |
'h1' | 'h2' |
Default 'h2'
|
disabled OptionalOneClickDownsell3 |
boolean |
Default false
|
state OptionalOneClickDownsell3 |
OneClickDownsell3State |
Default 'default'
|
className OptionalOneClickDownsell3 |
string |
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-bg--button-2-ink- Secondary button.
--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--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).
-
982e30bac2a65853.webp
image/webp · 39.7 KB
-
a57ca5c86a05001f.webp
image/webp · 108 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB