Countdown Timer 1
Counts down to a real, supplied deadline in classic dark tiles, with the reason the offer ends.
Use it in a prompt
Use urgency/countdown-timer-1 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/countdown-timer-1.tsx. - Import it and pass your copy and images (Props tab):
import { CountdownTimer1 } from "@/components/funneldna/urgency/countdown-timer-1"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/urgency/countdown-timer-1/component.tsx 89 lines
// Counts down to a supplied deadline, explains its reason and stops when the offer expires.
import * as React from "react";
export type CountdownTimer1Props = {
/** A real supplied timestamp, Date or parseable date string; no deadline is invented. Give strings an explicit
* offset (e.g. "2026-11-30T23:59:00-07:00"): an offset-less string is read in the visitor's zone. */
deadline: Date | string | number;
headline?: React.ReactNode;
reason: React.ReactNode;
expiredText?: string;
showEndDate?: boolean;
/** The offer's IANA time zone (e.g. "America/Denver"). The end date prints in this zone instead of the visitor's;
* the countdown itself is zone-independent. An unknown zone hides the end date rather than print a wrong one. */
timeZone?: string;
/** Zone label printed after the end date when `timeZone` is set (e.g. "Mountain time"); defaults to the short zone name (e.g. "MST"). */
timeZoneLabel?: string;
/** The end-date template replaces {date} with the localized deadline (in `timeZone`, with its label, when set). */
copy?: Partial<typeof COUNTDOWN_TIMER_1_COPY>;
className?: string;
};
export function CountdownTimer1({
deadline, headline, reason, expiredText = "This offer has ended.", showEndDate = true, timeZone, timeZoneLabel,
copy: copyOverrides, className = "",
}: CountdownTimer1Props) {
const copy = { ...COUNTDOWN_TIMER_1_COPY, ...copyOverrides };
const end = deadline instanceof Date ? deadline.getTime() : typeof deadline === "number" ? deadline : Date.parse(deadline)
const [now, setNow] = React.useState<number | null>(null)
const [endLabel, setEndLabel] = React.useState<string | null>(null)
React.useEffect(() => {
if (!Number.isFinite(end)) return
setNow(Date.now())
try {
// Formatted after mount, so server and client render the same markup.
const options: Intl.DateTimeFormatOptions = { weekday: "long", month: "long", day: "numeric", hour: "numeric", minute: "2-digit" }
if (!timeZone) setEndLabel(new Intl.DateTimeFormat(undefined, options).format(end))
else {
const zone = timeZoneLabel || new Intl.DateTimeFormat(undefined, { timeZone, timeZoneName: "short" }).formatToParts(end).find((p) => p.type === "timeZoneName")?.value
setEndLabel(new Intl.DateTimeFormat(undefined, { ...options, timeZone }).format(end) + (zone ? ` ${zone}` : ""))
}
} catch { setEndLabel(null) }
if (end <= Date.now()) return
const timer = setInterval(() => {
const tick = Date.now()
setNow(tick)
if (tick >= end) clearInterval(timer)
}, 1000)
return () => clearInterval(timer)
}, [end, timeZone, timeZoneLabel])
const remaining = now === null ? null : Math.max(0, Math.ceil((end - now) / 1000))
const values = remaining === null ? null : [Math.floor(remaining / 86400), Math.floor(remaining / 3600) % 24, Math.floor(remaining / 60) % 60, remaining % 60]
const expired = Number.isFinite(end) && remaining === 0
return <div className={`cf-countdown-timer-1 cf-countdown-classic ${className}`}>
<style>{COUNTDOWN_TIMER_1_CSS}</style>
{headline && !expired ? <h2 className="cf-countdown-classic-headline">{headline}</h2> : null}
{!Number.isFinite(end) ? <p role="status" className="cf-countdown-classic-expired">{copy.unavailable}</p> : expired ? <p role="status" className="cf-countdown-classic-expired">{expiredText}</p> : <div role="timer" aria-label={copy.timerLabel} aria-live="off" className="cf-countdown-classic-units">
{[copy.days, copy.hours, copy.minutes, copy.seconds].map((label, i) => <div className="cf-countdown-classic-unit" key={label}>
<span className="cf-countdown-classic-digits">{values ? String(values[i]).padStart(2, "0") : copy.pending}</span>
<span className="cf-countdown-classic-label">{label}</span>
</div>)}
</div>}
{showEndDate && endLabel && !expired ? <p className="cf-countdown-classic-ends">{copy.endDateTemplate.replaceAll("{date}", endLabel)}</p> : null}
{!expired ? <p className="cf-countdown-classic-reason">{reason}</p> : null}
</div>
}
export default CountdownTimer1;
const COUNTDOWN_TIMER_1_COPY = {
unavailable: "Deadline unavailable.", timerLabel: "Time remaining",
days: "Days", hours: "Hours", minutes: "Mins", seconds: "Secs", pending: "--",
endDateTemplate: "Ends {date}",
};
// Neutral black/white alpha shadows retain the approved depth.
const COUNTDOWN_TIMER_1_CSS = `
.cf-countdown-timer-1{box-sizing:border-box;display:grid;gap:1.25rem;width:100%;max-width:38rem;margin-inline:auto;color:var(--ink,#101828);font-family:var(--font-body,Arial,sans-serif);text-align:center;overflow-wrap:break-word}
.cf-countdown-timer-1 *{box-sizing:border-box}
:where(.cf-countdown-timer-1) .cf-countdown-classic-headline{margin:0 auto;font-family:var(--font-display,Arial,sans-serif);font-size:clamp(1.75rem,1.05rem + 2.8vw,2.75rem);font-weight:var(--display-weight,900);line-height:1.08;letter-spacing:var(--display-tracking,-.02em);text-wrap:balance;color:var(--ink,#101828);text-transform:var(--display-case,none)}
:where(.cf-countdown-timer-1) .cf-countdown-classic-units{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:clamp(.5rem,2vw,.875rem)}
:where(.cf-countdown-timer-1) .cf-countdown-classic-unit{min-width:0;display:grid;gap:.625rem}
:where(.cf-countdown-timer-1) .cf-countdown-classic-digits{position:relative;display:block;padding:clamp(.85rem,3vw,1.15rem) .25rem;border-radius:var(--card-radius,var(--radius,.6rem));background:var(--band,#0f2747);color:var(--band-ink,#fff);border:1px solid var(--card-border,oklch(from var(--band-ink) l c h / 0.12));box-shadow:var(--card-shadow,var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)));font-family:var(--font-display,Arial,sans-serif);font-size:clamp(2.1rem,9vw,3.75rem);font-weight:var(--display-weight,900);font-variant-numeric:tabular-nums;line-height:1;letter-spacing:var(--display-tracking,-.01em);overflow:hidden;border-color:var(--card-border,oklch(from var(--band-ink) l c h / 0.12));text-transform:var(--display-case,none)}
:where(.cf-countdown-timer-1) .cf-countdown-classic-digits::after{content:"";position:absolute;left:0;right:0;top:50%;height:1px;background:oklch(from var(--band-ink) l c h / 0.2)}
:where(.cf-countdown-timer-1) .cf-countdown-classic-label{font-size:.875rem;font-weight:800;letter-spacing:.1em;text-transform:uppercase;color:var(--muted,#4a5565)}
:where(.cf-countdown-timer-1) .cf-countdown-classic-ends{margin:0;font-size:clamp(1rem,.95rem + .3vw,1.125rem);font-weight:800;color:var(--ink);text-wrap:balance}
:where(.cf-countdown-timer-1) .cf-countdown-classic-reason{margin:0 auto;max-width:34rem;font-size:clamp(1.0625rem,1rem + .35vw,1.25rem);line-height:1.55;color:var(--muted,#4a5565);text-wrap:pretty}
:where(.cf-countdown-timer-1) .cf-countdown-classic-reason strong{color:var(--ink,#101828);font-weight:800}
:where(.cf-countdown-timer-1) .cf-countdown-classic-expired{margin:0;padding:1.1rem 1.25rem;border-radius:var(--card-radius,var(--radius,.6rem));background:color-mix(in oklch,var(--band) 7%,var(--card));border:1px solid oklch(from var(--band,#0f2747) l c h / 0.18);font-family:var(--font-display,Arial,sans-serif);font-size:clamp(1.25rem,1rem + 1vw,1.625rem);font-weight:var(--display-weight,900);color:var(--ink,#101828);border-color:var(--card-border,oklch(from var(--ink) l c h / 0.12));box-shadow:var(--card-shadow,var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)));text-transform:var(--display-case,none)}
`;
pieces/urgency/countdown-timer-1/specimen.tsx 25 lines
import * as React from "react"
import { CountdownTimer1 } from "../countdown-timer-1"
import defaults from "../../studio-defaults.json"
export const states = ["default"]
function oneWeekOut() {
const d = new Date(Date.now() + 7 * 86400000)
d.setMinutes(0, 0, 0)
d.setHours(d.getHours() + 1)
return d.getTime()
}
export default function Specimen({ deadline }: { deadline?: Date | string | number; state?: string }) {
const [weekOut] = React.useState(oneWeekOut)
const s = defaults.sample
return <div>
<CountdownTimer1
deadline={deadline ?? weekOut}
headline={<>Your <span style={{ color: "var(--ink)" }}>{s.price}</span> price ends in:</>}
reason={<><strong>Grab {s.name} for just {s.price}</strong> (regularly {s.regularPrice}) before the clock hits zero. The guide, workbook and checklist in one instant download, backed by our {s.guarantee}.</>}
expiredText={`The ${s.price} offer for ${s.name} has ended.`}
/>
</div>
}
| Name | Type | Details |
|---|---|---|
deadline RequiredCountdownTimer1 |
Date | string | number |
|
headline OptionalCountdownTimer1 |
React.ReactNode |
|
reason RequiredCountdownTimer1 |
React.ReactNode |
|
expiredText OptionalCountdownTimer1 |
string |
Default "This offer has ended."
|
showEndDate OptionalCountdownTimer1 |
boolean |
Default true
|
timeZone OptionalCountdownTimer1 |
string |
|
timeZoneLabel OptionalCountdownTimer1 |
string |
|
copy OptionalCountdownTimer1 |
Partial<typeof COUNTDOWN_TIMER_1_COPY> |
|
className OptionalCountdownTimer1 |
string |
Default ""
|
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.
--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
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB