Popup Modal 2
The two-column opt-in popup: a cream tint panel with the product mockup beside the headline, description and a single email field over the submit button with the privacy line.
Use it in a prompt
Use urgency/popup-modal-2 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-2.tsx. - Import it and pass your copy and images (Props tab):
import { PopupModal2 } from "@/components/funneldna/urgency/popup-modal-2"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/urgency/popup-modal-2/component.tsx 665 lines
// layout: spotlight-row
"use client"
/**
* Popup Modal 2: a "Dear friend" kit popup. The kit sits in a row under the headline and a short signed letter sits
* beside one email field and the Add To Cart button, so the visitor sees what they get before they click.
*/
import * as React from "react"
import { AlertCircle, Loader2, Lock, Mail, ShoppingCart, X } from "lucide-react"
export type PopupModal2Item = {
name: string
/** Stated value, e.g. "$49"; shown through copy.itemValue. */
value?: string
/** Item photo (slot item-n). */
image?: string
/** Alt text for the item photo; falls back to the item name. */
imageAlt?: string
}
export type PopupModal2Copy = {
emailLabel: string
emailPlaceholder: string
/** Privacy line under the email field; empty hides it. */
privacy: string
actionLabel: string
/** Button text while onSubmit is pending. */
pendingLabel: string
/** One short line under the button; empty hides it. */
reassurance: string
/** Quiet decline link; empty hides it. */
declineLabel: string
/** Accessible label of the icon-only close button. */
closeLabel: string
/** Error when the email field is empty. */
errorRequired: string
/** Error when the email is not valid (also shown by state="error"). */
errorInvalid: string
/** Template for an item's value line; "{value}" is replaced with the item's value. */
itemValue: string
/** Accessible label of the item list. */
itemsLabel: string
/** Letter opening; empty hides it. */
salutation: string
/** Line above the signature; empty hides it. */
signOff: string
}
export type PopupModal2Props = {
headline?: React.ReactNode
/** Phrase inside a string headline that gets the marker stroke. */
highlight?: string
/** Letter paragraphs between the salutation and the sign-off. */
paragraphs?: React.ReactNode[]
/** Name signed under the letter; empty hides the sign-off. */
signer?: string
/** Today's price, shown on the button; empty hides it. */
price?: string
/** Items in the kit, shown in a row under the headline. */
items?: PopupModal2Item[]
/** Show the cart icon on the button. */
cartIcon?: boolean
/** Visible words and accessible labels; merged over the approved defaults. */
copy?: Partial<PopupModal2Copy>
/** Render the panel in the page flow (previews, embeds) instead of as a modal. */
inline?: boolean
/** Controlled open state (modal only). */
open?: boolean
/** Initial open state when uncontrolled. */
defaultOpen?: boolean
onOpenChange?: (open: boolean) => void
/** Element that opens the modal on click. */
trigger?: React.ReactNode
/** Receives the validated email; the builder wires what happens next. */
onSubmit?: (email: string) => void | Promise<void>
/** Called when the decline link is clicked, before the popup closes. */
onDecline?: () => void
disabled?: boolean
state?: "default" | "hover" | "active" | "disabled" | "error"
className?: string
}
export function PopupModal2(props: PopupModal2Props) {
const {
headline = "Build your first funnel with a clear plan",
highlight = "a clear plan",
paragraphs = DEFAULT_PARAGRAPHS,
signer = "",
price = "",
items = [],
cartIcon = true,
copy: copyProp,
inline = false,
open,
defaultOpen = false,
onOpenChange,
trigger,
onSubmit,
onDecline,
disabled = false,
state = "default",
className,
} = props
const copy: PopupModal2Copy = { ...DEFAULT_COPY, ...copyProp }
const uid = React.useId()
const titleId = `${uid}-title`
const letterId = `${uid}-letter`
const emailId = `${uid}-email`
const hintId = `${uid}-hint`
const errorId = `${uid}-error`
const [internalOpen, setInternalOpen] = React.useState(defaultOpen)
const [email, setEmail] = React.useState("")
const [error, setError] = React.useState<string | null>(null)
const [pending, setPending] = React.useState(false)
const panelRef = React.useRef<HTMLDivElement>(null)
const inputRef = React.useRef<HTMLInputElement>(null)
const mounted = React.useRef(true)
const closeRef = React.useRef<() => void>(() => {})
const isOpen = inline || (open ?? internalOpen)
const setOpen = (next: boolean) => {
if (open === undefined) setInternalOpen(next)
onOpenChange?.(next)
}
React.useEffect(() => {
closeRef.current = () => setOpen(false)
})
React.useEffect(() => {
mounted.current = true
return () => {
mounted.current = false
}
}, [])
React.useEffect(() => {
if (inline || !isOpen) return
const previous = document.activeElement instanceof HTMLElement ? document.activeElement : null
const root = document.documentElement
const overflow = root.style.overflow
root.style.overflow = "hidden"
const frame = window.requestAnimationFrame(() => inputRef.current?.focus())
const onKey = (event: KeyboardEvent) => {
if (event.key === "Escape") {
event.preventDefault()
closeRef.current()
return
}
if (event.key !== "Tab" || !panelRef.current) return
const focusable = Array.from(
panelRef.current.querySelectorAll<HTMLElement>("button:not([disabled]), input:not([disabled]), a[href]"),
)
if (focusable.length === 0) return
const first = focusable[0]
const last = focusable[focusable.length - 1]
if (event.shiftKey && document.activeElement === first) {
event.preventDefault()
last.focus()
} else if (!event.shiftKey && document.activeElement === last) {
event.preventDefault()
first.focus()
}
}
document.addEventListener("keydown", onKey)
return () => {
window.cancelAnimationFrame(frame)
document.removeEventListener("keydown", onKey)
root.style.overflow = overflow
previous?.focus()
}
}, [inline, isOpen])
const isDisabled = disabled || state === "disabled"
const shownError = state === "error" ? copy.errorInvalid : error
const force = state === "hover" || state === "active" ? state : undefined
const describedBy = [shownError ? errorId : "", copy.privacy ? hintId : ""].filter(Boolean).join(" ") || undefined
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault()
if (isDisabled || pending) return
const value = email.trim()
if (!value) {
setError(copy.errorRequired)
inputRef.current?.focus()
return
}
if (!isEmail(value)) {
setError(copy.errorInvalid)
inputRef.current?.focus()
return
}
setError(null)
if (!onSubmit) return
setPending(true)
try {
await onSubmit(value)
} finally {
if (mounted.current) setPending(false)
}
}
const panel = (
<div
ref={panelRef}
className="cf-popup-modal-2__panel"
role={inline ? "region" : "dialog"}
aria-modal={inline ? undefined : true}
aria-labelledby={titleId}
aria-describedby={letterId}
>
<button
type="button"
className="cf-popup-modal-2__close"
aria-label={copy.closeLabel}
onClick={() => setOpen(false)}
>
<X aria-hidden strokeWidth={2.5} />
</button>
<div className="cf-popup-modal-2__body">
<h2 id={titleId} className="cf-popup-modal-2__headline">
{renderHeadline(headline, highlight)}
</h2>
{items.length > 0 && (
<ul className="cf-popup-modal-2__items" aria-label={copy.itemsLabel}>
{items.map((item, index) => (
<li className="cf-popup-modal-2__item" key={`${item.name}-${index}`}>
{item.image && (
<img
className="cf-popup-modal-2__thumb"
src={item.image}
alt={item.imageAlt ?? item.name}
width={112}
height={112}
loading="lazy"
/>
)}
<span className="cf-popup-modal-2__item-text">
<span className="cf-popup-modal-2__item-name">{item.name}</span>
{item.value && (
<span className="cf-popup-modal-2__item-value">{fill(copy.itemValue, { value: item.value })}</span>
)}
</span>
</li>
))}
</ul>
)}
<div id={letterId} className="cf-popup-modal-2__letter">
{copy.salutation && <p className="cf-popup-modal-2__salutation">{copy.salutation}</p>}
{paragraphs.map((paragraph, index) => (
<p key={index}>{paragraph}</p>
))}
{signer && (
<div className="cf-popup-modal-2__sign">
{copy.signOff && <p className="cf-popup-modal-2__signoff">{copy.signOff}</p>}
<p className="cf-popup-modal-2__signature">{signer}</p>
</div>
)}
</div>
<form className="cf-popup-modal-2__form" noValidate onSubmit={handleSubmit}>
<label htmlFor={emailId} className="cf-popup-modal-2__label">
{copy.emailLabel}
</label>
<div className="cf-popup-modal-2__field">
<Mail aria-hidden className="cf-popup-modal-2__field-icon" />
<input
ref={inputRef}
id={emailId}
className="cf-popup-modal-2__input"
type="email"
name="email"
inputMode="email"
autoComplete="email"
placeholder={copy.emailPlaceholder}
value={email}
onChange={(event) => {
setEmail(event.target.value)
if (error) setError(null)
}}
disabled={isDisabled}
required
aria-invalid={shownError ? true : undefined}
aria-describedby={describedBy}
/>
</div>
{shownError && (
<p id={errorId} className="cf-popup-modal-2__error" role="alert">
<AlertCircle aria-hidden />
<span>{shownError}</span>
</p>
)}
{copy.privacy && (
<p id={hintId} className="cf-popup-modal-2__hint">
{copy.privacy}
</p>
)}
<button
type="submit"
className="cf-popup-modal-2__cta"
data-force={force}
disabled={isDisabled}
aria-busy={pending || undefined}
>
{pending ? (
<>
<Loader2 aria-hidden className="cf-popup-modal-2__spin" />
<span>{copy.pendingLabel}</span>
</>
) : (
<>
{cartIcon && <ShoppingCart aria-hidden strokeWidth={2.4} />}
<span className="cf-popup-modal-2__cta-label">{copy.actionLabel}</span>
{price && (
<>
<span className="cf-popup-modal-2__cta-sep" aria-hidden />
<span className="cf-popup-modal-2__cta-price">{price}</span>
</>
)}
</>
)}
</button>
{copy.reassurance && (
<p className="cf-popup-modal-2__assure">
<Lock aria-hidden />
{copy.reassurance}
</p>
)}
{copy.declineLabel && (
<button
type="button"
className="cf-popup-modal-2__decline"
onClick={() => {
onDecline?.()
setOpen(false)
}}
>
{copy.declineLabel}
</button>
)}
</form>
</div>
</div>
)
const styles = (
<>
{/* Signature face: the documented signature exception to the theme's font loader. */}
{signer && <link rel="stylesheet" href={SIGNATURE_FONT} />}
<style>{CSS}</style>
</>
)
if (inline) {
return (
<div className={cx("cf-popup-modal-2 cf-popup-modal-2--inline", className)}>
{styles}
{panel}
</div>
)
}
return (
<>
{withOpen(trigger, () => setOpen(true))}
{isOpen && (
<div
className={cx("cf-popup-modal-2 cf-popup-modal-2--modal", className)}
onClick={(event) => {
if (event.target === event.currentTarget) setOpen(false)
}}
>
{styles}
{panel}
</div>
)}
</>
)
}
export default PopupModal2
const DEFAULT_COPY: PopupModal2Copy = {
emailLabel: "Where should we send your kit?",
emailPlaceholder: "you@example.com",
privacy: "We respect your inbox. Unsubscribe anytime.",
actionLabel: "Add To Cart",
pendingLabel: "Adding to cart…",
reassurance: "Secure checkout · Instant download",
declineLabel: "No thanks, I'll plan it on my own.",
closeLabel: "Close",
errorRequired: "Enter your email address to continue.",
errorInvalid: "Enter a valid email, like you@example.com.",
itemValue: "{value} value",
itemsLabel: "What's inside",
salutation: "Dear friend,",
signOff: "To your first launch,",
}
const DEFAULT_PARAGRAPHS: React.ReactNode[] = [
"If your first funnel still lives in your head, this kit gets it onto the page.",
"Plan your funnel, write your page copy, and check every step before you launch. One payment. Yours to keep.",
]
const SIGNATURE_FONT = "https://fonts.googleapis.com/css2?family=Mrs+Saint+Delafield&display=swap"
function cx(...names: (string | undefined | false)[]) {
return names.filter(Boolean).join(" ")
}
/** Replaces named "{key}" placeholders in a copy template with text. */
function fill(template: string, values: Record<string, string>) {
return Object.keys(values).reduce((text, key) => text.split(`{${key}}`).join(values[key]), template)
}
function isEmail(value: string) {
const at = value.indexOf("@")
if (at < 1 || at !== value.lastIndexOf("@") || value.includes(" ")) return false
const domain = value.slice(at + 1)
const dot = domain.lastIndexOf(".")
return dot > 0 && dot < domain.length - 2
}
function renderHeadline(headline: React.ReactNode, highlight?: string) {
if (typeof headline !== "string" || !highlight) return headline
const start = headline.indexOf(highlight)
if (start < 0) return headline
return (
<>
{headline.slice(0, start)}
<span className="cf-popup-modal-2__mark">{highlight}</span>
{headline.slice(start + highlight.length)}
</>
)
}
function withOpen(trigger: React.ReactNode, openPopup: () => void) {
if (!React.isValidElement<{ onClick?: (event: React.MouseEvent<HTMLElement>) => void }>(trigger)) return trigger
const original = trigger.props.onClick
return React.cloneElement(trigger, {
onClick: (event: React.MouseEvent<HTMLElement>) => {
original?.(event)
if (!event.defaultPrevented) openPopup()
},
})
}
/*
* Theme notes:
* - Every colour reads the theme tokens (role tokens first, base tokens as fallback); hex only as the last fallback.
* - The marker keeps the default yellow (documented exception); text on it is a deep shade of the marker's own hue.
* - The handwritten signature is the one integral face, through --signature-font so a theme can replace it.
*/
const CSS = `
.cf-popup-modal-2, .cf-popup-modal-2 * { box-sizing: border-box; }
.cf-popup-modal-2 {
--pm2-shadow: var(--shadow, oklch(0.22 0.03 256));
--pm2-cta: var(--button-bg, var(--cta, #d6322a));
--pm2-cta-2: var(--button-bg-2, var(--cta-2, #b8241d));
--pm2-cta-ink: var(--button-ink, var(--cta-ink, #ffffff));
--pm2-focus: var(--field-focus, var(--accent, #2f5fd0));
--pm2-danger: var(--danger, oklch(0.5 0.17 27));
/* Default yellow marker: documented theme exception. */
--pm2-marker: var(--marker, #fae37c);
/* Integral handwritten face (documented signature exception); a theme replaces it with --signature-face. */
--signature-font: var(--signature-face, "Mrs Saint Delafield", var(--font-display));
font-family: var(--font-body);
color: var(--ink);
-webkit-font-smoothing: antialiased;
}
.cf-popup-modal-2--inline { display: block; width: 100%; }
.cf-popup-modal-2--inline .cf-popup-modal-2__panel { margin-inline: auto; }
.cf-popup-modal-2--modal {
position: fixed; inset: 0; z-index: 1000; display: flex; padding: 16px;
overflow-y: auto; overscroll-behavior: contain;
background: oklch(from var(--band, oklch(0.27 0.07 256)) calc(l - 0.08) c h / 0.68);
}
.cf-popup-modal-2--modal .cf-popup-modal-2__panel { margin: auto; }
.cf-popup-modal-2__panel {
position: relative; width: 100%; max-width: 720px; container-type: inline-size; overflow: hidden;
background: var(--card, #ffffff); color: var(--ink); text-align: left;
border: 1px solid var(--card-border, color-mix(in oklch, var(--ink) 12%, transparent));
border-radius: var(--card-radius, calc(var(--radius, 12px) + 6px));
box-shadow: var(--card-shadow, var(--shadow-lg, 0 1px 3px oklch(from var(--pm2-shadow) l c h / 0.22), 0 24px 44px -16px oklch(from var(--pm2-shadow) l c h / 0.42)));
}
/* Quiet icon button: secondary-role colours, neutral ink tint on the card as fallback. */
.cf-popup-modal-2__close {
--pm2-close-bg: var(--button-2-bg, color-mix(in oklch, var(--ink) 6%, var(--card, #ffffff)));
position: absolute; top: 14px; right: 14px; z-index: 3; width: 40px; height: 40px;
display: grid; place-items: center; padding: 0; border: 0; border-radius: 999px; cursor: pointer;
background: var(--pm2-close-bg); color: var(--button-2-ink, var(--ink));
transition: background-color .15s ease, transform .15s ease;
}
.cf-popup-modal-2__close:hover { background: color-mix(in oklch, var(--ink) 7%, var(--pm2-close-bg)); }
.cf-popup-modal-2__close:active { transform: scale(.94); }
.cf-popup-modal-2__close svg { width: 20px; height: 20px; }
.cf-popup-modal-2__body {
display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 32px; row-gap: 20px;
align-items: start; padding: 30px 28px 28px;
}
.cf-popup-modal-2__headline {
grid-column: 1 / -1; margin: 0; padding-right: 44px; color: var(--ink);
font-family: var(--font-display); font-weight: var(--display-weight, 900);
letter-spacing: var(--display-tracking, -0.022em); text-transform: var(--display-case, none);
font-size: clamp(1.75rem, 5.6cqi, 2.5rem); line-height: 1.05; text-wrap: balance;
}
.cf-popup-modal-2__mark {
/* Text on the marker is a deep shade of the marker's own hue, so it reads on dark themes too. */
color: oklch(from var(--pm2-marker) 0.2 0.02 h);
background-image: linear-gradient(180deg, transparent 40%, var(--pm2-marker) 40%, var(--pm2-marker) 94%, transparent 94%);
padding: 0 .1em; margin: 0 -.04em; border-radius: .18em .5em .3em .45em;
-webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.cf-popup-modal-2__items {
grid-column: 1 / -1; list-style: none; margin: 2px 0 4px; padding: 14px 16px;
display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
background: color-mix(in oklch, var(--ink) 4%, var(--card, #ffffff));
border-radius: var(--radius, 12px);
}
.cf-popup-modal-2__item { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cf-popup-modal-2__thumb {
flex: none; width: 56px; height: 56px; object-fit: cover; object-position: center;
border-radius: calc(var(--radius, 12px) * 0.6);
filter: drop-shadow(0 1px 2px oklch(from var(--pm2-shadow) l c h / 0.25));
}
.cf-popup-modal-2__item-text { display: grid; gap: 2px; min-width: 0; }
.cf-popup-modal-2__item-name { font-size: 15px; font-weight: 700; line-height: 1.25; color: var(--ink); text-wrap: pretty; overflow-wrap: break-word; }
.cf-popup-modal-2__item-value { font-size: 14px; line-height: 1.3; color: var(--muted); font-variant-numeric: tabular-nums; }
.cf-popup-modal-2__letter { min-width: 0; font-size: 17px; line-height: 1.55; color: var(--ink); }
.cf-popup-modal-2__letter p { margin: 0 0 10px; text-wrap: pretty; }
.cf-popup-modal-2__salutation { font-size: 18px; font-weight: 700; }
.cf-popup-modal-2__sign { margin-top: 14px; }
.cf-popup-modal-2__letter .cf-popup-modal-2__signoff { margin: 0; font-size: 16px; color: var(--muted); }
.cf-popup-modal-2__letter .cf-popup-modal-2__signature {
margin: 2px 0 0; font-family: var(--signature-font), cursive; font-weight: 400;
font-size: 42px; line-height: 1.1; color: var(--signature-ink, var(--ink));
}
.cf-popup-modal-2__form { display: grid; gap: 10px; min-width: 0; }
.cf-popup-modal-2__label { font-size: 17px; font-weight: 700; line-height: 1.3; color: var(--label-ink, var(--ink)); }
.cf-popup-modal-2__field { position: relative; }
.cf-popup-modal-2__field-icon {
position: absolute; left: 16px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%);
pointer-events: none; color: color-mix(in oklch, var(--field-ink, #101828) 55%, var(--field, #ffffff));
transition: color .15s ease;
}
.cf-popup-modal-2__field:focus-within .cf-popup-modal-2__field-icon { color: var(--pm2-focus); }
.cf-popup-modal-2__input {
width: 100%; height: 56px; padding: 0 16px 0 46px; margin: 0;
font: 500 18px/1.2 var(--font-body);
background: var(--field, #ffffff); color: var(--field-ink, #101828);
border: 2px solid var(--field-border, color-mix(in oklch, var(--ink) 22%, transparent));
border-radius: var(--field-radius, var(--radius, 10px)); outline: none;
box-shadow: inset 0 1px 2px oklch(from var(--pm2-shadow) l c h / 0.08);
transition: border-color .15s ease, box-shadow .15s ease;
}
.cf-popup-modal-2__input:hover:not(:disabled) { border-color: color-mix(in oklch, var(--ink) 38%, transparent); }
.cf-popup-modal-2__input:focus, .cf-popup-modal-2__input:focus:hover { border-color: var(--pm2-focus); box-shadow: 0 0 0 4px color-mix(in oklch, var(--pm2-focus) 22%, transparent); }
.cf-popup-modal-2__input[aria-invalid="true"], .cf-popup-modal-2__input[aria-invalid="true"]:hover { border-color: var(--pm2-danger); }
.cf-popup-modal-2__input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px color-mix(in oklch, var(--pm2-danger) 20%, transparent); }
.cf-popup-modal-2__input::placeholder { color: color-mix(in oklch, var(--field-ink, #101828) 65%, var(--field, #ffffff)); opacity: 1; font-weight: 400; }
.cf-popup-modal-2__input:disabled { cursor: not-allowed; background: color-mix(in oklch, var(--field-ink, #101828) 6%, var(--field, #ffffff)); }
.cf-popup-modal-2__error { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--pm2-danger); text-wrap: pretty; }
.cf-popup-modal-2__error svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.cf-popup-modal-2__hint { margin: 0 0 4px; font-size: 14px; line-height: 1.4; color: var(--muted); text-wrap: pretty; }
.cf-popup-modal-2__cta {
appearance: none; border: 0; margin: 0; cursor: pointer; width: 100%; min-height: 64px; padding: 12px 18px;
display: inline-flex; align-items: center; justify-content: center; gap: 12px;
font-family: var(--button-font, var(--font-display)); font-weight: var(--button-weight, 800);
text-transform: var(--button-case, none); font-size: 20px; line-height: 1.15; letter-spacing: -0.005em;
color: var(--pm2-cta-ink); text-shadow: var(--button-text-shadow, none);
background: linear-gradient(180deg, oklch(from var(--pm2-cta) calc(l + 0.035) c h), var(--pm2-cta-2));
border-radius: var(--button-radius, var(--radius, 12px));
box-shadow:
inset 0 1px 0 oklch(from var(--pm2-cta) calc(l + 0.14) c h / 0.7),
inset 0 -3px 0 oklch(from var(--pm2-cta-2) calc(l - 0.1) c h),
var(--button-shadow, 0 1px 2px oklch(from var(--pm2-shadow) l c h / 0.3), 0 6px 12px -4px oklch(from var(--pm2-shadow) l c h / 0.42));
transition: transform .14s ease, box-shadow .14s ease, background .18s ease;
}
.cf-popup-modal-2__cta svg { flex: none; width: 22px; height: 22px; }
.cf-popup-modal-2__cta-label { text-wrap: balance; }
.cf-popup-modal-2__cta-sep { flex: none; width: 1px; align-self: stretch; margin-block: 6px; background: oklch(from var(--pm2-cta-ink) l c h / 0.4); }
.cf-popup-modal-2__cta-price { font-weight: 900; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cf-popup-modal-2__cta:hover:not(:disabled), .cf-popup-modal-2__cta[data-force="hover"]:not(:disabled) {
transform: translateY(-1px);
background: linear-gradient(180deg, oklch(from var(--pm2-cta) calc(l - 0.01) c h), oklch(from var(--pm2-cta-2) calc(l - 0.05) c h));
box-shadow:
inset 0 1px 0 oklch(from var(--pm2-cta) calc(l + 0.12) c h / 0.7),
inset 0 -3px 0 oklch(from var(--pm2-cta-2) calc(l - 0.14) c h),
0 2px 3px oklch(from var(--pm2-shadow) l c h / 0.32), 0 9px 16px -6px oklch(from var(--pm2-shadow) l c h / 0.45);
}
.cf-popup-modal-2__cta:active:not(:disabled), .cf-popup-modal-2__cta[data-force="active"]:not(:disabled) {
transform: translateY(1px);
background: linear-gradient(180deg, oklch(from var(--pm2-cta) calc(l - 0.05) c h), oklch(from var(--pm2-cta-2) calc(l - 0.06) c h));
box-shadow:
inset 0 2px 3px oklch(from var(--pm2-cta-2) calc(l - 0.18) c h / 0.6),
inset 0 -1px 0 oklch(from var(--pm2-cta-2) calc(l - 0.12) c h),
0 1px 1px oklch(from var(--pm2-shadow) l c h / 0.3);
}
.cf-popup-modal-2__cta:disabled {
cursor: not-allowed; transform: none; text-shadow: none;
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.03 263)));
box-shadow: var(--button-2-shadow, var(--shadow-sm));
}
.cf-popup-modal-2__cta[aria-busy="true"] { cursor: progress; }
.cf-popup-modal-2__assure {
margin: 2px 0 0; font-size: 14px; line-height: 1.35; color: var(--muted); text-align: center; text-wrap: pretty;
}
.cf-popup-modal-2__assure svg {
display: inline-block; vertical-align: -0.15em; margin-inline-end: .4em;
width: 15px; height: 15px; color: var(--success, oklch(0.5 0.14 150));
}
/* DR decline link: deliberately quiet (--muted, underlined). It takes only the button radius for its focus ring. */
.cf-popup-modal-2__decline {
justify-self: center; appearance: none; background: none; border: 0; margin: 0; padding: 6px 4px; min-height: 36px;
font: 500 14px/1.3 var(--font-body); color: var(--muted); cursor: pointer; text-align: center;
border-radius: var(--button-radius, var(--radius, 12px));
text-decoration: underline; text-decoration-color: oklch(from var(--muted) l c h / 0.5); text-underline-offset: .2em;
}
.cf-popup-modal-2__decline:hover { color: var(--ink); text-decoration-color: currentColor; }
.cf-popup-modal-2__close:focus-visible, .cf-popup-modal-2__cta:focus-visible, .cf-popup-modal-2__decline:focus-visible {
outline: 3px solid var(--pm2-focus); outline-offset: 3px;
}
@container (max-width: 620px) {
.cf-popup-modal-2__body { grid-template-columns: minmax(0, 1fr); row-gap: 16px; padding: 24px 18px 22px; }
.cf-popup-modal-2__letter .cf-popup-modal-2__signature { font-size: 38px; }
}
@container (max-width: 520px) {
.cf-popup-modal-2__close { top: 10px; right: 10px; }
.cf-popup-modal-2__headline { padding-right: 36px; }
.cf-popup-modal-2__items { gap: 10px; padding: 14px 10px; }
.cf-popup-modal-2__item { flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.cf-popup-modal-2__thumb { width: 52px; height: 52px; }
.cf-popup-modal-2__item-name { font-size: 14px; }
.cf-popup-modal-2__cta { font-size: 19px; gap: 10px; padding-inline: 14px; }
}
@media (prefers-reduced-motion: no-preference) {
.cf-popup-modal-2--modal { animation: cf-popup-modal-2-fade .2s ease both; }
.cf-popup-modal-2--modal .cf-popup-modal-2__panel { animation: cf-popup-modal-2-in .28s cubic-bezier(.2,.8,.2,1) both; }
.cf-popup-modal-2__thumb { transition: transform .25s cubic-bezier(.2,.8,.2,1); }
.cf-popup-modal-2__item:hover .cf-popup-modal-2__thumb { transform: translateY(-2px); }
.cf-popup-modal-2__spin { animation: cf-popup-modal-2-spin .9s linear infinite; }
}
@keyframes cf-popup-modal-2-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cf-popup-modal-2-in { from { opacity: .4; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes cf-popup-modal-2-spin { to { transform: rotate(360deg); } }
`
pieces/urgency/popup-modal-2/specimen.tsx 37 lines
import defaults from "../../studio-defaults.json"
import { slot } from "../../slots"
import { PopupModal2, type PopupModal2Props } from "../popup-modal-2"
export const states: NonNullable<PopupModal2Props["state"]>[] = ["default", "hover", "active", "disabled", "error"]
const sample = defaults.sample
export default function PopupModal2Specimen({ state = "default" }: { state?: PopupModal2Props["state"] }) {
return (
<PopupModal2
inline
state={state}
headline={sample.headline}
highlight="a clear plan"
paragraphs={[
"If your first funnel still lives in your head, this kit gets it onto the page.",
`${sample.lead} One payment. Yours to keep.`,
]}
signer="Alex Rivera"
price={sample.price}
items={sample.items.map((item, index) => ({
name: item.name,
value: item.value,
image: slot(`item-${index + 1}`, item.image),
imageAlt: item.imageAlt,
}))}
copy={{
emailLabel: "Where should we send your kit?",
privacy: sample.registration.privacy,
reassurance: sample.sublabel,
actionLabel: "Add To Cart",
declineLabel: "No thanks, I'll plan it on my own.",
}}
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalPopupModal2 |
React.ReactNode |
|
highlight OptionalPopupModal2 |
string |
|
paragraphs OptionalPopupModal2 |
React.ReactNode[] |
|
signer OptionalPopupModal2 |
string |
|
price OptionalPopupModal2 |
string |
|
items OptionalPopupModal2 |
PopupModal2Item[] |
|
cartIcon OptionalPopupModal2 |
boolean |
|
copy OptionalPopupModal2 |
Partial<PopupModal2Copy> |
|
inline OptionalPopupModal2 |
boolean |
|
open OptionalPopupModal2 |
boolean |
|
defaultOpen OptionalPopupModal2 |
boolean |
|
onOpenChange OptionalPopupModal2 |
(open: boolean) => void |
|
trigger OptionalPopupModal2 |
React.ReactNode |
|
onSubmit OptionalPopupModal2 |
(email: string) => void | Promise<void> |
|
onDecline OptionalPopupModal2 |
() => void |
|
disabled OptionalPopupModal2 |
boolean |
|
state OptionalPopupModal2 |
"default" | "hover" | "active" | "disabled" | "error" |
|
className OptionalPopupModal2 |
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-ink--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