CTA Card 1
Presents the supplied price, derived saving and action as one offer decision.
Use it in a prompt
Use kit/cta-card 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/kit/cta-card.tsx. - Import it and pass your copy and images (Props tab):
import { CtaCard } from "@/components/funneldna/kit/cta-card"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/kit/cta-card/component.tsx 202 lines
// pages: all
// Presents the supplied price, derived saving and action as one offer decision.
import type { ReactNode } from "react";
import { kitNumberSize } from "./core";
export type CtaCardProps = {
name?: ReactNode;
/** Supplied price; omit unknown prices. */
price?: ReactNode;
priceNote?: ReactNode;
/** Existing action control; its href or action callback stays on that control. */
button: ReactNode;
reassure?: ReactNode;
icon?: ReactNode;
/** Supplied compare-at price; savings require matching plain currency amounts. */
was?: ReactNode;
wasLabel?: ReactNode;
/** Override the derived savings, or false to hide them. */
save?: ReactNode | false;
priceLabel?: ReactNode;
/** Decorative art, or false to hide the approved funnel illustration. */
art?: ReactNode | false;
/** Templates replace {amount} and {percent} as text. */
copy?: Partial<typeof CTA_CARD_COPY>;
className?: string;
};
export function CtaCard({
name, price, priceNote, button, reassure, icon, was, wasLabel = "Regular price", save, priceLabel, art,
copy: copyOverrides, className,
}: CtaCardProps) {
const copy = { ...CTA_CARD_COPY, ...copyOverrides };
const derived = was != null && price != null && save === undefined ? ctaCardSavings(was, price) : null;
const saveContent: ReactNode =
save === false ? null : save !== undefined ? save : derived ? (
<>{copy.savingsTemplate.replaceAll("{amount}", derived.amount)}<span className="font-semibold">{copy.percentTemplate.replaceAll("{percent}", String(derived.pct))}</span></>
) : null;
return (
<div data-cta-card className={["cf-cta-card relative isolate mx-auto flex w-full max-w-[600px] flex-col items-center gap-5 overflow-hidden rounded-[var(--card-radius,var(--radius,20px))] border-[length:var(--border-w,1px)] border-[var(--card-border,oklch(from_var(--ink)_l_c_h_/_0.12))] bg-[var(--card)] text-[var(--ink)] [font-family:var(--font-body)] p-6 text-center 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)))] sm:p-8", className].filter(Boolean).join(" ")}>
<style>{CTA_CARD_CSS}</style>
{art !== false && (
<div aria-hidden inert className="pointer-events-none absolute -right-16 -top-14 -z-10 w-[176px] rotate-[12deg] text-[var(--accent,#0f5fc2)] opacity-[0.09] sm:-right-12 sm:-top-16 sm:w-[250px]">
{art ?? <CtaCardArt />}
</div>
)}
{name && <p className="max-w-[32ch] text-[13px] font-semibold uppercase tracking-[var(--kicker-tracking,0.16em)] text-[var(--muted)]">{name}</p>}
{price != null && (
<div className="@container flex w-full flex-col items-center gap-3">
<div className="flex w-full flex-col items-center gap-4 @md:flex-row @md:justify-center @md:gap-10">
{was != null && (
<>
<div className="flex flex-col items-center">
{wasLabel && <span className="mb-1.5 text-[14px] font-bold uppercase leading-none tracking-[0.12em] text-[var(--muted)]">{wasLabel}</span>}
<del className="relative inline-block px-1 font-[family-name:var(--font-display,Georgia,serif)] text-[clamp(1.875rem,6vw,2.375rem)] [font-weight:var(--display-weight,700)] [text-transform:var(--display-case,none)] [letter-spacing:var(--display-tracking,normal)] leading-none tabular-nums text-[var(--danger)] no-underline">
<span className="sr-only">{copy.wasPrefix}</span>{was}
<CtaCardStrike />
</del>
</div>
</>
)}
<div className="flex max-w-full flex-col items-center">
{priceLabel && (
<span className="relative z-10 -mb-3.5 inline-flex max-w-[90%] items-center justify-center rounded-full border border-[oklch(from_var(--band)_l_c_h_/_0.2)] bg-[var(--card)] px-4 py-1 text-[13px] font-bold uppercase leading-snug tracking-[0.12em] text-[var(--ink)] shadow-[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))]">{priceLabel}</span>
)}
<div data-cta-price className={`relative max-w-full rounded-[var(--card-radius,var(--radius,16px))] border border-[var(--card-border,oklch(from_var(--band-ink)_l_c_h_/_0.12))] bg-[var(--band,#0f2747)] px-8 text-[var(--band-ink,#ffffff)] 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)))] ${priceLabel ? "pt-7" : "pt-4"} ${saveContent ? "pb-6" : "pb-4"}`}>
<span aria-hidden className="pointer-events-none absolute inset-[5px] rounded-[11px] border border-[oklch(from_var(--band-ink)_l_c_h_/_0.22)]" />
<p className="relative max-w-full font-[family-name:var(--font-display,Georgia,serif)] [font-weight:var(--display-weight,700)] [text-transform:var(--display-case,none)] [letter-spacing:var(--display-tracking,normal)] leading-none tabular-nums" style={{ fontSize: kitNumberSize(price, "clamp(2.75rem,7vw,4rem)") }}>{price}</p>
</div>
{saveContent && (
<span data-cta-save className="relative z-10 -mt-3.5 inline-flex max-w-[94%] rotate-[-2deg] items-center justify-center gap-1.5 whitespace-nowrap rounded-full border border-[var(--success)] bg-[var(--success-soft)] px-4 py-1.5 text-[14px] font-extrabold leading-none text-[var(--success)] shadow-[inset_0_1px_0_oklch(from_var(--card)_calc(l_+_0.04)_c_h_/_.3),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))]">
<svg viewBox="0 0 16 16" fill="none" aria-hidden className="size-3.5 shrink-0">
<path d="M8.6 1.5H14.5v5.9L7.4 14.5 1.5 8.6z" stroke="currentColor" strokeWidth="1.6" strokeLinejoin="round" fill="var(--success-soft)" />
<circle cx="11.4" cy="4.6" r="1.2" fill="currentColor" />
</svg>
<span>{saveContent}</span>
</span>
)}
</div>
</div>
{priceNote && <p className="mt-1 max-w-[40ch] text-[1rem] leading-normal text-[var(--muted)]">{priceNote}</p>}
</div>
)}
<div data-cta-slot>{button}</div>
{reassure && (
<p className="mx-auto max-w-[44ch] text-center text-[14px] leading-normal text-[var(--muted)]">
{icon && <span aria-hidden inert className="mr-2 inline-block size-4 align-[-2px] text-[var(--success)] [&>svg]:size-4">{icon}</span>}{reassure}
</p>
)}
</div>
);
}
export default CtaCard;
const CTA_CARD_COPY = {
wasPrefix: "Was ", savingsTemplate: "You save {amount}", percentTemplate: " · {percent}% off",
};
/** Default offset background art: a faint funnel path (two pages joined by a dashed trail). */
// private
function CtaCardArt() {
return (
<svg viewBox="0 0 260 260" fill="none" className="block h-auto w-full" aria-hidden>
<g stroke="currentColor" strokeWidth="3" strokeLinejoin="round">
<rect x="18" y="22" width="78" height="100" rx="9" fill="currentColor" fillOpacity=".18" />
<rect x="30" y="36" width="54" height="10" rx="3" fill="currentColor" stroke="none" />
<rect x="30" y="54" width="40" height="5" rx="2.5" fill="currentColor" stroke="none" fillOpacity=".7" />
<rect x="30" y="65" width="48" height="5" rx="2.5" fill="currentColor" stroke="none" fillOpacity=".7" />
<rect x="30" y="94" width="54" height="16" rx="5" fill="currentColor" stroke="none" />
<rect x="138" y="70" width="78" height="100" rx="9" fill="currentColor" fillOpacity=".18" />
<rect x="150" y="84" width="54" height="10" rx="3" fill="currentColor" stroke="none" />
<circle cx="158" cy="112" r="4" fill="currentColor" stroke="none" />
<rect x="168" y="109" width="36" height="5" rx="2.5" fill="currentColor" stroke="none" fillOpacity=".7" />
<circle cx="158" cy="126" r="4" fill="currentColor" stroke="none" />
<rect x="168" y="123" width="30" height="5" rx="2.5" fill="currentColor" stroke="none" fillOpacity=".7" />
<rect x="150" y="142" width="54" height="16" rx="5" fill="currentColor" stroke="none" />
<path d="M96 72c18 0 26 8 40 22" strokeDasharray="6 7" strokeLinecap="round" />
<path d="M176 170c0 30-18 44-48 54" strokeDasharray="6 7" strokeLinecap="round" />
</g>
</svg>
);
}
/** Parses a plain price like "$97", "€1,299.00" or 47. Anything else returns null (no savings shown). */
function ctaCardAmount(v: ReactNode): { n: number; sym: string; dec: boolean } | null {
if (typeof v === "number") return Number.isFinite(v) ? { n: v, sym: "", dec: !Number.isInteger(v) } : null;
if (typeof v !== "string") return null;
const m = v.trim().match(/^([^\d\s.,]{0,3})\s?(\d{1,3}(?:,\d{3})+|\d+)(\.\d{1,2})?$/);
if (!m) return null;
return { sym: m[1], n: parseFloat(m[2].replace(/,/g, "") + (m[3] ?? "")), dec: !!m[3] };
}
/** Savings derived only from the supplied compare-at and today prices. */
function ctaCardSavings(was: ReactNode, price: ReactNode): { amount: string; pct: number } | null {
const a = ctaCardAmount(was);
const b = ctaCardAmount(price);
if (!a || !b || a.sym !== b.sym || a.n <= b.n || a.n <= 0) return null;
const diff = a.n - b.n;
const fmt = a.dec || b.dec ? diff.toFixed(2) : Math.round(diff).toLocaleString("en-US");
return { amount: `${a.sym}${fmt}`, pct: Math.round((diff / a.n) * 100) };
}
/** Hand-drawn red double strike laid over the regular price (lives inside the price span so it never drifts). */
// private
function CtaCardStrike() {
return (
<svg data-cta-strike viewBox="0 0 100 40" preserveAspectRatio="none" fill="none" aria-hidden className="pointer-events-none absolute -inset-x-[10%] top-[8%] h-[84%] w-[120%] overflow-visible text-[var(--danger)]">
<path pathLength={1} d="M3 30C26 24 58 15 97 9" stroke="currentColor" strokeWidth="4" strokeLinecap="round" vectorEffect="non-scaling-stroke" />
<path pathLength={1} d="M8 35C34 28 63 21 94 15" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" vectorEffect="non-scaling-stroke" opacity=".85" />
</svg>
);
}
/* Scoped finish for whatever button is dropped into the card: a richer vertical gradient, a darker
border, a bevelled inset and a soft dark drop shadow, with hover, press, focus and disabled states.
Also the compare-to-today price ladder: a hand-drawn red strike and a savings sticker. */
// Shadows and action shading follow the theme palette.
const CTA_CARD_CSS = `
.cf-cta-card [data-cta-slot]{width:100%;display:flex;justify-content:center}
.cf-cta-card [data-cta-slot] :is(a,button){
background-color:var(--button-bg,var(--cta));
background-image:linear-gradient(180deg,oklch(from var(--button-bg,var(--cta)) l c h),oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h));
border:1px solid var(--button-bg-2,var(--cta-2));
color:var(--button-ink,var(--cta-ink));
text-shadow:var(--button-text-shadow, 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.2) c h / 0.75));
box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--card) calc(l + 0.04) c h / .3),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)));
transition:transform .16s ease,box-shadow .16s ease,filter .16s ease;border-radius:var(--button-radius,var(--radius,14px));font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,700);text-transform:var(--button-case,none);}
.cf-cta-card [data-cta-slot] :is(a,button):hover{
color:var(--button-ink,var(--cta-ink));
background:oklch(from var(--button-bg,var(--cta)) calc(l - 0.06) c h);
transform:translateY(-2px);
box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--card) calc(l + 0.04) c h / .3),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-cta-card [data-cta-slot] :is(a,button):active{
background:oklch(from var(--button-bg,var(--cta)) calc(l - 0.10) c h);color:contrast-color(oklch(from var(--button-bg,var(--cta)) calc(l - 0.10) c h));
transform:translateY(1px);
box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--card) calc(l + 0.04) c h / .3),inset 0 -1px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.16) c h),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-cta-card [data-cta-slot] :is(a,button):focus-visible{
outline:3px solid var(--accent,#0f5fc2);
outline-offset:3px;
}
.cf-cta-card [data-cta-slot] :is(a,button):is(:disabled,[aria-disabled="true"]){
cursor:not-allowed;
opacity:.6;
filter:none;
transform:none;
box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--card) calc(l + 0.04) c h / .3),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-cta-card [data-cta-slot] :is(a,button)>span{opacity:1}
.cf-cta-card [data-cta-slot] :is(a,button)>span:first-child{font-weight:inherit}
.cf-cta-card [data-cta-strike] path{stroke-dasharray:1;stroke-dashoffset:0;animation:cta-card-strike .5s cubic-bezier(.6,0,.3,1) .15s backwards}
.cf-cta-card [data-cta-strike] path + path{animation-delay:.4s}
.cf-cta-card [data-cta-save]{animation:cta-card-pop .45s cubic-bezier(.3,1.5,.5,1) .55s backwards}
@keyframes cta-card-strike{from{stroke-dashoffset:1}to{stroke-dashoffset:0}}
@keyframes cta-card-pop{from{opacity:0;transform:scale(.7) rotate(-6deg)}to{opacity:1;transform:rotate(-2deg)}}
@media (prefers-reduced-motion: reduce){
.cf-cta-card [data-cta-slot] :is(a,button){transition:none}
.cf-cta-card [data-cta-slot] :is(a,button):is(:hover,:active){transform:none}
.cf-cta-card [data-cta-strike] path,.cf-cta-card [data-cta-save]{animation:none}
}
`;
pieces/kit/cta-card/specimen.tsx 13 lines
// Specimen for cta-card.tsx. Fictional Funnel Starter Kit; proof remains unsupplied.
import { CtaCard } from "../cta-card";
import { Section } from "../core";
import { CtaButton } from "../cta-button";
import defaults from "../../studio-defaults.json";
import { Lock } from "lucide-react";
export const states = ["default"];
export default function Page() {
return <>
<Section ><CtaCard name={defaults.sample.name} was={defaults.sample.regularPrice} wasLabel="Regular price" priceLabel="Today" price={defaults.sample.price} priceNote="One payment. Instant download." button={<CtaButton label={defaults.sample.label} sub="$47, one payment. Secure checkout · Instant download." href="#order-preview" />} icon={<Lock aria-hidden />} reassure={defaults.sample.guarantee} /></Section>
</>;
}
| Name | Type | Details |
|---|---|---|
name OptionalCtaCard |
ReactNode |
|
price OptionalCtaCard |
ReactNode |
|
priceNote OptionalCtaCard |
ReactNode |
|
button RequiredCtaCard |
ReactNode |
|
reassure OptionalCtaCard |
ReactNode |
|
icon OptionalCtaCard |
ReactNode |
|
was OptionalCtaCard |
ReactNode |
|
wasLabel OptionalCtaCard |
ReactNode |
Default "Regular price"
|
save OptionalCtaCard |
ReactNode | false |
|
priceLabel OptionalCtaCard |
ReactNode |
|
art OptionalCtaCard |
ReactNode | false |
|
copy OptionalCtaCard |
Partial<typeof CTA_CARD_COPY> |
|
className OptionalCtaCard |
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.
--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.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
This piece reads no image slots.
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
c5c36baf6b897f22.svg image/svg+xml · 236 Bytes
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB