Popup Modal 5
The framed downsell popup: the Classic tint header, then the struck anchor over the big green incremental price and its note, a green full-width yes button and the underlined decline.
Use it in a prompt
Use urgency/popup-modal-5 from the FunnelDNA library. Follow the skill and theme contract. Ask me for the copy, images, and brand details you need; do not invent proof.
Paste into Claude or ChatGPT with FunnelDNA connected (MCP setup), or alongside the skill.
Use it in code
- Save
component.tsx(Code tab) ascomponents/funneldna/urgency/popup-modal-5.tsx. - Import it and pass your copy and images (Props tab):
import { PopupModal5 } from "@/components/funneldna/urgency/popup-modal-5"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/urgency/popup-modal-5/component.tsx 791 lines
// layout: fact-scoreboard
// Downsell popup set as a scoreboard: the kit, today's price against the piece-by-piece cost, and the guarantee window.
// One action tile closes it with a ticked guarantee line, a big yes button and a quiet decline link, so a leaving visitor says yes in one tap.
"use client"
import * as React from "react"
import { AlertCircle, Check, Loader2, X } from "lucide-react"
export type PopupModal5State = "default" | "hover" | "active" | "disabled" | "error"
export type PopupModal5Item = {
name: string
/** Slot item-n: product photo shown in the thumbnail fan (first three with an image). */
image?: string
/** Alt text for the photo; falls back to the item name. */
imageAlt?: string
}
export type PopupModal5Props = {
/** "modal" opens a real dialog over the page. "inline" renders the same panel in flow, for previews and builders. */
display?: "modal" | "inline"
/** Controlled open state (modal only). */
open?: boolean
/** Initial open state when uncontrolled (modal only). */
defaultOpen?: boolean
/** Called whenever the popup asks to open or close (close button, Escape, backdrop, decline). */
onOpenChange?: (open: boolean) => void
/** The element that opens the popup, e.g. a button. Its own onClick is kept. */
trigger?: React.ReactElement<{ onClick?: React.MouseEventHandler }>
/** Wrap the key phrase in <mark> to get the marker stroke. */
headline?: React.ReactNode
/** Short line under the headline; also the dialog description. */
lead?: React.ReactNode
/** Name of the kit shown in the top tile. */
kitName?: React.ReactNode
/** Optional one-line description under the kit name. */
kitDetail?: React.ReactNode
/** What's in the kit, ticked in a list; the first three images form the thumbnail fan. */
items?: PopupModal5Item[]
/** Today's price, shown on split-flap tiles, e.g. "$47". */
price?: string
/** The supplied alternative's cost, e.g. "$97". */
alternativePrice?: string
/** Template: "{alternative}" is replaced by alternativePrice (shown bold). */
alternativeText?: string
/** Guarantee window as a number, e.g. "30". */
guaranteeDays?: string
/** Unit beside the guarantee number, e.g. "days". */
guaranteeUnit?: string
/** Line under the guarantee number. */
guaranteeText?: string
/** Text beside the confirmation tick box. */
commitLabel?: React.ReactNode
/** Shown when yes is pressed without the box ticked. */
commitError?: string
ctaLabel?: string
/** Optional small line inside the yes button, under its label. */
ctaSubline?: string
/** Button label while an onAction promise is pending. */
pendingLabel?: string
declineLabel?: string
/** Accessible label for the icon-only close button. */
closeLabel?: string
/** Where the yes button goes. */
href?: string
/** Called on yes. Return a promise to show the pending label until it settles. */
onAction?: () => void | Promise<void>
/** Called on the decline link (the modal also closes). */
onDecline?: () => void
disabled?: boolean
state?: PopupModal5State
className?: string
}
export function PopupModal5(props: PopupModal5Props) {
const {
display = "modal",
open,
defaultOpen = false,
onOpenChange,
trigger,
headline = DEFAULT_HEADLINE,
lead,
kitName,
kitDetail,
items = [],
price,
alternativePrice,
alternativeText = "vs. {alternative} bought piece by piece",
guaranteeDays,
guaranteeUnit = "days",
guaranteeText = "to ask for your money back",
commitLabel = "I understand I’m covered by the money-back guarantee.",
commitError = "Tick the box to confirm, then add it to your order.",
ctaLabel = "Yes, Add This To My Order",
ctaSubline,
pendingLabel = "Adding it to your order…",
declineLabel = "No thanks, I’ll pass on this offer",
closeLabel = "Close",
href,
onAction,
onDecline,
disabled = false,
state = "default",
className,
} = props
const isModal = display === "modal"
const uid = React.useId()
const titleId = `${uid}-title`
const leadId = `${uid}-lead`
const errId = `${uid}-err`
const [innerOpen, setInnerOpen] = React.useState(defaultOpen)
const isOpen = open ?? innerOpen
const setOpen = React.useCallback(
(next: boolean) => {
if (open === undefined) setInnerOpen(next)
onOpenChange?.(next)
},
[open, onOpenChange]
)
const [committed, setCommitted] = React.useState(state !== "error")
const [showError, setShowError] = React.useState(state === "error")
const [pending, setPending] = React.useState(false)
React.useEffect(() => {
setCommitted(state !== "error")
setShowError(state === "error")
}, [state])
const mounted = React.useRef(true)
React.useEffect(() => {
mounted.current = true
return () => {
mounted.current = false
}
}, [])
const panelRef = React.useRef<HTMLDivElement>(null)
const boxRef = React.useRef<HTMLInputElement>(null)
const inert = disabled || state === "disabled"
const errorOn = showError && !committed
React.useEffect(() => {
if (!isModal || !isOpen) return
const previous = document.activeElement as HTMLElement | null
const root = document.documentElement
const previousOverflow = root.style.overflow
root.style.overflow = "hidden"
panelRef.current?.focus()
return () => {
root.style.overflow = previousOverflow
previous?.focus?.()
}
}, [isModal, isOpen])
const onKeyDown = (event: React.KeyboardEvent) => {
if (event.key === "Escape") {
event.stopPropagation()
setOpen(false)
return
}
if (event.key !== "Tab" || !panelRef.current) return
const focusables = Array.from(
panelRef.current.querySelectorAll<HTMLElement>(
"a[href], button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex='-1'])"
)
)
if (!focusables.length) return
const first = focusables[0]
const last = focusables[focusables.length - 1]
const active = document.activeElement
if (event.shiftKey && (active === first || active === panelRef.current)) {
event.preventDefault()
last.focus()
} else if (!event.shiftKey && active === last) {
event.preventDefault()
first.focus()
}
}
const handleAction = (event: React.MouseEvent<HTMLElement>) => {
if (inert || pending) {
event.preventDefault()
return
}
if (!committed) {
event.preventDefault()
setShowError(true)
boxRef.current?.focus()
return
}
const result: unknown = onAction?.()
if (result && typeof (result as PromiseLike<void>).then === "function") {
setPending(true)
const done = () => {
if (mounted.current) setPending(false)
}
Promise.resolve(result as PromiseLike<void>).then(done, done)
}
}
const handleDecline = () => {
onDecline?.()
if (isModal) setOpen(false)
}
const handleClose = () => {
if (isModal) setOpen(false)
else onOpenChange?.(false)
}
const ctaClass = cx("cf-pm5__cta", state === "hover" && "is-hover", state === "active" && "is-active")
const ctaInner = pending ? (
<span className="cf-pm5__cta-main">
<Loader2 className="cf-pm5__spin" aria-hidden />
{pendingLabel}
</span>
) : (
<>
<span className="cf-pm5__cta-main">{ctaLabel}</span>
{ctaSubline && <span className="cf-pm5__cta-sub">{ctaSubline}</span>}
</>
)
const showKit = Boolean(kitName) || items.length > 0
const thumbs = items.filter((item) => item.image).slice(0, 3)
const panel = (
<div
ref={panelRef}
className={cx("cf-pm5__panel", isModal && "is-modal")}
role={isModal ? "dialog" : "region"}
aria-modal={isModal ? true : undefined}
aria-labelledby={titleId}
aria-describedby={lead ? leadId : undefined}
tabIndex={isModal ? -1 : undefined}
>
<button type="button" className="cf-pm5__close" aria-label={closeLabel} onClick={handleClose}>
<X aria-hidden />
</button>
<header className="cf-pm5__head">
<h2 id={titleId} className="cf-pm5__title">
{headline}
</h2>
{lead && (
<p id={leadId} className="cf-pm5__lead">
{lead}
</p>
)}
</header>
<div className="cf-pm5__board">
{showKit && (
<section className="cf-pm5__tile cf-pm5__kit" style={tileOrder(0)}>
{thumbs.length > 0 && (
<div className="cf-pm5__fan">
{thumbs.map((item) => (
<img
key={item.name}
className="cf-pm5__thumb"
src={item.image}
alt={item.imageAlt ?? item.name}
width={80}
height={80}
loading="eager"
/>
))}
</div>
)}
<div className="cf-pm5__kit-copy">
{kitName && <p className="cf-pm5__kit-name">{kitName}</p>}
{kitDetail && <p className="cf-pm5__kit-detail">{kitDetail}</p>}
{items.length > 0 && (
<ul className="cf-pm5__items">
{items.map((item) => (
<li key={item.name}>
<Check aria-hidden />
<span>{item.name}</span>
</li>
))}
</ul>
)}
</div>
</section>
)}
{price && (
<section className="cf-pm5__tile cf-pm5__score" style={tileOrder(1)}>
<Flaps value={price} />
{alternativePrice && (
<p className="cf-pm5__vs">{withValue(alternativeText, "alternative", alternativePrice)}</p>
)}
</section>
)}
{guaranteeDays && (
<section className="cf-pm5__tile cf-pm5__score" style={tileOrder(2)}>
<div className="cf-pm5__score-row">
<Flaps value={guaranteeDays} />
<span className="cf-pm5__unit">{guaranteeUnit}</span>
</div>
<p className="cf-pm5__gtee-text">{guaranteeText}</p>
</section>
)}
<div className="cf-pm5__tile cf-pm5__action" style={tileOrder(3)}>
<label className={cx("cf-pm5__commit", committed && "is-on", errorOn && "is-error")}>
<input
ref={boxRef}
type="checkbox"
className="cf-pm5__box"
checked={committed}
disabled={inert}
aria-invalid={errorOn || undefined}
aria-describedby={errorOn ? errId : undefined}
onChange={(event) => {
setCommitted(event.target.checked)
if (event.target.checked) setShowError(false)
}}
/>
<span className="cf-pm5__tick" aria-hidden>
<Check />
</span>
<span className="cf-pm5__commit-text">{commitLabel}</span>
</label>
{errorOn && (
<p id={errId} className="cf-pm5__error" role="alert">
<AlertCircle aria-hidden />
<span>{commitError}</span>
</p>
)}
{href ? (
<a
className={ctaClass}
href={inert ? undefined : href}
aria-disabled={inert || undefined}
aria-busy={pending || undefined}
onClick={handleAction}
>
{ctaInner}
</a>
) : (
<button
type="button"
className={ctaClass}
disabled={inert}
aria-busy={pending || undefined}
onClick={handleAction}
>
{ctaInner}
</button>
)}
<button type="button" className="cf-pm5__decline" onClick={handleDecline}>
{declineLabel}
</button>
</div>
</div>
</div>
)
const triggerNode =
isModal && trigger && React.isValidElement(trigger)
? React.cloneElement(trigger, {
onClick: (event: React.MouseEvent) => {
trigger.props.onClick?.(event)
if (!event.defaultPrevented) setOpen(true)
},
})
: null
return (
<div className={cx("cf-popup-modal-5", isModal ? "is-modal" : "is-inline", className)}>
<style>{CSS}</style>
{triggerNode}
{isModal ? (
isOpen ? (
<div
className="cf-pm5__overlay"
onKeyDown={onKeyDown}
onMouseDown={(event) => {
if (event.target === event.currentTarget) setOpen(false)
}}
>
{panel}
</div>
) : null
) : (
panel
)}
</div>
)
}
export default PopupModal5
const DEFAULT_HEADLINE = (
<>
Wait! Take <mark>this with you</mark> before you go
</>
)
/** Joins truthy class names with spaces. */
function cx(...parts: Array<string | false | null | undefined>): string {
return parts.filter(Boolean).join(" ")
}
/** Stagger index for a board tile's entrance (read by the CSS as --i). */
function tileOrder(index: number): React.CSSProperties {
return { "--i": index } as React.CSSProperties
}
/** Split-flap tiles for a short value; screen readers get the plain value. */
function Flaps({ value }: { value: string }) {
const chars = Array.from(value)
return (
<>
<span className="cf-pm5__sr">{value}</span>
<span className="cf-pm5__flaps" aria-hidden="true" style={{ "--n": chars.length } as React.CSSProperties}>
{chars.map((ch, i) => (
<span
key={i}
className={"0123456789".includes(ch) ? "cf-pm5__flap" : "cf-pm5__flap is-sym"}
style={{ "--d": Math.min(i, 4) } as React.CSSProperties}
>
<span>{ch}</span>
</span>
))}
</span>
</>
)
}
/** Replaces the named "{key}" placeholder in a template with a bold value. */
function withValue(template: string, key: string, value: React.ReactNode): React.ReactNode[] {
return template
.split(`{${key}}`)
.flatMap((part, i) => (i === 0 ? [part] : [<strong key={i}>{value}</strong>, part]))
}
// Theme notes: every colour below is a token or an OKLCH recipe on a token; hex appears only as the
// yellow marker default inside var(). The decline link is deliberately quiet (--muted, underlined) per the DR
// decline-link rule, so it never competes with the yes button; it only takes the theme's button radius for its
// focus ring. The close button is a quiet icon button whose hover reads the secondary-button tokens. The native
// checkbox is visually hidden behind the --field-styled tick and carries the field focus colour as accent-color.
// Every rule is scoped under .cf-popup-modal-5 (the overlay and panel always render inside the root).
const CSS = `
.cf-popup-modal-5 {
--cf-pm5-ink: var(--ink, oklch(0.21 0.034 263));
--cf-pm5-muted: var(--muted, oklch(0.446 0.03 258));
--cf-pm5-card: var(--card, oklch(1 0 0));
--cf-pm5-band: var(--band, oklch(0.273 0.067 256));
--cf-pm5-band-ink: var(--band-ink, oklch(1 0 0));
--cf-pm5-shadow: var(--shadow, oklch(0.22 0.03 256));
--cf-pm5-btn: var(--button-bg, var(--cta, oklch(0.576 0.209 29.5)));
--cf-pm5-btn-2: var(--button-bg-2, var(--cta-2, oklch(0.506 0.206 29.5)));
--cf-pm5-btn-ink: var(--button-ink, var(--cta-ink, oklch(1 0 0)));
--cf-pm5-focus: var(--field-focus, var(--accent, oklch(0.5 0.171 257)));
--cf-pm5-success: var(--success, oklch(0.5 0.138 150));
--cf-pm5-danger: var(--danger, oklch(0.5 0.17 27));
--cf-pm5-marker: color-mix(in oklch, var(--marker, #fae37c) 80%, transparent);
--cf-pm5-well: color-mix(in oklch, var(--cf-pm5-ink) 4%, var(--cf-pm5-card));
--cf-pm5-r: var(--radius, 12px);
font-family: var(--font-body, Arial, sans-serif);
color: var(--cf-pm5-ink);
}
.cf-popup-modal-5.is-modal { display: contents; }
.cf-popup-modal-5.is-inline { display: block; width: 100%; }
.cf-popup-modal-5 *, .cf-popup-modal-5 *::before, .cf-popup-modal-5 *::after { box-sizing: border-box; }
.cf-popup-modal-5 .cf-pm5__overlay {
position: fixed; inset: 0; z-index: 1000;
display: grid; place-items: center;
padding: 1rem; overflow-y: auto;
background: oklch(from var(--cf-pm5-band) l c h / 0.62);
-webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.cf-popup-modal-5 .cf-pm5__panel {
container: cf-pm5 / inline-size;
position: relative;
width: min(100%, 40rem);
margin-inline: auto;
padding: 2rem 2rem 1.75rem;
background: var(--cf-pm5-card);
color: var(--cf-pm5-ink);
border: 1px solid var(--card-border, color-mix(in oklch, var(--cf-pm5-ink) 12%, transparent));
border-radius: var(--card-radius, calc(var(--cf-pm5-r) + 6px));
box-shadow: var(--card-shadow, var(--shadow-lg, 0 2px 4px oklch(from var(--cf-pm5-shadow) l c h / 0.22), 0 14px 26px -10px oklch(from var(--cf-pm5-shadow) l c h / 0.36)));
}
.cf-popup-modal-5 .cf-pm5__panel.is-modal { max-height: calc(100dvh - 2rem); overflow-y: auto; overscroll-behavior: contain; }
.cf-popup-modal-5 .cf-pm5__panel:focus { outline: none; }
.cf-popup-modal-5 .cf-pm5__close {
position: absolute; top: .75rem; right: .75rem; z-index: 2;
width: 44px; height: 44px;
display: grid; place-items: center;
border: 0; border-radius: 999px;
background: transparent;
color: var(--cf-pm5-muted);
cursor: pointer;
transition: background-color .15s ease, color .15s ease;
}
.cf-popup-modal-5 .cf-pm5__close:hover {
background: var(--button-2-bg, color-mix(in oklch, var(--cf-pm5-ink) 7%, var(--cf-pm5-card)));
color: var(--button-2-ink, var(--cf-pm5-ink));
}
.cf-popup-modal-5 .cf-pm5__close:focus-visible { outline: 3px solid var(--cf-pm5-focus); outline-offset: 2px; }
.cf-popup-modal-5 .cf-pm5__close svg { width: 22px; height: 22px; stroke-width: 2.5; }
.cf-popup-modal-5 .cf-pm5__head { text-align: center; padding-inline: 2.75rem; }
.cf-popup-modal-5 .cf-pm5__title {
margin: 0;
font-family: var(--font-display, inherit);
font-weight: var(--display-weight, 800);
text-transform: var(--display-case, none);
letter-spacing: var(--display-tracking, -0.02em);
font-size: clamp(1.625rem, 6cqi, 2.375rem);
line-height: 1.08;
text-wrap: balance;
color: var(--cf-pm5-ink);
}
.cf-popup-modal-5 .cf-pm5__title mark {
color: inherit;
background: linear-gradient(transparent 50%, var(--cf-pm5-marker) 50%, var(--cf-pm5-marker) 94%, transparent 94%);
-webkit-box-decoration-break: clone; box-decoration-break: clone;
padding: 0 .12em; margin: 0 -.04em;
border-radius: .2em .4em .25em .35em;
}
.cf-popup-modal-5 .cf-pm5__lead {
margin: .75rem auto 0; max-width: 34rem;
color: var(--cf-pm5-muted);
font-size: 1.0625rem; font-weight: 500; line-height: 1.5;
text-wrap: pretty;
}
.cf-popup-modal-5 .cf-pm5__board {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: .75rem;
margin-top: 1.5rem;
}
.cf-popup-modal-5 .cf-pm5__tile {
position: relative; min-width: 0;
border-radius: calc(var(--cf-pm5-r) + 2px);
padding: 1.125rem 1.25rem 1.25rem;
}
.cf-popup-modal-5 .cf-pm5__kit {
grid-column: 1 / -1;
display: grid; grid-template-columns: auto minmax(0, 1fr);
gap: 1.25rem; align-items: start;
background: var(--cf-pm5-well);
border: 1px solid oklch(from var(--cf-pm5-ink) l c h / 0.07);
color: var(--cf-pm5-ink);
}
.cf-popup-modal-5 .cf-pm5__fan { position: relative; width: 9.5rem; height: 6.25rem; }
.cf-popup-modal-5 .cf-pm5__thumb {
position: absolute; top: .5rem;
width: 5rem; height: 5rem;
object-fit: cover; object-position: center;
border-radius: 10px;
border: 2px solid var(--cf-pm5-card);
background: var(--cf-pm5-card);
filter: drop-shadow(0 1px 2px oklch(from var(--cf-pm5-shadow) l c h / 0.3)) drop-shadow(0 5px 7px oklch(from var(--cf-pm5-shadow) l c h / 0.22));
transition: transform .28s cubic-bezier(.2,.8,.2,1);
}
.cf-popup-modal-5 .cf-pm5__thumb:nth-child(1) { left: 0; transform: rotate(-8deg); z-index: 1; }
.cf-popup-modal-5 .cf-pm5__thumb:nth-child(2) { left: 2.25rem; top: .2rem; transform: rotate(-1deg); z-index: 2; }
.cf-popup-modal-5 .cf-pm5__thumb:nth-child(3) { left: 4.5rem; transform: rotate(7deg); z-index: 3; }
.cf-popup-modal-5 .cf-pm5__kit:hover .cf-pm5__thumb:nth-child(1) { transform: rotate(-11deg) translate(-3px, 1px); }
.cf-popup-modal-5 .cf-pm5__kit:hover .cf-pm5__thumb:nth-child(2) { transform: rotate(-1deg) translateY(-4px); }
.cf-popup-modal-5 .cf-pm5__kit:hover .cf-pm5__thumb:nth-child(3) { transform: rotate(10deg) translate(3px, 1px); }
.cf-popup-modal-5 .cf-pm5__kit-name {
margin: 0;
font-family: var(--font-display, inherit);
font-weight: var(--display-weight, 800);
text-transform: var(--display-case, none);
font-size: 1.375rem; line-height: 1.15; letter-spacing: -0.01em;
text-wrap: balance;
}
.cf-popup-modal-5 .cf-pm5__kit-detail { margin: .375rem 0 0; color: var(--cf-pm5-muted); font-size: 1rem; line-height: 1.45; text-wrap: pretty; }
.cf-popup-modal-5 .cf-pm5__items { list-style: none; margin: .625rem 0 0; padding: 0; display: grid; gap: .3rem; }
.cf-popup-modal-5 .cf-pm5__items li { display: flex; align-items: flex-start; gap: .5rem; font-size: 1rem; font-weight: 600; line-height: 1.35; }
.cf-popup-modal-5 .cf-pm5__items svg { flex: none; width: 1.125rem; height: 1.125rem; margin-top: .1rem; stroke-width: 3; color: var(--cf-pm5-success); }
.cf-popup-modal-5 .cf-pm5__score {
container: cf-pm5-score / inline-size;
display: flex; flex-direction: column; gap: .7rem;
color: var(--cf-pm5-band-ink);
background: linear-gradient(oklch(from var(--cf-pm5-band) calc(l + 0.04) c h), var(--cf-pm5-band));
box-shadow: inset 0 1px 0 oklch(from var(--cf-pm5-band) calc(l + 0.14) c h / 0.5), inset 0 -2px 0 oklch(from var(--cf-pm5-shadow) l c h / 0.35);
}
.cf-popup-modal-5 .cf-pm5__flaps {
display: flex; gap: .08em;
font-family: var(--font-display, inherit);
font-weight: var(--display-weight, 800);
font-variant-numeric: tabular-nums;
font-size: clamp(1.75rem, calc(100cqi / (var(--n, 3) * 1.12 + 0.6)), 3.5rem);
line-height: 1;
}
.cf-popup-modal-5 .cf-pm5__flap {
position: relative;
display: grid; place-items: center;
min-width: .78em;
padding: .12em .1em .1em;
border-radius: .12em;
background: color-mix(in oklab, var(--cf-pm5-band) 80%, var(--cf-pm5-shadow));
color: var(--cf-pm5-band-ink);
box-shadow: inset 0 1px 0 oklch(from var(--cf-pm5-band) calc(l + 0.14) c h / 0.5), inset 0 -1px 0 oklch(from var(--cf-pm5-shadow) l c h / 0.5);
transform-origin: 50% 50%;
}
.cf-popup-modal-5 .cf-pm5__flap::after {
content: "";
position: absolute; left: 0; right: 0; top: 50%;
height: 1px;
background: oklch(from var(--cf-pm5-shadow) l c h / 0.55);
box-shadow: 0 1px 0 oklch(from var(--cf-pm5-band) calc(l + 0.1) c h / 0.25);
}
.cf-popup-modal-5 .cf-pm5__flap.is-sym > span { font-size: .6em; }
.cf-popup-modal-5 .cf-pm5__vs, .cf-popup-modal-5 .cf-pm5__gtee-text { margin: 0; font-size: 1rem; font-weight: 500; line-height: 1.4; text-wrap: pretty; }
.cf-popup-modal-5 .cf-pm5__vs strong { font-weight: 800; }
.cf-popup-modal-5 .cf-pm5__score-row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: .25rem .625rem; }
.cf-popup-modal-5 .cf-pm5__unit {
font-family: var(--font-display, inherit);
font-weight: var(--display-weight, 800);
font-size: 1.25rem; line-height: 1;
letter-spacing: .06em; text-transform: uppercase;
padding-bottom: .35rem;
}
.cf-popup-modal-5 .cf-pm5__action { grid-column: 1 / -1; display: grid; gap: .75rem; padding: .5rem 0 0; }
.cf-popup-modal-5 .cf-pm5__commit {
position: relative;
display: flex; align-items: flex-start; gap: .75rem;
padding: .8rem 1rem;
border-radius: var(--cf-pm5-r);
background: var(--cf-pm5-well);
border: 1px solid oklch(from var(--cf-pm5-ink) l c h / 0.1);
color: var(--cf-pm5-ink);
cursor: pointer;
font-size: 1rem; font-weight: 600; line-height: 1.4;
transition: background-color .2s ease, border-color .2s ease;
}
.cf-popup-modal-5 .cf-pm5__commit.is-on { background: var(--success-soft, color-mix(in oklch, var(--cf-pm5-success) 14%, var(--cf-pm5-card))); border-color: oklch(from var(--cf-pm5-success) l c h / 0.35); }
.cf-popup-modal-5 .cf-pm5__commit.is-error { background: var(--danger-soft, color-mix(in oklch, var(--cf-pm5-danger) 14%, var(--cf-pm5-card))); border-color: var(--cf-pm5-danger); }
.cf-popup-modal-5 .cf-pm5__commit-text { padding-top: .1rem; text-wrap: pretty; }
.cf-popup-modal-5 .cf-pm5__box {
position: absolute; left: 1rem; top: .8rem; width: 26px; height: 26px; margin: 0; opacity: 0; cursor: pointer;
accent-color: var(--cf-pm5-focus);
border-radius: var(--field-radius, 7px);
}
.cf-popup-modal-5 .cf-pm5__box:disabled { cursor: not-allowed; }
.cf-popup-modal-5 .cf-pm5__tick {
flex: none;
width: 26px; height: 26px;
display: grid; place-items: center;
border-radius: 7px;
background: var(--field, oklch(1 0 0));
border: 2px solid var(--field-border, color-mix(in oklch, var(--cf-pm5-ink) 30%, transparent));
color: transparent;
transition: background-color .15s ease, border-color .15s ease;
}
.cf-popup-modal-5 .cf-pm5__tick svg { width: 18px; height: 18px; stroke-width: 3.2; }
.cf-popup-modal-5 .cf-pm5__box:checked + .cf-pm5__tick { background: var(--cf-pm5-success); border-color: var(--cf-pm5-success); color: var(--cf-pm5-card); }
.cf-popup-modal-5 .cf-pm5__box:focus-visible + .cf-pm5__tick { outline: 3px solid var(--cf-pm5-focus); outline-offset: 2px; }
.cf-popup-modal-5 .cf-pm5__commit.is-error .cf-pm5__tick { border-color: var(--cf-pm5-danger); }
.cf-popup-modal-5 .cf-pm5__error {
display: flex; align-items: flex-start; gap: .5rem;
margin: -.25rem 0 0;
color: var(--cf-pm5-danger);
font-size: .9375rem; font-weight: 700; line-height: 1.35;
text-wrap: pretty;
}
.cf-popup-modal-5 .cf-pm5__error svg { flex: none; width: 1.1rem; height: 1.1rem; margin-top: .05rem; stroke-width: 2.5; }
.cf-popup-modal-5 .cf-pm5__cta {
position: relative; overflow: hidden; isolation: isolate;
display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem;
width: 100%; min-height: 4.25rem;
padding: .85rem 1.25rem .95rem;
border: 1px solid oklch(from var(--cf-pm5-btn) calc(l - 0.12) c h);
border-radius: var(--button-radius, var(--cf-pm5-r));
background: linear-gradient(oklch(from var(--cf-pm5-btn) calc(l + 0.05) c h), var(--cf-pm5-btn-2));
color: var(--cf-pm5-btn-ink);
font-family: var(--button-font, var(--font-display, inherit));
text-transform: var(--button-case, none);
text-shadow: var(--button-text-shadow, none);
text-align: center; text-decoration: none;
cursor: pointer;
box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--cf-pm5-btn) calc(l + 0.14) c h / 0.7), inset 0 -3px 0 oklch(from var(--cf-pm5-btn) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--cf-pm5-shadow) l c h / 0.3), 0 6px 12px -4px oklch(from var(--cf-pm5-shadow) l c h / 0.35));
transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
-webkit-tap-highlight-color: transparent;
}
.cf-popup-modal-5 .cf-pm5__cta::after {
content: "";
position: absolute; top: 0; bottom: 0; left: 0; z-index: -1;
width: 40%;
background: linear-gradient(90deg, transparent, oklch(from var(--cf-pm5-btn) calc(l + 0.3) c h / 0.35), transparent);
transform: translateX(-120%) skewX(-18deg);
pointer-events: none;
}
.cf-popup-modal-5 .cf-pm5__cta-main {
display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
font-weight: var(--button-weight, 800);
font-size: clamp(1.125rem, 4.6cqi, 1.375rem);
line-height: 1.15;
text-wrap: balance;
}
.cf-popup-modal-5 .cf-pm5__cta-sub { font-family: var(--font-body, inherit); font-weight: 600; font-size: .9375rem; line-height: 1.25; text-wrap: pretty; }
.cf-popup-modal-5 .cf-pm5__spin { width: 1.15em; height: 1.15em; flex: none; }
.cf-popup-modal-5 .cf-pm5__cta:hover:not([disabled]):not([aria-disabled="true"]), .cf-popup-modal-5 .cf-pm5__cta.is-hover {
background: linear-gradient(var(--cf-pm5-btn), oklch(from var(--cf-pm5-btn-2) calc(l - 0.05) c h));
transform: translateY(-1px);
}
.cf-popup-modal-5 .cf-pm5__cta:active:not([disabled]):not([aria-disabled="true"]), .cf-popup-modal-5 .cf-pm5__cta.is-active {
background: linear-gradient(oklch(from var(--cf-pm5-btn) calc(l - 0.06) c h), oklch(from var(--cf-pm5-btn-2) calc(l - 0.08) c h));
transform: translateY(1px);
box-shadow: inset 0 2px 3px oklch(from var(--cf-pm5-btn) calc(l - 0.2) c h / 0.6), inset 0 -1px 0 oklch(from var(--cf-pm5-btn) calc(l - 0.16) c h), 0 1px 1px oklch(from var(--cf-pm5-shadow) l c h / 0.3);
}
.cf-popup-modal-5 .cf-pm5__cta:focus-visible { outline: 3px solid var(--cf-pm5-focus); outline-offset: 3px; }
.cf-popup-modal-5 .cf-pm5__cta[disabled], .cf-popup-modal-5 .cf-pm5__cta[aria-disabled="true"] {
background: var(--button-2-bg, var(--secondary, oklch(0.93 0.015 263)));
color: var(--button-2-ink, var(--secondary-ink, oklch(0.21 0.034 263)));
border-color: oklch(from var(--secondary, oklch(0.93 0.015 263)) calc(l - 0.08) c h);
text-shadow: none;
box-shadow: var(--button-2-shadow, var(--shadow-sm));
cursor: not-allowed;
transform: none;
}
.cf-popup-modal-5 .cf-pm5__cta[disabled]::after, .cf-popup-modal-5 .cf-pm5__cta[aria-disabled="true"]::after { display: none; }
.cf-popup-modal-5 .cf-pm5__cta[aria-busy="true"] { cursor: progress; }
.cf-popup-modal-5 .cf-pm5__decline {
justify-self: center;
min-height: 44px; padding: .25rem .5rem;
border: 0; background: none;
color: var(--cf-pm5-muted);
font-family: var(--font-body, inherit);
font-size: 1rem; font-weight: 600; line-height: 1.3;
text-decoration: underline;
text-decoration-color: oklch(from var(--cf-pm5-muted) l c h / 0.45);
text-underline-offset: .18em;
text-wrap: pretty;
cursor: pointer;
border-radius: var(--button-radius, 6px);
}
.cf-popup-modal-5 .cf-pm5__decline:hover { color: var(--cf-pm5-ink); text-decoration-color: currentColor; }
.cf-popup-modal-5 .cf-pm5__decline:focus-visible { outline: 3px solid var(--cf-pm5-focus); outline-offset: 2px; }
.cf-popup-modal-5 .cf-pm5__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
@container cf-pm5 (max-width: 30rem) {
.cf-popup-modal-5 .cf-pm5__board { grid-template-columns: minmax(0, 1fr); }
.cf-popup-modal-5 .cf-pm5__kit { grid-template-columns: minmax(0, 1fr); gap: .5rem; }
.cf-popup-modal-5 .cf-pm5__head { padding-inline: 2.25rem; }
}
@media (max-width: 480px) {
.cf-popup-modal-5 .cf-pm5__overlay { padding: .625rem; }
.cf-popup-modal-5 .cf-pm5__panel { padding: 1.25rem 1.125rem 1.125rem; }
.cf-popup-modal-5 .cf-pm5__panel.is-modal { max-height: calc(100dvh - 1.25rem); }
.cf-popup-modal-5 .cf-pm5__close { top: .375rem; right: .375rem; }
.cf-popup-modal-5 .cf-pm5__tile { padding: 1rem 1rem 1.125rem; }
.cf-popup-modal-5 .cf-pm5__action { padding: .25rem 0 0; }
}
@keyframes cf-pm5-fade { from { opacity: 0; } }
@keyframes cf-pm5-pop { from { opacity: 0; transform: translateY(14px) scale(.975); } }
@keyframes cf-pm5-rise { from { opacity: .82; transform: translateY(8px); } }
@keyframes cf-pm5-flip { from { opacity: .5; transform: perspective(300px) rotateX(-80deg); } 60% { transform: perspective(300px) rotateX(12deg); } }
@keyframes cf-pm5-tick { 0% { transform: scale(.6); } 70% { transform: scale(1.12); } }
@keyframes cf-pm5-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes cf-pm5-sheen { from { transform: translateX(-120%) skewX(-18deg); } to { transform: translateX(280%) skewX(-18deg); } }
@keyframes cf-pm5-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: no-preference) {
.cf-popup-modal-5 .cf-pm5__overlay { animation: cf-pm5-fade .2s ease-out both; }
.cf-popup-modal-5 .cf-pm5__panel { animation: cf-pm5-pop .28s cubic-bezier(.2,.8,.2,1) both; }
.cf-popup-modal-5 .cf-pm5__tile { animation: cf-pm5-rise .42s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 70ms + 60ms); }
.cf-popup-modal-5 .cf-pm5__flap { animation: cf-pm5-flip .5s cubic-bezier(.3,1.4,.5,1) both; animation-delay: calc(var(--d, 0) * 80ms + 220ms); }
.cf-popup-modal-5 .cf-pm5__box:checked + .cf-pm5__tick svg { animation: cf-pm5-tick .28s ease-out; }
.cf-popup-modal-5 .cf-pm5__commit.is-error { animation: cf-pm5-shake .3s ease-in-out; }
.cf-popup-modal-5 .cf-pm5__cta::after { animation: cf-pm5-sheen 1.1s ease-in-out .8s 1 both; }
.cf-popup-modal-5 .cf-pm5__spin { animation: cf-pm5-spin .8s linear infinite; }
}
`
pieces/urgency/popup-modal-5/specimen.tsx 39 lines
import defaults from "../../studio-defaults.json"
import { slot } from "../../slots"
import { PopupModal5, type PopupModal5State } from "../popup-modal-5"
export const states = ["default", "hover", "active", "disabled", "error"]
const sample = defaults.sample
export default function PopupModal5Specimen({ state = "default" }: { state?: PopupModal5State }) {
const items = sample.items.map((item, i) => ({
name: item.name,
image: slot(`item-${i + 1}`, item.image),
imageAlt: item.imageAlt,
}))
return (
<PopupModal5
display="inline"
state={state}
headline={
<>
Wait! Take <mark>the whole kit</mark> with you
</>
}
lead={sample.lead}
kitName={sample.name}
items={items}
price={sample.price}
alternativePrice={sample.regularPrice}
alternativeText="vs. {alternative} for the three pieces bought one by one"
guaranteeDays="30"
commitLabel={`I understand I’m covered by the ${sample.guarantee}.`}
commitError="Tick the box to confirm, then add the kit to your order."
ctaLabel={`Yes, Add The Kit For ${sample.price}`}
ctaSubline={sample.note}
declineLabel="No thanks, I’ll plan my funnel without it"
/>
)
}
| Name | Type | Details |
|---|---|---|
display OptionalPopupModal5 |
"modal" | "inline" |
|
open OptionalPopupModal5 |
boolean |
|
defaultOpen OptionalPopupModal5 |
boolean |
|
onOpenChange OptionalPopupModal5 |
(open: boolean) => void |
|
trigger OptionalPopupModal5 |
React.ReactElement<{ onClick?: React.MouseEventHandler }> |
|
headline OptionalPopupModal5 |
React.ReactNode |
|
lead OptionalPopupModal5 |
React.ReactNode |
|
kitName OptionalPopupModal5 |
React.ReactNode |
|
kitDetail OptionalPopupModal5 |
React.ReactNode |
|
items OptionalPopupModal5 |
PopupModal5Item[] |
|
price OptionalPopupModal5 |
string |
|
alternativePrice OptionalPopupModal5 |
string |
|
alternativeText OptionalPopupModal5 |
string |
|
guaranteeDays OptionalPopupModal5 |
string |
|
guaranteeUnit OptionalPopupModal5 |
string |
|
guaranteeText OptionalPopupModal5 |
string |
|
commitLabel OptionalPopupModal5 |
React.ReactNode |
|
commitError OptionalPopupModal5 |
string |
|
ctaLabel OptionalPopupModal5 |
string |
|
ctaSubline OptionalPopupModal5 |
string |
|
pendingLabel OptionalPopupModal5 |
string |
|
declineLabel OptionalPopupModal5 |
string |
|
closeLabel OptionalPopupModal5 |
string |
|
href OptionalPopupModal5 |
string |
|
onAction OptionalPopupModal5 |
() => void | Promise<void> |
|
onDecline OptionalPopupModal5 |
() => void |
|
disabled OptionalPopupModal5 |
boolean |
|
state OptionalPopupModal5 |
PopupModal5State |
|
className OptionalPopupModal5 |
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--button-2-shadow- Secondary button.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field--field-border--field-focus--field-radius- Form inputs: background, ink, border, radius and focus colour.
--marker- The highlighter colour behind key phrases.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
item-*- One image per offer item (item-1, item-2…), shown in stacks and lists.
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB