Price Reveal 1
Anchor, reveal, reason-why — in that order. Struck anchors, saving badge, big today price and the line that makes the discount believable.
Use it in a prompt
Use offer/price-reveal 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/offer/price-reveal.tsx. - Import it and pass your copy and images (Props tab):
import { PriceReveal } from "@/components/funneldna/offer/price-reveal"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/price-reveal/component.tsx 443 lines
// Lists what the buyer gets and its supplied value, then reveals the price and the buy button.
"use client"
import * as React from "react"
import { AlertCircle, Check, Loader2, Lock, ShieldCheck, Tag } from "lucide-react"
export type PriceRevealProps = {
/** Generated labels; {name} is replaced with the product name as text. */
copy?: Partial<PriceRevealCopy>
/** Product name, shown in the ledger heading. */
name?: string
/** Line above the product name. */
stackHeading?: string
/** What they get. Each item shows its product photo, detail and value. */
items?: PriceRevealItem[]
/** Sum of the item values, struck. Supplied values only. */
totalValue?: string
totalLabel?: string
/** Word after each item value, e.g. "value" -> "$49 value". */
valueSuffix?: string
/** Extra struck anchors on the price side, e.g. ["$197"]. */
anchors?: Array<{ value: string } | string>
/** What they pay, pre-formatted. */
price: string
todayLabel?: string
/** Bold line under the price, e.g. "One payment · Lifetime access". */
note?: string
/** e.g. "or 3 payments of $39". Ignored while the split tab is active. */
cadence?: string
/** Why the price is what it is. Required on a paid page. */
reasonWhy?: React.ReactNode
/** e.g. "You save $50". Say the arithmetic of supplied prices only. */
savingBadge?: string
/** Free offer: the same layout, price reads e.g. "FREE". */
free?: boolean
fullPayLabel?: string
splitPay?: {
label: string
price: string
cadence: string
note?: string
}
/** Button label, one line. */
label?: string
/** One reassurance line under the button. */
sublabel?: string
/** Guarantee line, only if a real guarantee is supplied. */
guarantee?: string
reassurance?: Array<{ label: React.ReactNode } | string>
loadingLabel?: string
/** Deprecated: ignored. The builder wires what happens after the action. */
actionStatus?: string
errorMessage?: string
/** Checkout destination. With it the button is a link. */
href?: string
/** Your handler. Return a promise to show the loading label until it settles; return false (or throw) to show the error state. Nothing is sent by this component. */
onAction?: () => boolean | void | Promise<boolean | void>
disabled?: boolean
/** Forces a state for previews. */
state?: PriceRevealState
className?: string
}
export function PriceReveal({
copy: copyOverrides,
name,
stackHeading = "Here’s everything you get with",
items = [],
totalValue,
totalLabel = "Total value",
valueSuffix = "value",
anchors = [],
price,
todayLabel = "Your price today",
note,
cadence,
reasonWhy,
savingBadge,
free = false,
fullPayLabel = "One payment",
splitPay,
label = "Yes! Give Me Access",
sublabel,
guarantee,
reassurance = [],
loadingLabel = "Opening secure checkout…",
href,
errorMessage = "We couldn’t open checkout. Please try again.",
onAction,
disabled = false,
state = "default",
className,
}: PriceRevealProps) {
const copy = { ...DEFAULT_COPY, ...Object.fromEntries(Object.entries(copyOverrides ?? {}).filter(([, value]) => value !== undefined)) }
const rootRef = React.useRef<HTMLDivElement>(null)
const errId = React.useId()
const [phase, setPhase] = React.useState<"static" | "armed" | "play">("static")
const [plan, setPlan] = React.useState<"full" | "split">("full")
const [status, setStatus] = React.useState<Status>("idle")
const alive = React.useRef(true)
React.useEffect(() => {
alive.current = true
return () => {
alive.current = false
}
}, [])
// Content renders complete first. Only with motion allowed and the piece
// still offscreen is the strike/marker "armed", then drawn when it scrolls in.
React.useEffect(() => {
const el = rootRef.current
if (!el || typeof window === "undefined" || !("IntersectionObserver" in window)) return
if (window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return
let first = true
const io = new IntersectionObserver(
(entries) => {
const hit = entries.some((e) => e.isIntersecting)
if (hit) {
setPhase("play")
io.disconnect()
} else if (first) {
setPhase("armed")
}
first = false
},
{ threshold: 0.15 }
)
io.observe(el)
return () => io.disconnect()
}, [])
const forced: Status | null =
state === "error" ? "error" : state === "loading" ? "loading" : null
const shown: Status = forced ?? status
const isDisabled = disabled || state === "disabled"
const force = !isDisabled && (state === "hover" || state === "active") ? state : undefined
const split = !!splitPay && plan === "split"
const shownPrice = split && splitPay ? splitPay.price : price
const shownCadence = split && splitPay ? splitPay.cadence : cadence
const hasLedger = items.length > 0 || !!totalValue
const isLong = shownPrice.length > 4
const handleAction = async () => {
if (isDisabled || shown === "loading" || !onAction) return
try {
const pending = onAction()
if (pending instanceof Promise) setStatus("loading")
const ok = await pending
if (alive.current) setStatus(ok === false ? "error" : "idle")
} catch {
if (alive.current) setStatus("error")
}
}
return (
<div ref={rootRef} className={cx("cf-price-reveal fpr-wrap", className)} data-phase={phase}>
<style>{CSS}</style>
<section
className={cx("fpr", !hasLedger && "is-solo", free && "is-free")}
aria-label={name ? copy.priceFor.replace("{name}", () => name) : copy.priceLabel}
>
{hasLedger && (
<div className="fpr-left">
{(stackHeading || name) && (
<h2 className="fpr-h">
{stackHeading && <span className="fpr-h-pre">{stackHeading}</span>}
{name && <span className="fpr-h-name">“{name}”</span>}
</h2>
)}
{items.length > 0 && (
<ul className="fpr-items">
{items.map((item, i) => (
<li className="fpr-item" key={`${item.name}-${i}`}>
<div className="fpr-thumb">
<div className="fpr-thumb-frame">
{(item.itemImage ?? item.image) ? (
<img
src={item.itemImage ?? item.image}
alt={item.imageAlt ?? item.name}
width={80}
height={80}
loading="lazy"
decoding="async"
/>
) : null}
</div>
<span className="fpr-tick" aria-hidden="true">
<Check size={14} strokeWidth={3.25} />
</span>
</div>
<div className="fpr-body">
<div className="fpr-head">
<span className="fpr-name">{item.name}</span>
{item.value && (
<span className="fpr-val">
{item.value}
{valueSuffix && <span className="fpr-val-sfx"> {valueSuffix}</span>}
</span>
)}
</div>
{item.detail && <p className="fpr-detail">{item.detail}</p>}
</div>
</li>
))}
</ul>
)}
{totalValue && (
<div className="fpr-total">
<span className="fpr-total-label">{totalLabel}</span>
<s className="fpr-total-amt fpr-strike">{totalValue}</s>
</div>
)}
</div>
)}
<div className="fpr-right">
<p className="fpr-today">{todayLabel}</p>
{splitPay && (
<div className="fpr-toggle" role="group" aria-label={copy.paymentOptions}>
{([["full", fullPayLabel], ["split", splitPay.label]] as const).map(([key, text]) => (
<button key={key} type="button" aria-pressed={plan === key} onClick={() => setPlan(key)}>
{text}
</button>
))}
</div>
)}
{(anchors.length > 0 || savingBadge) && (
<div className="fpr-anchors">
{anchors.map((a) => (
<s key={typeof a === "string" ? a : a.value} className="fpr-anchor fpr-strike">
<span className="fpr-sr">{copy.regularPrice}</span>
{typeof a === "string" ? a : a.value}
</s>
))}
{savingBadge && (
<span className="fpr-save">
<Tag size={15} strokeWidth={2.5} aria-hidden="true" />
{savingBadge}
</span>
)}
</div>
)}
<p className={cx("fpr-price", isLong && "is-long")} aria-live={splitPay ? "polite" : undefined}>
<span className="fpr-mark">{shownPrice}</span>
</p>
{note && <p className="fpr-note">{note}</p>}
{shownCadence && <p className="fpr-cadence">{shownCadence}</p>}
{split && splitPay && splitPay.note && <p className="fpr-cadence">{splitPay.note}</p>}
{reasonWhy && <p className="fpr-reason">{reasonWhy}</p>}
<div className="fpr-act">
{href && !isDisabled && shown !== "loading" ? (
<a className="fpr-btn" href={href} data-force={force} onClick={() => void handleAction()}>
<span className="fpr-btn-spacer" aria-hidden="true" />
<span className="fpr-btn-label">{label}</span>
</a>
) : (
<button
type="button"
className="fpr-btn"
data-force={force}
disabled={isDisabled}
aria-busy={shown === "loading" || undefined}
aria-describedby={shown === "error" ? errId : undefined}
onClick={() => void handleAction()}
>
<span className="fpr-btn-spacer" aria-hidden="true" />
<span className="fpr-btn-label">{shown === "loading" ? loadingLabel : label}</span>
{shown === "loading" && <Loader2 className="fpr-btn-ico fpr-spin" aria-hidden="true" strokeWidth={2.75} />}
</button>
)}
{shown === "error" && (
<p className="fpr-alert" id={errId} role="alert">
<AlertCircle size={18} strokeWidth={2.5} aria-hidden="true" />
<span>{errorMessage}</span>
</p>
)}
</div>
{sublabel && (
<p className="fpr-sub">
<Lock size={15} strokeWidth={2.5} aria-hidden="true" />
<span>{sublabel}</span>
</p>
)}
{guarantee && (
<p className="fpr-guar">
<ShieldCheck size={20} strokeWidth={2.5} aria-hidden="true" />
<span>{guarantee}</span>
</p>
)}
{reassurance.length > 0 && (
<ul className="fpr-reass">
{reassurance.map((r, index) => (
<li key={index}>
<Check size={16} strokeWidth={3} aria-hidden="true" />
{typeof r === "string" ? r : r.label}
</li>
))}
</ul>
)}
</div>
</section>
</div>
)
}
export default PriceReveal
export type PriceRevealItem = {
name: string
detail?: string
value?: string
/** Canonical item artwork; image remains a legacy alias. */
itemImage?: string
image?: string
imageAlt?: string
}
export type PriceRevealState = "default" | "hover" | "active" | "disabled" | "loading" | "error" | "success"
type Status = "idle" | "loading" | "error"
const cx = (...c: Array<string | false | null | undefined>) => c.filter(Boolean).join(" ")
const DEFAULT_COPY = {
priceFor: "Price for {name}",
priceLabel: "Price",
paymentOptions: "Payment options",
regularPrice: "Regular price ",
}
type PriceRevealCopy = typeof DEFAULT_COPY
const CSS = `
.cf-price-reveal{--_r:var(--radius,1.25rem);--_panel:var(--card);--_marker:color-mix(in oklch,var(--marker,#fae37c) 25%,var(--card));--_price:var(--ink);--_good:var(--success-soft);--_good-ink:var(--success);--_strike:var(--danger);container:fpr/inline-size;width:100%;max-width:72rem;margin-inline:auto;color:var(--ink,#101828);font-family:var(--font-body,Arial,sans-serif);-webkit-font-smoothing:antialiased}
.cf-price-reveal *,.cf-price-reveal *::before,.cf-price-reveal *::after{box-sizing:border-box}
.cf-price-reveal .fpr-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.cf-price-reveal .fpr{position:relative;display:grid;grid-template-columns:minmax(0,1fr);background:var(--card,#fff);overflow:hidden;border:2px solid var(--card-border, oklch(from var(--ink) l c h / 0.92));border-radius:var(--card-radius, var(--radius));box-shadow:var(--card-shadow, var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)));}
.cf-price-reveal .fpr::after{content:"";position:absolute;inset:6px;border:1px solid oklch(from var(--ink,#101828) l c h / 0.09);border-radius:max(0px,calc(var(--_r) - 6px));pointer-events:none;z-index:3}
.cf-price-reveal .fpr.is-solo{max-width:34rem;margin-inline:auto}
@container fpr (min-width:760px){.cf-price-reveal .fpr{grid-template-columns:minmax(0,1.16fr) minmax(0,.84fr);border:2px solid var(--card-border, oklch(from var(--ink) l c h / 0.92));border-radius:var(--card-radius, var(--radius));box-shadow:var(--card-shadow, var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)));}.cf-price-reveal .fpr.is-solo{grid-template-columns:minmax(0,1fr)}}
.cf-price-reveal .fpr-left{container:ledger/inline-size;min-width:0;background:var(--card,#fff);padding:clamp(1.5rem,5.5cqi,3rem) clamp(1.25rem,5cqi,3rem) clamp(1.5rem,5cqi,2.75rem)}
.cf-price-reveal .fpr-h{margin:0;line-height:1.2;font-family:var(--font-display,Arial,sans-serif);color:var(--ink,#101828);text-wrap:balance}
.cf-price-reveal .fpr-h-pre{display:block;font-size:clamp(1.0625rem,3cqi,1.25rem);font-weight:700;line-height:1.3;color:var(--muted,#4a5565)}
.cf-price-reveal .fpr-h-name{display:block;margin-top:.3rem;font-size:clamp(1.75rem,6.2cqi,2.625rem);line-height:1.04;text-wrap:balance;font-weight:var(--display-weight,900);letter-spacing:var(--display-tracking,-.028em);text-transform:var(--display-case,none);}
.cf-price-reveal .fpr-items{list-style:none;margin:clamp(1.4rem,4cqi,1.9rem) 0 0;padding:0;display:grid;gap:1.25rem}
.cf-price-reveal .fpr-item{display:grid;grid-template-columns:4.25rem minmax(0,1fr);gap:1rem;align-items:start}
.cf-price-reveal .fpr-thumb{position:relative;width:100%;aspect-ratio:1/1;transition:transform .3s cubic-bezier(.2,.8,.2,1)}
.cf-price-reveal .fpr-thumb-frame{width:100%;height:100%;overflow:hidden;border-radius:.8rem;background:transparent;box-shadow:none;}
.cf-price-reveal .fpr-thumb img{display:block;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 2px 2px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.28));}
.cf-price-reveal .fpr-tick{position:absolute;top:-.4rem;left:-.4rem;display:grid;place-items:center;width:1.5rem;height:1.5rem;border-radius:999px;background:var(--success);color:var(--card);box-shadow:0 0 0 2.5px var(--card,#fff),var(--shadow-sm, 0 1px 1px oklch(0.22 0.03 260 / 0.18), 0 1px 3px oklch(0.22 0.03 260 / 0.14))}
.cf-price-reveal .fpr-body{min-width:0;padding-top:.1rem}
.cf-price-reveal .fpr-head{display:flex;flex-direction:column;gap:.2rem}
.cf-price-reveal .fpr-name{font-family:var(--font-display,Arial,sans-serif);font-size:1.125rem;font-weight:800;line-height:1.25;letter-spacing:-.01em;color:var(--ink,#101828);text-wrap:balance}
.cf-price-reveal .fpr-val{font-family:var(--font-display,Arial,sans-serif);font-size:1rem;font-weight:800;color:var(--accent,#0f5fc2);font-variant-numeric:tabular-nums;white-space:nowrap}
.cf-price-reveal .fpr-val-sfx{font-weight:700}
.cf-price-reveal .fpr-detail{margin:.35rem 0 0;font-size:1rem;line-height:1.5;color:var(--muted,#4a5565);text-wrap:pretty}
@container ledger (min-width:440px){
.cf-price-reveal .fpr-item{grid-template-columns:5rem minmax(0,1fr);gap:1.15rem}
.cf-price-reveal .fpr-head{flex-direction:row;align-items:baseline;gap:.6rem}
.cf-price-reveal .fpr-name{flex:1 1 auto;min-width:0;display:flex;align-items:baseline;gap:.6rem;font-size:1.1875rem}
.cf-price-reveal .fpr-name::after{content:"";flex:1 1 1.5rem;min-width:1.5rem;border-bottom:2px dotted oklch(from var(--ink,#101828) l c h / 0.3);transform:translateY(-.28em)}
.cf-price-reveal .fpr-val{font-size:1.0625rem}
}
.cf-price-reveal .fpr-total{margin-top:1.6rem;display:flex;align-items:baseline;justify-content:space-between;gap:.75rem;padding:1rem 1.25rem;background:color-mix(in oklch,var(--ink) 4%,var(--card));border-radius:var(--card-radius, var(--radius));box-shadow:none;}
.cf-price-reveal .fpr-total-label{display:flex;align-items:baseline;gap:.75rem;flex:1 1 auto;min-width:0;font-family:var(--font-display,Arial,sans-serif);font-size:clamp(1.25rem,4.4cqi,1.75rem);font-weight:900;line-height:1.1;letter-spacing:-.02em;color:var(--ink,#101828)}
@container ledger (min-width:440px){.cf-price-reveal .fpr-total-label::after{content:"";flex:1 1 1.5rem;min-width:1.5rem;border-bottom:2px dotted oklch(from var(--ink,#101828) l c h / 0.3);transform:translateY(-.3em)}}
.cf-price-reveal .fpr-total-amt{font-family:var(--font-display,Arial,sans-serif);font-size:clamp(1.5rem,5.4cqi,2.125rem);font-weight:900;line-height:1.1;color:var(--_strike);font-variant-numeric:tabular-nums;padding-inline:.08em}
.cf-price-reveal .fpr-strike{position:relative;display:inline-block;text-decoration:none}
.cf-price-reveal .fpr-strike::after{content:"";position:absolute;left:-.1em;right:-.1em;top:50%;height:.12em;min-height:3px;border-radius:999px;background:var(--_strike);transform:rotate(-8deg);transform-origin:left center}
.cf-price-reveal .fpr-right{position:relative;container:panel/inline-size;min-width:0;display:flex;flex-direction:column;align-items:center;text-align:center;background:var(--_panel);padding:clamp(1.75rem,5cqi,2.5rem) clamp(1.25rem,5cqi,2.75rem)}
@container fpr (min-width:760px){.cf-price-reveal .fpr-right{padding:clamp(2.25rem,4.2cqi,3.25rem) clamp(1.5rem,3.4cqi,2.75rem)}}
.cf-price-reveal .fpr-today{margin:0;font-family:var(--font-display,Arial,sans-serif);font-size:clamp(1.25rem,6.2cqi,1.625rem);line-height:1.15;color:var(--ink,#101828);text-wrap:balance;font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-.015em);text-transform:var(--display-case,none);}
.cf-price-reveal .fpr-toggle{margin-top:.9rem;display:inline-flex;padding:.25rem;border-radius:999px;background:var(--card,#fff);box-shadow:inset 0 0 0 1px oklch(from var(--ink,#101828) l c h / 0.16),var(--shadow-sm, 0 1px 1px oklch(0.22 0.03 260 / 0.18), 0 1px 3px oklch(0.22 0.03 260 / 0.14))}
.cf-price-reveal .fpr-toggle button{appearance:none;min-height:2.75rem;padding:.4rem 1.1rem;border:0;font-family:var(--font-body,Arial,sans-serif);font-size:.9375rem;font-weight:700;white-space:nowrap;cursor:pointer;transition:background-color .15s ease,color .15s ease;background:var(--button-2-bg, var(--card));color:var(--button-2-ink, var(--ink));border-radius:var(--button-radius, var(--radius));}
.cf-price-reveal .fpr-toggle button:hover:not([aria-pressed="true"]){color:var(--ink,#101828);background:color-mix(in oklch,var(--ink,#101828) 6%,var(--card,#fff))}
.cf-price-reveal .fpr-toggle button[aria-pressed="true"]{background:var(--band);color:var(--band-ink);}
.cf-price-reveal .fpr-toggle button:focus-visible{outline:3px solid var(--accent,#0f5fc2);outline-offset:2px}
.cf-price-reveal .fpr-anchors{margin-top:.9rem;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:.5rem .75rem}
.cf-price-reveal .fpr-anchor{font-family:var(--font-display,Arial,sans-serif);font-size:1.25rem;font-weight:800;color:var(--muted,#4a5565);font-variant-numeric:tabular-nums}
.cf-price-reveal .fpr-save{display:inline-flex;align-items:center;gap:.4rem;padding:.4rem .9rem;border-radius:999px;color:var(--_good-ink);font-size:.9375rem;font-weight:800;line-height:1.2;white-space:nowrap;background:var(--success-soft);box-shadow:inset 0 0 0 1px oklch(from var(--ink) l c h / 0.12);}
.cf-price-reveal .fpr-price{margin:.55rem 0 0;font-family:var(--font-display,Arial,sans-serif);font-size:clamp(4rem,30cqi,7rem);line-height:1;color:var(--_price);font-variant-numeric:tabular-nums;font-weight:var(--display-weight,900);letter-spacing:var(--display-tracking,-.045em);text-transform:var(--display-case,none);}
.cf-price-reveal .fpr-price.is-long{font-size:clamp(2.75rem,17cqi,5rem)}
.cf-price-reveal .fpr-mark{position:relative;display:inline-block;padding:0 .14em;isolation:isolate}
.cf-price-reveal .fpr-mark::before{content:"";position:absolute;z-index:-1;left:-.02em;right:-.06em;top:.34em;bottom:.02em;background:var(--_marker);opacity:.95;border-radius:.18em .42em .22em .5em / .45em .2em .5em .25em;transform:rotate(-2deg) skewX(-8deg);transform-origin:left center}
.cf-price-reveal .fpr-note{margin:.9rem 0 0;font-family:var(--font-display,Arial,sans-serif);font-size:1.125rem;font-weight:800;line-height:1.3;color:var(--ink,#101828);text-wrap:balance}
.cf-price-reveal .fpr-cadence{margin:.35rem 0 0;font-size:1rem;font-weight:600;line-height:1.45;color:var(--muted,#4a5565);text-wrap:pretty}
.cf-price-reveal .fpr-reason{margin:.55rem 0 0;max-width:34ch;font-size:1rem;line-height:1.55;color:var(--muted,#4a5565);text-wrap:pretty}
.cf-price-reveal .fpr-act{width:100%;max-width:26rem;margin-top:1.5rem}
.cf-price-reveal .fpr-btn{appearance:none;text-decoration:none;width:100%;min-height:4rem;display:flex;align-items:center;justify-content:center;gap:.5rem;padding:.85rem .75rem;letter-spacing:-.01em;text-shadow:var(--button-text-shadow, 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.2) c h / 0.75));cursor:pointer;-webkit-tap-highlight-color:transparent;border:1px solid var(--button-bg-2, var(--cta-2));border-radius:var(--button-radius, var(--radius));background:linear-gradient(180deg,var(--button-bg,var(--cta)),var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h)));color:var(--button-ink, var(--cta-ink));font:var(--button-weight,800) clamp(1.0625rem,4.4cqi,1.3125rem)/1.15 var(--button-font, var(--font-display));text-transform:var(--button-case, none);box-shadow:var(--button-shadow, inset 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l + 0.12) c h / 0.5),inset 0 -3px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.16) c h),var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)));}
.cf-price-reveal .fpr-btn-spacer{display:none}
.cf-price-reveal .fpr-btn-label{text-align:center;text-wrap:balance}
.cf-price-reveal .fpr-btn-ico{flex:none;width:1.25rem;height:1.25rem}
@container panel (min-width:400px){.cf-price-reveal .fpr-btn{display:grid;grid-template-columns:1.25rem minmax(0,1fr) 1.25rem;gap:.6rem;padding:.85rem 1rem}.cf-price-reveal .fpr-btn-spacer{display:block;width:1.25rem;height:1px}}
.cf-price-reveal .fpr-btn:hover:not(:disabled),.cf-price-reveal .fpr-btn[data-force="hover"]{filter:none;box-shadow:var(--button-shadow, inset 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l + 0.12) c h / 0.5),inset 0 -3px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.16) c h),var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)));}
.cf-price-reveal .fpr-btn:active:not(:disabled),.cf-price-reveal .fpr-btn[data-force="active"]{filter:none;box-shadow:var(--button-shadow, inset 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l + 0.12) c h / 0.5),inset 0 -3px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.16) c h),var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)));}
.cf-price-reveal .fpr-btn:focus-visible{outline:3px solid var(--accent,#0f5fc2);outline-offset:3px}
.cf-price-reveal .fpr-btn:disabled{cursor:not-allowed;text-shadow:none;filter:none;background:var(--button-2-bg, var(--card));color:var(--button-2-ink, var(--ink));border-color:var(--button-2-border, oklch(from var(--ink) l c h / 0.22));box-shadow:var(--button-shadow, none);}
.cf-price-reveal .fpr-btn[aria-busy="true"]{cursor:progress}
.cf-price-reveal .fpr-alert{margin:.85rem 0 0;display:flex;align-items:flex-start;gap:.6rem;padding:.85rem 1rem;font-size:.9375rem;font-weight:600;line-height:1.4;text-align:left;text-wrap:pretty;background:var(--card);color:var(--ink);border-radius:var(--card-radius, var(--radius));box-shadow:inset 0 0 0 1px var(--card-border, oklch(from var(--ink) l c h / 0.22));}
.cf-price-reveal .fpr-alert svg{flex:none;margin-top:.05rem}
.cf-price-reveal .fpr-sub{margin:.8rem 0 0;display:flex;align-items:center;justify-content:center;gap:.45rem;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--muted,#4a5565);text-wrap:pretty}
.cf-price-reveal .fpr-sub svg{flex:none}
.cf-price-reveal .fpr-guar{margin:1rem 0 0;display:inline-flex;align-items:center;gap:.55rem;padding:.6rem 1.05rem;border-radius:999px;background:var(--card,#fff);color:var(--ink,#101828);font-size:.9375rem;font-weight:800;line-height:1.3;text-align:left;box-shadow:inset 0 0 0 1px oklch(from var(--_good) l c h / 0.28),var(--shadow-sm, 0 1px 1px oklch(0.22 0.03 260 / 0.18), 0 1px 3px oklch(0.22 0.03 260 / 0.14))}
.cf-price-reveal .fpr-guar svg{flex:none;color:var(--_good)}
.cf-price-reveal .fpr-reass{list-style:none;margin:.75rem 0 0;padding:0;display:flex;flex-wrap:wrap;justify-content:center;gap:.4rem 1rem;font-size:.9375rem;font-weight:600;color:var(--ink,#101828)}
.cf-price-reveal .fpr-reass li{display:inline-flex;align-items:center;gap:.35rem}
.cf-price-reveal .fpr-reass svg{color:var(--_good)}
@keyframes fpr-strike{from{transform:rotate(-8deg) scaleX(0)}to{transform:rotate(-8deg) scaleX(1)}}
@keyframes fpr-marker{from{transform:rotate(-2deg) skewX(-8deg) scaleX(0)}to{transform:rotate(-2deg) skewX(-8deg) scaleX(1)}}
@keyframes fpr-rise{from{opacity:.82;transform:translateY(8px) scale(.97)}to{opacity:1;transform:none}}
@keyframes fpr-spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:no-preference){
.cf-price-reveal[data-phase="armed"] .fpr-strike::after{transform:rotate(-8deg) scaleX(0)}
.cf-price-reveal[data-phase="armed"] .fpr-mark::before{transform:rotate(-2deg) skewX(-8deg) scaleX(0)}
.cf-price-reveal[data-phase="play"] .fpr-strike::after{animation:fpr-strike .5s cubic-bezier(.2,.8,.2,1) .15s both}
.cf-price-reveal[data-phase="play"] .fpr-price{animation:fpr-rise .45s cubic-bezier(.2,.8,.2,1) .4s both;font-weight:var(--display-weight,900);letter-spacing:var(--display-tracking,-.045em);text-transform:var(--display-case,none);}
.cf-price-reveal[data-phase="play"] .fpr-mark::before{animation:fpr-marker .45s cubic-bezier(.3,.7,.2,1) .55s both}
.cf-price-reveal .fpr-spin{animation:fpr-spin .9s linear infinite}
.cf-price-reveal .fpr-btn{transition:transform .16s ease,box-shadow .16s ease,filter .16s ease;border:1px solid var(--button-bg-2, var(--cta-2));border-radius:var(--button-radius, var(--radius));background:linear-gradient(180deg,var(--button-bg,var(--cta)),var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h)));color:var(--button-ink, var(--cta-ink));font:var(--button-weight,800) clamp(1.0625rem,4.4cqi,1.3125rem)/1.15 var(--button-font, var(--font-display));text-transform:var(--button-case, none);box-shadow:var(--button-shadow, inset 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l + 0.12) c h / 0.5),inset 0 -3px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.16) c h),var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)));}
.cf-price-reveal .fpr-btn:hover:not(:disabled),.cf-price-reveal .fpr-btn[data-force="hover"]{transform:translateY(-2px)}
.cf-price-reveal .fpr-btn:active:not(:disabled),.cf-price-reveal .fpr-btn[data-force="active"]{transform:translateY(2px)}
}
@media (hover:hover) and (prefers-reduced-motion:no-preference){.cf-price-reveal .fpr-item:hover .fpr-thumb{transform:translateY(-3px) rotate(-3deg)}}
`
pieces/offer/price-reveal/specimen.tsx 31 lines
import { slot } from "../../slots"
import defaults from "../../studio-defaults.json"
import { PriceReveal, type PriceRevealState } from "../price-reveal"
export const states = ["default", "hover", "active", "disabled", "loading", "error"]
const money = (v: string) => Number(v.replace(/[^0-9.]/g, ""))
export default function PriceRevealSpecimen({ state = "default" }: { state?: string }) {
const s = defaults.sample
const saved = money(s.regularPrice) - money(s.price)
return (
<div>
<PriceReveal
name={s.name}
items={s.items.map((item, i) => ({ ...item, itemImage: slot(`item-${i + 1}`, item.image) }))}
totalValue={s.regularPrice}
todayLabel={s.todayLabel}
price={s.price}
savingBadge={saved > 0 ? `You save $${saved}` : undefined}
note={s.note}
reasonWhy={s.reason}
label={s.label}
sublabel={s.sublabel}
guarantee={s.guarantee}
state={state as PriceRevealState}
/>
</div>
)
}
| Name | Type | Details |
|---|---|---|
copy OptionalPriceReveal |
Partial<PriceRevealCopy> |
|
name OptionalPriceReveal |
string |
|
stackHeading OptionalPriceReveal |
string |
Default "Here’s everything you get with"
|
items OptionalPriceReveal |
PriceRevealItem[] |
Default []
|
totalValue OptionalPriceReveal |
string |
|
totalLabel OptionalPriceReveal |
string |
Default "Total value"
|
valueSuffix OptionalPriceReveal |
string |
Default "value"
|
anchors OptionalPriceReveal |
Array<{ value: string } | string> |
Default []
|
price RequiredPriceReveal |
string |
|
todayLabel OptionalPriceReveal |
string |
Default "Your price today"
|
note OptionalPriceReveal |
string |
|
cadence OptionalPriceReveal |
string |
|
reasonWhy OptionalPriceReveal |
React.ReactNode |
|
savingBadge OptionalPriceReveal |
string |
|
free OptionalPriceReveal |
boolean |
Default false
|
fullPayLabel OptionalPriceReveal |
string |
Default "One payment"
|
splitPay OptionalPriceReveal |
{
label: string
price: string
cadence: string
note?: string
} |
|
label OptionalPriceReveal |
string |
Default "Yes! Give Me Access"
|
sublabel OptionalPriceReveal |
string |
|
guarantee OptionalPriceReveal |
string |
|
reassurance OptionalPriceReveal |
Array<{ label: React.ReactNode } | string> |
Default []
|
loadingLabel OptionalPriceReveal |
string |
Default "Opening secure checkout…"
|
actionStatus OptionalPriceReveal |
string |
|
errorMessage OptionalPriceReveal |
string |
Default "We couldn’t open checkout. Please try again."
|
href OptionalPriceReveal |
string |
|
onAction OptionalPriceReveal |
() => boolean | void | Promise<boolean | void> |
|
disabled OptionalPriceReveal |
boolean |
Default false
|
state OptionalPriceReveal |
PriceRevealState |
Default "default"
|
className OptionalPriceReveal |
string |
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-bg--button-2-border--button-2-ink- 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.
--marker- The highlighter colour behind key phrases.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
item-*- One image per offer item (item-1, item-2…), shown in stacks and lists.
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB