Flip Countdown 1
Shows a real countdown beside the price and the action, so the visitor sees what they lose at zero.
Use it in a prompt
Use urgency/flip-countdown 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/flip-countdown.tsx. - Import it and pass your copy and images (Props tab):
import { FlipCountdown } from "@/components/funneldna/urgency/flip-countdown"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/urgency/flip-countdown/component.tsx 536 lines
// Shows a real countdown beside the price and the action, so the visitor sees what they lose at zero.
// layout: hello-strip
// Split-flap deadline block: headline, a real countdown on flipping tiles, then the price and the action stacked in one centred column, so the visitor sees what they lose at zero.
// At zero it shows an honest closed state or hides itself. Without a real deadline it never shows a running clock.
import * as React from 'react'
import { CalendarClock, Hourglass, Lock, ShieldCheck, TimerOff } from 'lucide-react'
import { useReducedMotion } from 'motion/react'
type UnitKey = 'days' | 'hours' | 'minutes' | 'seconds'
export type FlipCountdownProps = {
/** The real deadline (ISO string, timestamp or Date). Without one the strip shows its unset state, never a fake clock. */
deadline?: string | number | Date
/** Headline over the clock; wrap the key phrase in <mark> for one marker stroke. */
headline?: React.ReactNode
/** What happens when the timer reaches zero. */
atZero?: React.ReactNode
headingLevel?: 2 | 3 | 4
/** Labels under the tiles. */
labels?: Partial<Record<UnitKey, string>>
/** Today's price, e.g. '$47'. */
price?: string
/** Struck regular value, e.g. '$97'. */
regularPrice?: string
/** Screen-reader label for today's price. */
priceLabel?: string
/** Screen-reader label for the struck value. */
regularPriceLabel?: string
/** Savings line; {amount} is replaced with the difference of the two supplied prices. */
savingsTemplate?: string
/** One-line button label. */
label?: string
/** One short reassurance line under the button. */
reassurance?: string
href?: string
onAction?: (event: React.MouseEvent<HTMLElement>) => void
/** 'closed' keeps the strip with the ended message; 'hide' removes it at zero. */
whenEnded?: 'closed' | 'hide'
/** Called once when the real deadline passes (wire a redirect or reload here). */
onEnd?: () => void
endedHeadline?: React.ReactNode
endedMessage?: React.ReactNode
endedLabel?: string
unsetHeadline?: React.ReactNode
unsetMessage?: React.ReactNode
/** Screen-reader time; placeholders {days} {hours} {minutes} {seconds}. */
spokenTemplate?: string
/** 'disabled' previews the closed state, 'error' the missing-deadline state. */
state?: 'default' | 'hover' | 'active' | 'disabled' | 'error'
className?: string
}
const UNITS: UnitKey[] = ['days', 'hours', 'minutes', 'seconds']
export function FlipCountdown(props: FlipCountdownProps) {
const {
deadline,
headline = 'This offer ends in',
atZero = 'When the timer hits zero, this price is gone.',
headingLevel = 3,
labels,
price,
regularPrice,
priceLabel = 'Today',
regularPriceLabel = 'Regular price',
savingsTemplate = 'You save {amount}',
label = 'Yes! Give Me Instant Access',
reassurance,
href,
onAction,
whenEnded = 'closed',
onEnd,
endedHeadline = 'This offer has ended',
endedMessage = 'The timer reached zero, so this price is no longer available.',
endedLabel = 'Offer closed',
unsetHeadline = 'Set a deadline to start the countdown.',
unsetMessage = 'At zero, the timer hides or shows a closed state.',
spokenTemplate = '{days} days, {hours} hours, {minutes} minutes and {seconds} seconds left',
state = 'default',
className,
} = props
const names: Record<UnitKey, string> = { days: 'Days', hours: 'Hours', minutes: 'Minutes', seconds: 'Seconds', ...labels } as Record<UnitKey, string>
const target = toTime(deadline)
const unset = state === 'error' || target === null
const forcedEnded = state === 'disabled' && !unset
const reduce = useReducedMotion()
const [now, setNow] = React.useState(() => Date.now())
React.useEffect(() => {
if (unset || forcedEnded || target === null) return
let timer: number | undefined
const tick = () => {
const t = Date.now()
setNow(t)
if (t < target) timer = window.setTimeout(tick, 1000 - (t % 1000) + 15)
}
tick()
return () => window.clearTimeout(timer)
}, [target, unset, forcedEnded])
const remaining = unset || forcedEnded || target === null ? 0 : Math.max(0, target - now)
const ended = !unset && (forcedEnded || remaining <= 0)
const fired = React.useRef(false)
React.useEffect(() => {
if (ended && !forcedEnded && !fired.current) {
fired.current = true
onEnd?.()
}
}, [ended, forcedEnded, onEnd])
if (ended && !forcedEnded && whenEnded === 'hide') return null
const total = Math.floor(remaining / 1000)
const parts: Record<UnitKey, number> = {
days: Math.floor(total / 86400),
hours: Math.floor((total % 86400) / 3600),
minutes: Math.floor((total % 3600) / 60),
seconds: total % 60,
}
const show = (n: number) => (unset ? '––' : String(n).padStart(2, '0'))
const spoken = unset
? ''
: fill(spokenTemplate, {
days: String(parts.days),
hours: String(parts.hours),
minutes: String(parts.minutes),
seconds: String(parts.seconds),
})
const H = ('h' + headingLevel) as 'h2' | 'h3' | 'h4'
const title = unset ? unsetHeadline : ended ? endedHeadline : headline
const note = unset ? unsetMessage : ended ? endedMessage : atZero
const NoteIcon = unset ? CalendarClock : ended ? TimerOff : Hourglass
const saved = savings(price, regularPrice)
const showPrice = !ended && !!price
const showAssure = !ended && !!reassurance
const hasAct = showPrice || !!label || showAssure
const btnState = state === 'hover' || state === 'active' ? state : undefined
const rootClass = ['cf-flip-countdown', hasAct && 'has-act', ended && 'is-ended', unset && 'is-unset', className]
.filter(Boolean)
.join(' ')
return (
<div className={rootClass} data-state={state}>
<style>{CSS}</style>
<div className='fc-in'>
<div className='fc-msg'>
<H className='fc-head'>{title}</H>
{note ? (
<p className='fc-note'>
<NoteIcon aria-hidden='true' />
<span>{note}</span>
</p>
) : null}
</div>
<div className='fc-board' role='timer' aria-live='off'>
{spoken ? <span className='fc-sr'>{spoken}</span> : null}
{UNITS.map((key, i) => (
<React.Fragment key={key}>
{i > 0 ? (
<span className='fc-colon' aria-hidden='true'>
<span />
<span />
</span>
) : null}
<div className='fc-unit' style={{ '--i': i } as React.CSSProperties}>
<FlapTile value={show(parts[key])} animate={!reduce} />
<span className='fc-label' aria-hidden='true'>{names[key]}</span>
</div>
</React.Fragment>
))}
</div>
{hasAct ? (
<div className='fc-act'>
{showPrice ? (
<p className='fc-price'>
{regularPrice ? (
<s className='fc-was'>
<span className='fc-sr'>{regularPriceLabel} </span>
{regularPrice}
</s>
) : null}
<span className='fc-now'>
<span className='fc-sr'>{priceLabel} </span>
{price}
</span>
{saved ? <span className='fc-save'>{fill(savingsTemplate, { amount: saved })}</span> : null}
</p>
) : null}
{label ? (
ended ? (
<button type='button' className='fc-btn' disabled>
<Lock aria-hidden='true' />
{endedLabel}
</button>
) : href ? (
<a className='fc-btn' href={href} data-state={btnState} onClick={onAction}>
{label}
</a>
) : (
<button type='button' className='fc-btn' data-state={btnState} onClick={onAction}>
{label}
</button>
)
) : null}
{showAssure ? (
<p className='fc-assure'>
<ShieldCheck aria-hidden='true' />
<span>{reassurance}</span>
</p>
) : null}
</div>
) : null}
</div>
<p className='fc-sr' aria-live='polite'>{ended && !forcedEnded ? endedHeadline : null}</p>
</div>
)
}
export default FlipCountdown
function FlapTile({ value, animate }: { value: string; animate: boolean }) {
const [face, setFace] = React.useState({ prev: value, curr: value, n: 0 })
React.useEffect(() => {
setFace((f) => (f.curr === value ? f : { prev: animate ? f.curr : value, curr: value, n: f.n + 1 }))
}, [value, animate])
const flipping = animate && face.prev !== face.curr
const settle = () => setFace((f) => (f.prev === f.curr ? f : { ...f, prev: f.curr }))
return (
<span className='fc-tile' aria-hidden='true'>
<span className='fc-sizer'>{face.curr}</span>
<span className='fc-half fc-half--top'>
<span className='fc-num'>{face.curr}</span>
</span>
<span className='fc-half fc-half--bot'>
<span className='fc-num'>{flipping ? face.prev : face.curr}</span>
</span>
{flipping ? (
<>
<span key={'t' + face.n} className='fc-half fc-half--top fc-flap fc-flap--top'>
<span className='fc-num'>{face.prev}</span>
</span>
<span key={'b' + face.n} className='fc-half fc-half--bot fc-flap fc-flap--bot' onAnimationEnd={settle}>
<span className='fc-num'>{face.curr}</span>
</span>
</>
) : null}
<span className='fc-seam' />
</span>
)
}
function toTime(d?: string | number | Date): number | null {
if (d === undefined || d === '') return null
const t = d instanceof Date ? d.getTime() : typeof d === 'number' ? d : Date.parse(d)
return Number.isFinite(t) ? t : null
}
function fill(template: string, values: Record<string, string>): string {
return Object.keys(values).reduce((out, k) => out.split('{' + k + '}').join(values[k]), template)
}
function amount(s?: string): number | null {
if (!s) return null
const n = parseFloat(s.replace(/[^0-9.]/g, ''))
return Number.isFinite(n) ? n : null
}
function savings(price?: string, regular?: string): string | null {
const p = amount(price)
const r = amount(regular)
if (!price || p === null || r === null || r <= p) return null
const prefix = (price.match(/^[^0-9.]*/) || [''])[0].trim()
const d = r - p
return prefix + (Number.isInteger(d) ? String(d) : d.toFixed(2))
}
const SHADOW_MD = 'var(--shadow-md, 0 1px 2px oklch(0.22 0.03 256 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 256 / 0.2))'
const CSS = `
.cf-flip-countdown {
--fc-tile: var(--band, oklch(0.27 0.067 256));
--fc-tile-ink: var(--band-ink, oklch(1 0 0));
--fc-r: var(--card-radius, var(--radius, 14px));
container: cf-flip-countdown / inline-size;
position: relative;
box-sizing: border-box;
width: 100%;
color: var(--ink);
font-family: var(--font-body);
background: var(--card, oklch(1 0 0));
border: 1px solid var(--card-border, color-mix(in oklch, var(--ink) 12%, transparent));
border-radius: var(--fc-r);
box-shadow: var(--card-shadow, ${SHADOW_MD});
}
.cf-flip-countdown *, .cf-flip-countdown *::before, .cf-flip-countdown *::after { box-sizing: border-box; }
.cf-flip-countdown .fc-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
/* One centred column: headline, then the clock, then price and action. */
.cf-flip-countdown .fc-in {
--fc-digit: clamp(2.125rem, 0.75rem + 6.4cqi, 4rem);
display: flex;
flex-direction: column;
align-items: center;
gap: 1.75rem;
padding: 2rem 1.5rem;
text-align: center;
}
.cf-flip-countdown .fc-msg { width: 100%; min-width: 0; max-width: 40rem; }
.cf-flip-countdown .fc-head {
margin: 0;
color: var(--ink);
font-family: var(--font-display);
font-weight: var(--display-weight, 800);
text-transform: var(--display-case, none);
letter-spacing: var(--display-tracking, -0.02em);
font-size: clamp(1.625rem, 1.25rem + 1.6cqi, 2.5rem);
line-height: 1.1;
text-wrap: balance;
}
.cf-flip-countdown .fc-head mark {
color: var(--field-ink, var(--ink));
color: oklch(from var(--marker, #fae37c) clamp(0.16, (0.64 - l) * 100, 0.97) 0.02 h);
background: linear-gradient(100deg, transparent 0 0.08em, var(--marker, #fae37c) 0.08em calc(100% - 0.06em), transparent calc(100% - 0.06em)) 0 70% / 100% 0.94em no-repeat;
padding: 0 0.14em;
margin: 0 -0.06em;
border-radius: 0.2em 0.32em 0.24em 0.36em;
-webkit-box-decoration-break: clone;
box-decoration-break: clone;
}
.cf-flip-countdown .fc-note {
display: block;
text-align: center;
margin: 0.875rem auto 0;
max-width: 34rem;
color: var(--muted);
font-size: 1.0625rem;
font-weight: 500;
line-height: 1.45;
text-wrap: pretty;
}
.cf-flip-countdown .fc-note svg { width: 1.125rem; height: 1.125rem; display: inline-block; vertical-align: -0.15em; margin-inline-end: .4em; color: var(--danger); }
.cf-flip-countdown.is-unset .fc-note svg { color: var(--warning); }
.cf-flip-countdown .fc-board { display: flex; align-items: flex-start; justify-content: center; gap: 0.75rem; width: 100%; }
.cf-flip-countdown .fc-unit {
display: grid;
justify-items: center;
gap: 0.75rem;
flex: 0 0 auto;
min-width: 0;
animation: fc-rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
animation-delay: calc(var(--i, 0) * 70ms);
}
.cf-flip-countdown .fc-label {
color: var(--ink);
font-family: var(--font-body);
font-size: 0.875rem;
font-weight: 800;
letter-spacing: 0.08em;
line-height: 1.2;
text-transform: uppercase;
white-space: nowrap;
}
.cf-flip-countdown .fc-colon { display: flex; flex-direction: column; justify-content: center; gap: 0.3em; height: 1.42em; font-size: var(--fc-digit); }
.cf-flip-countdown .fc-colon span { display: block; width: 0.1em; height: 0.1em; border-radius: 50%; background: var(--muted); }
.cf-flip-countdown .fc-tile {
position: relative;
display: block;
height: 1.42em;
color: var(--fc-tile-ink);
font-family: var(--font-display);
font-size: var(--fc-digit);
font-weight: var(--display-weight, 800);
font-variant-numeric: tabular-nums;
line-height: 1;
letter-spacing: -0.02em;
background: var(--fc-tile);
border-radius: calc(var(--fc-r) * 0.75);
perspective: 3.5em;
box-shadow: inset 0 0 0 1px oklch(from var(--fc-tile) calc(l - 0.06) c h), ${SHADOW_MD};
}
.cf-flip-countdown .fc-sizer { display: block; visibility: hidden; padding: 0 0.2em; line-height: 1.42; white-space: nowrap; }
.cf-flip-countdown .fc-half { position: absolute; left: 0; right: 0; height: 50%; overflow: hidden; border-radius: inherit; backface-visibility: hidden; }
.cf-flip-countdown .fc-half--top {
top: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
transform-origin: 50% 100%;
background: linear-gradient(180deg, oklch(from var(--fc-tile) calc(l + 0.06) c h), oklch(from var(--fc-tile) calc(l + 0.02) c h));
box-shadow: inset 0 1px 0 oklch(from var(--fc-tile) calc(l + 0.18) c h / 0.6);
}
.cf-flip-countdown .fc-half--bot {
bottom: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
transform-origin: 50% 0;
background: linear-gradient(180deg, var(--fc-tile), oklch(from var(--fc-tile) calc(l - 0.035) c h));
}
.cf-flip-countdown .fc-num { position: absolute; left: 0; right: 0; height: 200%; display: flex; align-items: center; justify-content: center; padding: 0 0.2em; white-space: nowrap; }
.cf-flip-countdown .fc-half--top .fc-num { top: 0; }
.cf-flip-countdown .fc-half--bot .fc-num { bottom: 0; }
.cf-flip-countdown .fc-seam {
position: absolute;
z-index: 3;
left: 0;
right: 0;
top: 50%;
height: 2px;
margin-top: -1px;
background: oklch(from var(--fc-tile) calc(l - 0.14) c h);
box-shadow: 0 1px 0 oklch(from var(--fc-tile) calc(l + 0.08) c h / 0.45);
}
.cf-flip-countdown .fc-seam::before, .cf-flip-countdown .fc-seam::after {
content: '';
position: absolute;
top: 50%;
width: 0.09em;
height: 0.3em;
margin-top: -0.15em;
border-radius: 0.04em;
background: linear-gradient(90deg, oklch(from var(--fc-tile) calc(l + 0.34) calc(c * 0.4) h), oklch(from var(--fc-tile) calc(l + 0.12) c h));
box-shadow: 0 1px 2px oklch(from var(--shadow, oklch(0.22 0.03 256)) l c h / 0.4);
}
.cf-flip-countdown .fc-seam::before { left: -0.035em; }
.cf-flip-countdown .fc-seam::after { right: -0.035em; }
.cf-flip-countdown .fc-flap { z-index: 2; }
.cf-flip-countdown .fc-flap::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: oklch(from var(--shadow, oklch(0.22 0.03 256)) l c h / 0.45); }
.cf-flip-countdown .fc-flap--top { animation: fc-fold 0.28s cubic-bezier(0.55, 0.05, 0.85, 0.35) both; }
.cf-flip-countdown .fc-flap--top::after { animation: fc-dim 0.28s ease-in both; }
.cf-flip-countdown .fc-flap--bot { animation: fc-land 0.32s cubic-bezier(0.15, 0.65, 0.3, 1) 0.26s both; }
.cf-flip-countdown .fc-flap--bot::after { animation: fc-undim 0.32s ease-out 0.26s both; }
/* Price, button and reassurance stack under the clock, centred. */
.cf-flip-countdown .fc-act { display: flex; flex-direction: column; align-items: center; gap: 0.875rem; width: 100%; max-width: 26rem; }
.cf-flip-countdown .fc-price { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 0.5rem 0.75rem; margin: 0; }
.cf-flip-countdown .fc-was {
color: var(--muted);
font-size: 1.375rem;
font-weight: 700;
text-decoration: line-through;
text-decoration-color: var(--danger);
text-decoration-thickness: 2px;
}
.cf-flip-countdown .fc-now {
color: var(--ink);
font-family: var(--font-display);
font-weight: var(--display-weight, 800);
font-size: 2.75rem;
font-variant-numeric: tabular-nums;
line-height: 1;
letter-spacing: -0.02em;
}
.cf-flip-countdown .fc-save { flex-basis: 100%; margin-top: 0.375rem; color: var(--success); font-size: 0.9375rem; font-weight: 700; line-height: 1.3; text-align: center; }
.cf-flip-countdown .fc-btn {
--fc-bl: 0;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
width: 100%;
min-height: 3.75rem;
margin: 0;
padding: 0.9375rem 1.25rem;
border: 1px solid oklch(from var(--button-bg, var(--cta)) calc(l - 0.12) c h);
border-radius: var(--button-radius, var(--radius, 12px));
background: linear-gradient(180deg, oklch(from var(--button-bg, var(--cta)) calc(l + 0.04 + var(--fc-bl)) c h), oklch(from var(--button-bg-2, var(--cta-2)) calc(l + var(--fc-bl)) c h));
color: var(--button-ink, var(--cta-ink));
font-family: var(--button-font, var(--font-display));
font-size: 1.1875rem;
font-weight: var(--button-weight, 800);
line-height: 1.15;
letter-spacing: -0.005em;
text-transform: var(--button-case, none);
text-align: center;
text-wrap: balance;
text-decoration: none;
text-shadow: var(--button-text-shadow, none);
box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l + 0.12) c h / 0.6), inset 0 -3px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.16) c h), ${SHADOW_MD});
cursor: pointer;
-webkit-tap-highlight-color: transparent;
transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cf-flip-countdown .fc-btn svg { flex: none; width: 1.125rem; height: 1.125rem; }
.cf-flip-countdown .fc-btn:hover:not(:disabled), .cf-flip-countdown .fc-btn[data-state=hover] { --fc-bl: -0.04; transform: translateY(-1px); }
.cf-flip-countdown .fc-btn:active:not(:disabled), .cf-flip-countdown .fc-btn[data-state=active] {
--fc-bl: -0.09;
transform: translateY(1px);
box-shadow: inset 0 2px 4px oklch(from var(--button-bg, var(--cta)) calc(l - 0.22) c h / 0.5), var(--shadow-sm, 0 1px 1px oklch(0.22 0.03 256 / 0.18), 0 1px 3px oklch(0.22 0.03 256 / 0.14));
}
.cf-flip-countdown .fc-btn:focus-visible { outline: 3px solid var(--field-focus, var(--accent)); outline-offset: 3px; }
.cf-flip-countdown .fc-btn:disabled {
border-color: var(--button-2-border, transparent);
background: var(--button-2-bg, var(--secondary));
color: var(--button-2-ink, var(--secondary-ink));
text-shadow: none;
box-shadow: var(--button-2-shadow, var(--shadow-sm));
cursor: not-allowed;
transform: none;
}
.cf-flip-countdown .fc-assure { display: flex; align-items: center; justify-content: center; gap: 0.375rem; margin: 0; color: var(--muted); font-size: 0.875rem; font-weight: 600; line-height: 1.3; text-wrap: pretty; }
.cf-flip-countdown .fc-assure svg { flex: none; width: 1rem; height: 1rem; color: var(--success); }
@container cf-flip-countdown (max-width: 559px) {
.cf-flip-countdown .fc-in { gap: 1.375rem; padding: 1.5rem 1rem 1.375rem; }
.cf-flip-countdown .fc-note { font-size: 1rem; }
.cf-flip-countdown .fc-board { gap: 0.5rem; }
.cf-flip-countdown .fc-colon { display: none; }
.cf-flip-countdown .fc-unit { flex: 1 1 0; }
.cf-flip-countdown .fc-label { letter-spacing: 0.03em; }
.cf-flip-countdown .fc-act { max-width: none; }
.cf-flip-countdown .fc-now { font-size: 2.5rem; }
.cf-flip-countdown .fc-btn { font-size: 1.125rem; }
}
@container cf-flip-countdown (min-width: 760px) {
.cf-flip-countdown .fc-in { gap: 2rem; padding: 2.5rem 2.5rem 2.25rem; }
.cf-flip-countdown .fc-board { gap: 1rem; }
}
@keyframes fc-rise { from { opacity: 0.82; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fc-fold { from { transform: rotateX(0deg); } to { transform: rotateX(-90deg); } }
@keyframes fc-land { from { transform: rotateX(90deg); } to { transform: rotateX(0deg); } }
@keyframes fc-dim { from { opacity: 0; } to { opacity: 1; } }
@keyframes fc-undim { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
/* !important kept so reduced motion wins over every per-element animation and delay above. */
.cf-flip-countdown *, .cf-flip-countdown *::before, .cf-flip-countdown *::after { animation: none !important; transition: none !important; }
}
`
pieces/urgency/flip-countdown/specimen.tsx 27 lines
import * as React from 'react'
import { FlipCountdown } from '../flip-countdown'
import defaults from '../../studio-defaults.json'
export const states = ['default', 'hover', 'active', 'disabled', 'error']
type SpecimenState = 'default' | 'hover' | 'active' | 'disabled' | 'error'
export default function FlipCountdownSpecimen({ state = 'default' }: { state?: SpecimenState }) {
const sample = defaults.sample
// Studio preview only: the clock starts 2 days 14 hours 37 minutes out when the preview opens.
// A real page passes its real deadline; 'disabled' previews the closed state, 'error' the unset state.
const [deadline] = React.useState(() => Date.now() + ((2 * 24 + 14) * 3600 + 37 * 60 + 12) * 1000)
return (
<FlipCountdown
state={state}
deadline={deadline}
headline={<>Your <mark>{sample.price} price</mark> ends in</>}
atZero={'When the timer hits zero, ' + sample.name + ' goes back to ' + sample.regularPrice + '.'}
endedMessage={'The ' + sample.price + ' price for ' + sample.name + ' is no longer available.'}
price={sample.price}
regularPrice={sample.regularPrice}
label={sample.label}
reassurance={sample.guarantee}
/>
)
}
| Name | Type | Details |
|---|---|---|
deadline OptionalFlipCountdown |
string | number | Date |
|
headline OptionalFlipCountdown |
React.ReactNode |
|
atZero OptionalFlipCountdown |
React.ReactNode |
|
headingLevel OptionalFlipCountdown |
2 | 3 | 4 |
|
labels OptionalFlipCountdown |
Partial<Record<UnitKey, string>> |
|
price OptionalFlipCountdown |
string |
|
regularPrice OptionalFlipCountdown |
string |
|
priceLabel OptionalFlipCountdown |
string |
|
regularPriceLabel OptionalFlipCountdown |
string |
|
savingsTemplate OptionalFlipCountdown |
string |
|
label OptionalFlipCountdown |
string |
|
reassurance OptionalFlipCountdown |
string |
|
href OptionalFlipCountdown |
string |
|
onAction OptionalFlipCountdown |
(event: React.MouseEvent<HTMLElement>) => void |
|
whenEnded OptionalFlipCountdown |
'closed' | 'hide' |
|
onEnd OptionalFlipCountdown |
() => void |
|
endedHeadline OptionalFlipCountdown |
React.ReactNode |
|
endedMessage OptionalFlipCountdown |
React.ReactNode |
|
endedLabel OptionalFlipCountdown |
string |
|
unsetHeadline OptionalFlipCountdown |
React.ReactNode |
|
unsetMessage OptionalFlipCountdown |
React.ReactNode |
|
spokenTemplate OptionalFlipCountdown |
string |
|
state OptionalFlipCountdown |
'default' | 'hover' | 'active' | 'disabled' | 'error' |
|
className OptionalFlipCountdown |
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-border--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-focus--field-ink- 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.
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