Sticky CTA Bar 1
A bar pinned to the top of the screen that keeps the offer name, price and a compact order button in view while the visitor scrolls.
Use it in a prompt
Use urgency/sticky-cta-bar 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/sticky-cta-bar.tsx. - Import it and pass your copy and images (Props tab):
import { StickyCtaBar } from "@/components/funneldna/urgency/sticky-cta-bar"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/urgency/sticky-cta-bar/component.tsx 169 lines
// Keeps the offer and its buy button pinned to the top of the screen while the visitor reads the page.
import * as React from "react";
import { X } from "lucide-react";
export type StickyCtaBarProps = {
headline?: string;
/** Supporting line, hidden on small phones. */
subline?: string;
price?: string;
/** Supplied compare-at price; savings require the same currency. */
compareAt?: string;
ctaLabel?: string;
href?: string;
onAction?: () => void;
/** Legacy aliases; canonical props take precedence when defined. */
ctaHref?: string;
onCtaClick?: () => void;
dismissible?: boolean;
onDismiss?: () => void;
/** Legacy disabled state, used only when state is undefined. */
disabled?: boolean;
position?: "sticky" | "fixed";
/** Legacy preview state, used only when state is undefined. */
previewState?: "hover" | "active";
state?: "default" | "hover" | "active" | "disabled";
/** Templates replace {headline} and {amount} as plain text. */
copy?: Partial<typeof STICKY_CTA_BAR_COPY>;
className?: string;
};
export function StickyCtaBar({
headline = "The Funnel Starter Kit", subline, price, compareAt, ctaLabel = "Yes! Give Me Access",
href, onAction, ctaHref, onCtaClick, dismissible = true, onDismiss,
disabled = false, position = "sticky", previewState, state, copy: copyOverrides, className,
}: StickyCtaBarProps) {
const copy = { ...STICKY_CTA_BAR_COPY, ...copyOverrides };
const destination = href !== undefined ? href : ctaHref;
const action = onAction !== undefined ? onAction : onCtaClick;
const isDisabled = state !== undefined ? state === "disabled" : disabled;
const visualState = state !== undefined ? state : previewState;
const [open, setOpen] = React.useState(true)
if (!open) return null
const save = savingsOf(compareAt, price)
const ctaClass = [
"cfhb__cta",
visualState === "hover" ? "is-hover" : "",
visualState === "active" ? "is-active" : "",
]
.filter(Boolean)
.join(" ")
const ctaInner = <span className="cfhb__cta-label">{ctaLabel}</span>
return (
<div
role="region"
aria-label={copy.offerTemplate.replaceAll("{headline}", headline)}
className={["cf-sticky-cta-bar cfhb", position === "fixed" ? "cfhb--fixed" : "", className || ""]
.filter(Boolean)
.join(" ")}
>
<style>{CSS}</style>
<div className="cfhb__row">
<div className="cfhb__msg">
<p className="cfhb__headline">{headline}</p>
{(price || subline) && (
<p className="cfhb__meta">
{compareAt && (
<s className="cfhb__was">
<span className="cfhb__sr">{copy.regularPrefix}</span>
{compareAt}
</s>
)}
{price && (
<strong className="cfhb__now">
<span className="cfhb__sr">{copy.todayPrefix}</span>
{price}
</strong>
)}
{save && <span className="cfhb__save">{copy.savingsTemplate.replaceAll("{amount}", save)}</span>}
{subline && <span data-separator={copy.sublineSeparator} className="cfhb__sub">{subline}</span>}
</p>
)}
</div>
{destination && !isDisabled ? (
<a className={ctaClass} href={destination} onClick={action}>
{ctaInner}
</a>
) : (
<button type="button" className={ctaClass} onClick={action} disabled={isDisabled}>
{ctaInner}
</button>
)}
{dismissible && (
<button
type="button"
className="cfhb__close"
aria-label={copy.dismissLabel}
onClick={() => {
setOpen(false)
onDismiss?.()
}}
>
<X size={18} strokeWidth={2.5} aria-hidden="true" />
</button>
)}
</div>
</div>
)
}
export default StickyCtaBar;
const STICKY_CTA_BAR_COPY = {
offerTemplate: "{headline} offer", regularPrefix: "Regular price ", todayPrefix: "Today ",
savingsTemplate: "Save {amount}", dismissLabel: "Dismiss offer bar", sublineSeparator: "·",
};
function savingsOf(compareAt?: string, price?: string) {
if (!compareAt || !price) return null
const read = (v: string) => {
const t = v.trim()
const sym = (t.match(/^[^0-9]*/) || [""])[0]
const num = parseFloat(((t.match(/[0-9][0-9,.]*/) || [""])[0] || "").replace(/,/g, ""))
return { sym, num }
}
const a = read(compareAt)
const b = read(price)
if (!a.sym || a.sym !== b.sym || !isFinite(a.num) || !isFinite(b.num) || a.num <= b.num) return null
const diff = a.num - b.num
const shown = Number.isInteger(diff) ? diff.toLocaleString("en-US") : diff.toFixed(2)
return `${a.sym}${shown}`
}
// Neutral black/white alpha shadows retain the approved depth.
const CSS = `
.cf-sticky-cta-bar{position:sticky;top:0;z-index:50;width:100%;box-sizing:border-box;color:var(--band-ink,#fff);background:var(--band,#0f2747);font-family:var(--font-body,Arial,sans-serif);box-shadow:inset 0 1px 0 oklch(from var(--card) calc(l + 0.04) c h / .1),inset 0 -2px 0 var(--accent-fill,var(--accent,#0f5fc2)),0 3px 4px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.45);animation:cfhb-in .5s cubic-bezier(.2,.9,.25,1) both}
.cf-sticky-cta-bar *{box-sizing:border-box}
.cfhb--fixed:where(.cf-sticky-cta-bar){position:fixed;left:0;right:0;padding-top:env(safe-area-inset-top)}
@keyframes cfhb-in{from{transform:translateY(-100%)}to{transform:none}}
:where(.cf-sticky-cta-bar) .cfhb__sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
:where(.cf-sticky-cta-bar) .cfhb__row{position:relative;max-width:var(--wrap,72rem);margin:0 auto;display:flex;align-items:center;gap:18px;padding:10px 20px}
:where(.cf-sticky-cta-bar) .cfhb__msg{flex:1 1 auto;min-width:0;display:flex;flex-wrap:wrap;align-items:baseline;column-gap:18px;row-gap:3px}
:where(.cf-sticky-cta-bar) .cfhb__headline{margin:0;font-family:var(--font-display,Arial,sans-serif);font-size:17px;font-weight:var(--display-weight,800);line-height:1.25;letter-spacing:var(--display-tracking,-.01em);color:var(--band-ink,#fff);text-transform:var(--display-case,none)}
:where(.cf-sticky-cta-bar) .cfhb__meta{margin:0;display:inline-flex;flex-wrap:wrap;align-items:baseline;gap:4px 10px;font-size:14px;line-height:1.3}
:where(.cf-sticky-cta-bar) .cfhb__was{font-size:15px;font-weight:600;color:var(--danger);text-decoration:line-through;text-decoration-color:var(--danger);text-decoration-thickness:2px;background:var(--danger-soft)}
:where(.cf-sticky-cta-bar) .cfhb__now{font-family:var(--font-display,Arial,sans-serif);font-size:22px;font-weight:var(--display-weight,900);line-height:1;letter-spacing:var(--display-tracking,-.01em);color:var(--band-ink,#fff);text-transform:var(--display-case,none)}
:where(.cf-sticky-cta-bar) .cfhb__save{align-self:center;display:inline-flex;align-items:center;height:24px;padding:0 10px;border-radius:999px;font-size:13px;font-weight:800;letter-spacing:.03em;text-transform:uppercase;white-space:nowrap;color:var(--ink);background:var(--marker,#fae37c);box-shadow:inset 0 -1px 0 oklch(from var(--surface) calc(l - 0.12) c h / .14),0 1px 0 oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.12)}
:where(.cf-sticky-cta-bar) .cfhb__sub{font-weight:500;color:var(--band-ink,#fff)}
:where(.cf-sticky-cta-bar) .cfhb__sub:before{content:attr(data-separator);margin-right:10px;opacity:.7}
:where(.cf-sticky-cta-bar) .cfhb__cta{position:relative;overflow:hidden;flex:none;display:inline-flex;align-items:center;justify-content:center;gap:10px;min-height:46px;padding:6px 20px;border-radius:var(--button-radius,calc(var(--radius,12px) * .75));border:1px solid var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h));font-family:var(--button-font,var(--font-display));font-size:16px;font-weight:var(--button-weight,800);line-height:1.15;text-align:center;text-wrap:balance;text-decoration:none;cursor:pointer;color:var(--button-ink,var(--cta-ink));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)));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--card) calc(l + 0.04) c h / .3),inset 0 -2px 0 oklch(from var(--surface) calc(l - 0.12) c h / .16),inset 0 -3px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.16) c h),0 4px 6px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.12));transition:transform .15s ease,box-shadow .15s ease,filter .15s ease;border-color:var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h));text-transform:var(--button-case,none);}
:where(.cf-sticky-cta-bar) .cfhb__cta-label{position:relative;z-index:1}
:where(.cf-sticky-cta-bar) .cfhb__cta:after{content:"";position:absolute;inset:0;pointer-events:none;background:linear-gradient(100deg,transparent 30%,oklch(from var(--button-ink,var(--cta-ink)) l c h / 0.3) 50%,transparent 70%);transform:translateX(-130%)}
:where(.cf-sticky-cta-bar) .cfhb__cta:hover:not(:disabled),:where(.cf-sticky-cta-bar) .cfhb__cta.is-hover{transform:translateY(-1px);background:oklch(from var(--button-bg,var(--cta)) calc(l - 0.06) c h);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),0 4px 6px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.12));}
:where(.cf-sticky-cta-bar) .cfhb__cta:active:not(:disabled),:where(.cf-sticky-cta-bar) .cfhb__cta.is-active{transform:translateY(2px);background:oklch(from var(--button-bg,var(--cta)) calc(l - 0.06) c h);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),0 4px 6px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.12));}
:where(.cf-sticky-cta-bar) .cfhb__cta:focus-visible{outline:3px solid var(--accent);outline-offset:3px}
:where(.cf-sticky-cta-bar) .cfhb__cta:disabled{cursor:not-allowed;filter:none;background:var(--button-2-bg,var(--card));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--card) calc(l + 0.04) c h / .15));transform:none;color:var(--button-2-ink,var(--ink));border-color:var(--button-2-border,oklch(from var(--ink) l c h / 0.22));opacity:1}
:where(.cf-sticky-cta-bar) .cfhb__close{flex:none;display:grid;place-items:center;width:36px;height:36px;margin-right:-8px;border:0;border-radius:var(--button-radius,var(--radius,10px));background:var(--button-2-bg,var(--card));cursor:pointer;color:var(--button-2-ink,var(--ink));transition:background .15s ease,color .15s ease;box-shadow:var(--button-shadow,inset 0 0 0 1px var(--button-2-border,oklch(from var(--ink) l c h / 0.22)));}
:where(.cf-sticky-cta-bar) .cfhb__close:hover{background:var(--button-2-bg,var(--card));color:var(--button-2-ink,var(--ink));}
:where(.cf-sticky-cta-bar) .cfhb__close:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
@media (prefers-reduced-motion:no-preference){:where(.cf-sticky-cta-bar) .cfhb__cta:not(:disabled):after{animation:cfhb-sheen 5.5s ease-in-out 1.4s infinite}}
@keyframes cfhb-sheen{0%,72%{transform:translateX(-130%)}100%{transform:translateX(130%)}}
@media (prefers-reduced-motion:reduce){.cf-sticky-cta-bar{animation:none}:where(.cf-sticky-cta-bar) .cfhb__cta,:where(.cf-sticky-cta-bar) .cfhb__close{transition:none}:where(.cf-sticky-cta-bar) .cfhb__cta:hover:not(:disabled),:where(.cf-sticky-cta-bar) .cfhb__cta.is-hover,:where(.cf-sticky-cta-bar) .cfhb__cta:active:not(:disabled),:where(.cf-sticky-cta-bar) .cfhb__cta.is-active{transform:none}}
@media (max-width:640px){:where(.cf-sticky-cta-bar) .cfhb__row{flex-wrap:wrap;gap:10px 8px;padding:10px 16px 12px}:where(.cf-sticky-cta-bar) .cfhb__msg{flex:1 1 0;flex-direction:column;align-items:flex-start;row-gap:5px}:where(.cf-sticky-cta-bar) .cfhb__headline{font-size:16px}:where(.cf-sticky-cta-bar) .cfhb__now{font-size:20px}:where(.cf-sticky-cta-bar) .cfhb__close{order:2;align-self:flex-start;margin:-6px -8px 0 0}:where(.cf-sticky-cta-bar) .cfhb__cta{order:3;flex:1 1 100%;min-height:46px}}
@media (max-width:480px){:where(.cf-sticky-cta-bar) .cfhb__sub{display:none;color:var(--band-ink,#fff)}}
`
pieces/urgency/sticky-cta-bar/specimen.tsx 81 lines
import * as React from "react"
import defaults from "../../studio-defaults.json"
import { StickyCtaBar } from "../sticky-cta-bar"
export const states = ["default", "hover", "active", "disabled"]
const sample = defaults.sample
export default function StickyCtaBarSpecimen({ state = "default" }: { state?: string }) {
const preview = state === "hover" || state === "active" || state === "disabled" ? state : "default"
return (
<div
className="w-full px-2 py-6 sm:p-8"
style={{
color: "var(--ink, #101828)",
}}
>
<div
className="mx-auto max-w-5xl overflow-hidden rounded-[var(--card-radius,var(--radius,16px))] border border-[var(--card-border,color-mix(in_oklch,var(--ink)_12%,transparent))] shadow-[var(--card-shadow,var(--shadow-md))]"
style={{ background: "var(--card)" }}
>
<div
className="flex h-10 items-center gap-2 border-b border-[var(--card-border,color-mix(in_oklch,var(--ink)_12%,transparent))] px-4"
style={{ background: "color-mix(in oklch,var(--ink) 5%,var(--card))" }}
aria-hidden="true"
>
<span className="h-3 w-3 rounded-full bg-[var(--cta)]" />
<span className="h-3 w-3 rounded-full bg-[var(--marker,#fae37c)]" />
<span className="h-3 w-3 rounded-full bg-[var(--accent-fill,var(--accent))]" />
<span
className="ml-3 h-6 max-w-xs flex-1 rounded-md"
style={{
background: "var(--card)",
boxShadow: "inset 0 0 0 1px oklch(from var(--ink) l c h / 0.1)",
}}
/>
</div>
<div className="relative max-h-[300px] overflow-y-auto">
<StickyCtaBar
headline={sample.name}
price={sample.price}
compareAt={sample.regularPrice}
subline={sample.note}
ctaLabel={sample.label}
onAction={() => {}}
state={preview}
/>
<div className="px-5 pb-7 pt-6 sm:px-8 sm:pb-9 sm:pt-8">
<h2
className="m-0 [text-wrap:balance]"
style={{
fontWeight: "var(--display-weight, 800)",
letterSpacing: "var(--display-tracking, -0.025em)",
textTransform: "var(--display-case, none)" as React.CSSProperties["textTransform"],
fontSize: "clamp(1.5rem, 2.6vw, 2rem)",
lineHeight: 1.1,
color: "var(--ink)",
marginBottom: 12,
}}
>
{sample.headline}
</h2>
<p
className="m-0 max-w-[60ch] [text-wrap:pretty]"
style={{
fontSize: "clamp(1.0625rem, 1.25vw, 1.125rem)",
lineHeight: 1.5,
color: "var(--muted)",
}}
>
{sample.lead}
</p>
</div>
</div>
</div>
</div>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalStickyCtaBar |
string |
Default "The Funnel Starter Kit"
|
subline OptionalStickyCtaBar |
string |
|
price OptionalStickyCtaBar |
string |
|
compareAt OptionalStickyCtaBar |
string |
|
ctaLabel OptionalStickyCtaBar |
string |
Default "Yes! Give Me Access"
|
href OptionalStickyCtaBar |
string |
|
onAction OptionalStickyCtaBar |
() => void |
|
ctaHref OptionalStickyCtaBar |
string |
|
onCtaClick OptionalStickyCtaBar |
() => void |
|
dismissible OptionalStickyCtaBar |
boolean |
Default true
|
onDismiss OptionalStickyCtaBar |
() => void |
|
disabled OptionalStickyCtaBar |
boolean |
Default false
|
position OptionalStickyCtaBar |
"sticky" | "fixed" |
Default "sticky"
|
previewState OptionalStickyCtaBar |
"hover" | "active" |
|
state OptionalStickyCtaBar |
"default" | "hover" | "active" | "disabled" |
|
copy OptionalStickyCtaBar |
Partial<typeof STICKY_CTA_BAR_COPY> |
|
className OptionalStickyCtaBar |
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-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.
This piece reads no image slots.
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB