Contact Form 2
Call now or book later: a dark half sends urgent jobs to a huge tap-to-call number with a live open-now status worked out
Use it in a prompt
Use forms/contact-form-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/forms/contact-form-2.tsx. - Import it and pass your copy and images (Props tab):
import { ContactForm2 } from "@/components/funneldna/forms/contact-form-2"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/forms/contact-form-2/component.tsx 952 lines
// layout: split-contrast
// Call now or book later: a dark half sends urgent jobs to a huge tap-to-call number with a live open-now status worked out
// from the business hours in its own time zone; a light half takes a four-question quote request for jobs that can wait.
import * as React from "react";
import { AlertCircle, Check, Droplets, Loader2, Lock, Phone } from "lucide-react";
import { FX_HOST, Texture } from "../fx/fx";
import concrete from "../fx/textures/concrete";
export type ContactForm2Values = {
name: string;
phone: string;
/** what is wrong, in the visitor's words */
problem: string;
/** value of the chosen ContactForm2Time */
time: string;
};
/** one "best time to call" option; detail is the small line under the label */
export type ContactForm2Time = { value: string; label: string; detail?: string };
export type ContactForm2Hours = {
/** row label, e.g. "Mon–Fri" */
label: string;
/** JS weekday numbers (0 = Sunday) the row covers */
days: number[];
/** opening time, 24-hour "HH:MM" in the business's time zone */
open?: string;
/** closing time, 24-hour "HH:MM"; "24:00" for midnight, earlier than open for overnight hours */
close?: string;
/** closed all day: shows the closed label and never counts as open */
closed?: boolean;
};
export type ContactForm2Copy = {
nameLabel: string;
namePlaceholder: string;
phoneLabel: string;
phonePlaceholder: string;
problemLabel: string;
problemPlaceholder: string;
timeLabel: string;
nameError: string;
phoneError: string;
problemError: string;
timeError: string;
/** under the button when fields need fixing */
summary: string;
/** under the button when onSubmit rejects */
failed: string;
/** status text for the first moment, while the clock is read */
checking: string;
openNow: string;
/** {time} = closing time */
openUntil: string;
closedNow: string;
/** {time} = opening time later today */
opensToday: string;
/** {time} = opening time tomorrow */
opensTomorrow: string;
/** {day} = weekday name, {time} = opening time */
opensDay: string;
/** lead line above the urgent jobs list */
jobsHeading: string;
/** lead line above the hours; the time zone abbreviation follows it */
hoursHeading: string;
/** chip on the hours row that covers today in the business's time zone */
todayLabel: string;
/** hours text for a closed row */
closedLabel: string;
/** badge on the seam between the two halves */
or: string;
/** phone-width call bar, top line; {phone} */
callbarLabel: string;
/** phone-width call bar, second line */
callbarNote: string;
/** accessible name of the call links; {business}, {phone} */
callAria: string;
/** accessible name when no business name is given; {phone} */
callAriaPlain: string;
};
export type ContactForm2State = "default" | "hover" | "active" | "disabled" | "error";
export type ContactForm2Props = {
/** headline of the dark, call-now half */
callHeadline?: React.ReactNode;
/** business name under the number and in the call link's accessible name; empty hides it */
business?: string;
/** displayed phone number; empty hides the call links */
phone?: string;
/** defaults to a tel: link built from phone */
phoneHref?: string;
/** opening hours; drive the live open-now status and the hours list. Empty hides both */
hours?: ContactForm2Hours[];
/** IANA time zone of the business, e.g. "America/Denver"; defaults to the visitor's own clock */
timeZone?: string;
/** locale for times and weekday names */
locale?: string;
/** ISO date-time that pins the clock (tests and previews); omit for the live clock */
now?: string;
/** urgent problems that should call, not book; empty hides the list */
urgentJobs?: string[];
/** headline of the light, book-a-quote half; the default marks its key phrase with the highlighter */
quoteHeadline?: React.ReactNode;
quoteLead?: React.ReactNode;
/** transparent illustration beside the quote headline (wrench and pipe) */
illustrationImage?: string;
illustrationAlt?: string;
/** best-time-to-call options shown as tiles */
times?: ContactForm2Time[];
/** submit button, top line */
label?: string;
/** submit button, benefit line under the label; empty hides it */
sublabel?: string;
/** submit button text while onSubmit's promise is pending */
busyLabel?: string;
/** privacy line under the button; empty hides it */
reassurance?: string;
/** labels, placeholders, validation, status and accessible copy */
copy?: Partial<ContactForm2Copy>;
/** receives validated values; return a promise to show the sending state */
onSubmit?: (values: ContactForm2Values) => void | Promise<unknown>;
/** forced preview state: hover/active style the button, error shows validation, disabled locks the form */
state?: ContactForm2State;
className?: string;
/** id on the root section, for in-page anchors */
id?: string;
};
export function ContactForm2(props: ContactForm2Props) {
const {
callHeadline = "Water where it shouldn’t be? Call us now.",
business = "",
phone = "(555) 014-2260",
phoneHref,
hours = DEFAULT_HOURS,
timeZone,
locale = "en-US",
now,
urgentJobs = DEFAULT_JOBS,
quoteHeadline = DEFAULT_QUOTE_HEADLINE,
quoteLead = "Tell us the problem and the best time to ring. We’ll call you back with a quote.",
illustrationImage,
illustrationAlt = "",
times = DEFAULT_TIMES,
label = "Request my quote",
sublabel = "We’ll call at the time you pick",
busyLabel = "Sending…",
reassurance = "We only use your number to call you about this job.",
copy: copyProp,
onSubmit,
state = "default",
className,
id,
} = props;
const copy: ContactForm2Copy = { ...DEFAULT_COPY, ...copyProp };
const uid = React.useId();
const fid = (key: string) => uid + "-" + key;
const mounted = React.useRef(true);
const [values, setValues] = React.useState<ContactForm2Values>(EMPTY_VALUES);
const [touched, setTouched] = React.useState<Partial<Record<FieldKey, boolean>>>({});
const [attempted, setAttempted] = React.useState(false);
const [busy, setBusy] = React.useState(false);
const [failed, setFailed] = React.useState(false);
const [tick, setTick] = React.useState<Date | null>(null);
const disabled = state === "disabled";
const forced = state === "hover" || state === "active" ? state : undefined;
React.useEffect(() => {
mounted.current = true;
return () => {
mounted.current = false;
};
}, []);
React.useEffect(() => {
if (now) {
const pinned = new Date(now);
setTick(Number.isNaN(pinned.getTime()) ? new Date() : pinned);
return;
}
setTick(new Date());
const timer = window.setInterval(() => setTick(new Date()), 30000);
return () => window.clearInterval(timer);
}, [now]);
React.useEffect(() => {
if (state === "error") setAttempted(true);
}, [state]);
const windows = openWindows(hours);
const clock = tick ? zonedClock(tick, timeZone) : null;
const status = clock ? openStatus(windows, clock) : null;
const zone = tick && timeZone ? zoneLabel(tick, timeZone, locale) : "";
let statusKind: "pending" | "open" | "closed" = "pending";
let statusLead = copy.checking;
let statusDetail = "";
if (status) {
if (status.open) {
statusKind = "open";
statusLead = copy.openNow;
statusDetail = fill(copy.openUntil, { time: clockTime(status.until, locale) });
} else {
statusKind = "closed";
statusLead = copy.closedNow;
const time = clockTime(status.at, locale);
statusDetail =
status.dayOffset === 0
? fill(copy.opensToday, { time })
: status.dayOffset === 1
? fill(copy.opensTomorrow, { time })
: fill(copy.opensDay, { time, day: weekdayName(status.day, locale) });
}
}
const telHref = phoneHref ?? "tel:" + phone.replace(/[^0-9+]/g, "");
const callAria = business ? fill(copy.callAria, { business, phone }) : fill(copy.callAriaPlain, { phone });
const errors = validate(values, copy);
const shown = (key: FieldKey) => (attempted || touched[key] ? errors[key] : undefined);
const hasErrors = FIELD_ORDER.some((key) => errors[key]);
const update = (key: FieldKey, value: string) => {
setValues((v) => ({ ...v, [key]: value }));
setFailed(false);
};
const blur = (key: FieldKey) => setTouched((t) => (t[key] ? t : { ...t, [key]: true }));
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
if (disabled || busy) return;
setAttempted(true);
setFailed(false);
const first = FIELD_ORDER.find((key) => errors[key]);
if (first) {
document.getElementById(first === "time" ? fid("time-0") : fid(first))?.focus();
return;
}
if (!onSubmit) return;
const clean: ContactForm2Values = {
name: values.name.trim(),
phone: values.phone.trim(),
problem: values.problem.trim(),
time: values.time,
};
try {
const result = onSubmit(clean);
if (result && typeof (result as Promise<unknown>).then === "function") {
setBusy(true);
await result;
}
} catch {
if (mounted.current) setFailed(true);
} finally {
if (mounted.current) setBusy(false);
}
};
const fieldProps = (key: "name" | "phone" | "problem") => {
const error = shown(key);
return {
id: fid(key),
value: values[key],
disabled,
className: "cfc2-input",
"aria-invalid": error ? true : undefined,
"aria-describedby": error ? fid(key + "-error") : undefined,
onChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => update(key, e.target.value),
onBlur: () => blur(key),
};
};
return (
<section id={id} className={["cf-contact-form-2", className].filter(Boolean).join(" ")}>
<style>{CSS}</style>
<div className="cfc2-grid">
<div className="cfc2-call" style={FX_HOST}>
<Texture src={concrete} tone="band-ink" />
<div className="cfc2-call-inner">
<h2 className="cfc2-h2 cfc2-rise">{callHeadline}</h2>
{windows.length > 0 && (
<p className="cfc2-status cfc2-rise" data-status={statusKind} role="status" style={delay(1)}>
<span className="cfc2-dot" aria-hidden="true" />
<strong>{statusLead}</strong>
{statusDetail && <span>{" · " + statusDetail}</span>}
</p>
)}
{phone && (
<a className="cfc2-number cfc2-rise" href={telHref} aria-label={callAria} style={delay(2)}>
<span className="cfc2-disc" aria-hidden="true">
<Phone size={24} strokeWidth={2.5} />
</span>
<span className="cfc2-digits">{phone}</span>
</a>
)}
{phone && business && (
<p className="cfc2-business cfc2-rise" style={delay(2)}>
{business}
</p>
)}
{phone && (
<a className="cfc2-btn cfc2-callbar" href={telHref} aria-label={callAria}>
<span className="cfc2-btn-main">
<Phone size={20} strokeWidth={2.5} aria-hidden="true" />
{fill(copy.callbarLabel, { phone })}
</span>
{copy.callbarNote && <span className="cfc2-btn-sub">{copy.callbarNote}</span>}
</a>
)}
{(urgentJobs.length > 0 || hours.length > 0) && (
<div className="cfc2-more cfc2-rise" style={delay(3)}>
{urgentJobs.length > 0 && (
<div>
<p className="cfc2-subhead">{copy.jobsHeading}</p>
<ul className="cfc2-job-list">
{urgentJobs.map((job) => (
<li key={job}>
<Droplets size={18} strokeWidth={2.5} aria-hidden="true" />
{job}
</li>
))}
</ul>
</div>
)}
{hours.length > 0 && (
<div>
<p className="cfc2-subhead">
{copy.hoursHeading}
{zone && <span className="cfc2-zone">{" (" + zone + ")"}</span>}
</p>
<dl className="cfc2-hours-list">
{hours.map((row) => {
const isToday = clock !== null && row.days.includes(clock.day);
return (
<div key={row.label} className="cfc2-hrow" data-today={isToday || undefined}>
<dt>
{row.label}
{isToday && <span className="cfc2-today">{copy.todayLabel}</span>}
</dt>
<dd>{rowHours(row, locale, copy.closedLabel)}</dd>
</div>
);
})}
</dl>
</div>
)}
</div>
)}
</div>
</div>
<div className="cfc2-or" aria-hidden="true">
<span>{copy.or}</span>
</div>
<div className="cfc2-quote">
<div className="cfc2-quote-inner">
<div className={"cfc2-quote-head cfc2-rise" + (illustrationImage ? " cfc2-has-art" : "")} style={delay(1)}>
{illustrationImage && (
<img
className="cfc2-art"
src={illustrationImage}
alt={illustrationAlt}
width={320}
height={320}
loading="lazy"
decoding="async"
/>
)}
<h2 className="cfc2-h2">{quoteHeadline}</h2>
</div>
{quoteLead && (
<p className="cfc2-lead cfc2-rise" style={delay(2)}>
{quoteLead}
</p>
)}
<form className="cfc2-card cfc2-rise" style={delay(3)} noValidate onSubmit={handleSubmit}>
<div className="cfc2-pair">
<div className="cfc2-field">
<label className="cfc2-label" htmlFor={fid("name")}>
{copy.nameLabel}
</label>
<input {...fieldProps("name")} name="name" type="text" autoComplete="name" placeholder={copy.namePlaceholder} />
<FieldError id={fid("name-error")} text={shown("name")} />
</div>
<div className="cfc2-field">
<label className="cfc2-label" htmlFor={fid("phone")}>
{copy.phoneLabel}
</label>
<input
{...fieldProps("phone")}
name="phone"
type="tel"
inputMode="tel"
autoComplete="tel"
placeholder={copy.phonePlaceholder}
/>
<FieldError id={fid("phone-error")} text={shown("phone")} />
</div>
</div>
<div className="cfc2-field">
<label className="cfc2-label" htmlFor={fid("problem")}>
{copy.problemLabel}
</label>
<textarea
{...fieldProps("problem")}
className="cfc2-input cfc2-textarea"
name="problem"
rows={3}
placeholder={copy.problemPlaceholder}
/>
<FieldError id={fid("problem-error")} text={shown("problem")} />
</div>
<fieldset
className="cfc2-times"
aria-describedby={shown("time") ? fid("time-error") : undefined}
onBlur={(e) => {
if (!e.currentTarget.contains(e.relatedTarget as Node | null)) blur("time");
}}
>
<legend className="cfc2-label">{copy.timeLabel}</legend>
<div className="cfc2-tiles">
{times.map((option, i) => {
const checked = values.time === option.value;
return (
<label
key={option.value}
className="cfc2-tile"
data-checked={checked || undefined}
data-invalid={shown("time") ? true : undefined}
data-disabled={disabled || undefined}
>
<input
type="radio"
id={fid("time-" + i)}
name={fid("time")}
value={option.value}
checked={checked}
disabled={disabled}
onChange={() => {
update("time", option.value);
blur("time");
}}
/>
<span className="cfc2-tile-label">{option.label}</span>
{option.detail && <span className="cfc2-tile-detail">{option.detail}</span>}
<span className="cfc2-tick" aria-hidden="true">
<Check size={14} strokeWidth={3} />
</span>
</label>
);
})}
</div>
<FieldError id={fid("time-error")} text={shown("time")} />
</fieldset>
<div className="cfc2-actions">
<button
type="submit"
className="cfc2-btn"
data-force={forced}
disabled={disabled || busy}
aria-busy={busy || undefined}
>
<span className="cfc2-btn-main">
{busy && <Loader2 className="cfc2-spin" size={20} strokeWidth={2.5} aria-hidden="true" />}
{busy ? busyLabel : label}
</span>
{!busy && sublabel && <span className="cfc2-btn-sub">{sublabel}</span>}
</button>
{attempted && hasErrors && (
<p className="cfc2-err cfc2-center" role="alert">
<AlertCircle size={16} strokeWidth={2.5} aria-hidden="true" />
{copy.summary}
</p>
)}
{failed && (
<p className="cfc2-err cfc2-center" role="alert">
<AlertCircle size={16} strokeWidth={2.5} aria-hidden="true" />
{copy.failed}
</p>
)}
{reassurance && (
<p className="cfc2-note">
<Lock size={16} strokeWidth={2.5} aria-hidden="true" />
{reassurance}
</p>
)}
</div>
</form>
</div>
</div>
</div>
</section>
);
}
export default ContactForm2;
function FieldError({ id, text }: { id: string; text?: string }) {
if (!text) return null;
return (
<p id={id} className="cfc2-err">
<AlertCircle size={16} strokeWidth={2.5} aria-hidden="true" />
{text}
</p>
);
}
type FieldKey = keyof ContactForm2Values;
type Clock = { day: number; minutes: number };
type OpenStatus = { open: true; until: number } | { open: false; at: number; day: number; dayOffset: number };
const FIELD_ORDER: FieldKey[] = ["name", "phone", "problem", "time"];
const EMPTY_VALUES: ContactForm2Values = { name: "", phone: "", problem: "", time: "" };
const DAY_MINUTES = 1440;
const WEEK_MINUTES = 10080;
const WEEKDAY_INDEX: Record<string, number> = { Sun: 0, Mon: 1, Tue: 2, Wed: 3, Thu: 4, Fri: 5, Sat: 6 };
const DEFAULT_QUOTE_HEADLINE = (
<>
Not urgent? Get a quote at <span className="cfc2-mark">a time that suits you</span>
</>
);
const DEFAULT_JOBS = ["Burst or leaking pipe", "No hot water", "Sewage backing up", "Toilet overflowing"];
const DEFAULT_HOURS: ContactForm2Hours[] = [
{ label: "Mon–Fri", days: [1, 2, 3, 4, 5], open: "07:00", close: "19:00" },
{ label: "Saturday", days: [6], open: "08:00", close: "14:00" },
{ label: "Sunday", days: [0], closed: true },
];
const DEFAULT_TIMES: ContactForm2Time[] = [
{ value: "morning", label: "Morning", detail: "8 AM – 12 PM" },
{ value: "afternoon", label: "Afternoon", detail: "12 – 4 PM" },
{ value: "evening", label: "Evening", detail: "4 – 7 PM" },
{ value: "any", label: "Any time", detail: "In opening hours" },
];
const DEFAULT_COPY: ContactForm2Copy = {
nameLabel: "Your name",
namePlaceholder: "Jane Smith",
phoneLabel: "Phone number",
phonePlaceholder: "(555) 123-4567",
problemLabel: "What’s the problem?",
problemPlaceholder: "e.g. The kitchen tap drips and the cabinet under the sink is damp",
timeLabel: "Best time to call you",
nameError: "Please tell us your name.",
phoneError: "Enter a phone number we can call.",
problemError: "Tell us briefly what’s wrong.",
timeError: "Pick the best time to call.",
summary: "Check the highlighted fields above.",
failed: "We couldn’t send your request. Please try again or call us.",
checking: "Checking today’s hours",
openNow: "Open now",
openUntil: "until {time}",
closedNow: "Closed now",
opensToday: "opens at {time}",
opensTomorrow: "opens {time} tomorrow",
opensDay: "opens {day} at {time}",
jobsHeading: "Pick up the phone for",
hoursHeading: "When you can reach us",
todayLabel: "Today",
closedLabel: "Closed",
or: "or",
callbarLabel: "Call {phone}",
callbarNote: "Tap to call now",
callAria: "Call {business} on {phone}",
callAriaPlain: "Call {phone}",
};
function validate(v: ContactForm2Values, copy: ContactForm2Copy): Partial<Record<FieldKey, string>> {
const found: Partial<Record<FieldKey, string>> = {};
if (!v.name.trim()) found.name = copy.nameError;
if (v.phone.replace(/[^0-9]/g, "").length < 7) found.phone = copy.phoneError;
if (v.problem.trim().length < 3) found.problem = copy.problemError;
if (!v.time) found.time = copy.timeError;
return found;
}
function fill(template: string, vars: Record<string, string>) {
let out = template;
for (const key of Object.keys(vars)) out = out.split("{" + key + "}").join(vars[key]);
return out;
}
function delay(step: number) {
return { "--cfc2-d": Math.min(step * 0.07, 0.28) + "s" } as React.CSSProperties;
}
function toMinutes(value?: string): number | null {
if (!value) return null;
const [h, m = "0"] = value.split(":");
const hoursPart = Number(h);
const minutesPart = Number(m);
if (!Number.isFinite(hoursPart) || !Number.isFinite(minutesPart)) return null;
return Math.min(Math.max(hoursPart * 60 + minutesPart, 0), DAY_MINUTES);
}
function openWindows(hours: ContactForm2Hours[]): [number, number][] {
const out: [number, number][] = [];
for (const row of hours) {
if (row.closed) continue;
const open = toMinutes(row.open);
let close = toMinutes(row.close);
if (open === null || close === null) continue;
if (close <= open) close += DAY_MINUTES;
for (const day of row.days) {
if (day < 0 || day > 6) continue;
out.push([day * DAY_MINUTES + open, day * DAY_MINUTES + close]);
}
}
return out;
}
function zonedClock(date: Date, timeZone?: string): Clock {
try {
const parts = new Intl.DateTimeFormat("en-US", {
timeZone,
weekday: "short",
hour: "2-digit",
minute: "2-digit",
hourCycle: "h23",
}).formatToParts(date);
const part = (type: string) => parts.find((p) => p.type === type)?.value ?? "";
const day = WEEKDAY_INDEX[part("weekday")];
const hour = Number(part("hour")) % 24;
const minute = Number(part("minute"));
if (day !== undefined && Number.isFinite(hour) && Number.isFinite(minute)) return { day, minutes: hour * 60 + minute };
} catch {
// unknown time zone: fall back to the visitor's clock
}
return { day: date.getDay(), minutes: date.getHours() * 60 + date.getMinutes() };
}
function openStatus(windows: [number, number][], clock: Clock): OpenStatus | null {
if (!windows.length) return null;
const nowMinute = clock.day * DAY_MINUTES + clock.minutes;
for (const [start, end] of windows) {
for (const shift of [0, -WEEK_MINUTES]) {
if (start + shift <= nowMinute && nowMinute < end + shift) return { open: true, until: end % DAY_MINUTES };
}
}
let next = Infinity;
for (const [start] of windows) {
let candidate = start;
while (candidate <= nowMinute) candidate += WEEK_MINUTES;
next = Math.min(next, candidate);
}
const nextDay = Math.floor(next / DAY_MINUTES);
return { open: false, at: next % DAY_MINUTES, day: nextDay % 7, dayOffset: nextDay - clock.day };
}
function clockTime(minutes: number, locale: string) {
const h = Math.floor(minutes / 60) % 24;
const m = minutes % 60;
try {
const options: Intl.DateTimeFormatOptions = m
? { hour: "numeric", minute: "2-digit", timeZone: "UTC" }
: { hour: "numeric", timeZone: "UTC" };
return new Intl.DateTimeFormat(locale, options).format(new Date(Date.UTC(2023, 0, 1, h, m)));
} catch {
return String(h).padStart(2, "0") + ":" + String(m).padStart(2, "0");
}
}
function weekdayName(day: number, locale: string) {
try {
return new Intl.DateTimeFormat(locale, { weekday: "long", timeZone: "UTC" }).format(new Date(Date.UTC(2023, 0, 1 + day, 12)));
} catch {
return "";
}
}
function zoneLabel(date: Date, timeZone: string, locale: string) {
try {
return (
new Intl.DateTimeFormat(locale, { timeZone, timeZoneName: "short" })
.formatToParts(date)
.find((p) => p.type === "timeZoneName")?.value ?? ""
);
} catch {
return "";
}
}
function rowHours(row: ContactForm2Hours, locale: string, closedLabel: string) {
if (row.closed) return closedLabel;
const open = toMinutes(row.open);
const close = toMinutes(row.close);
if (open === null || close === null) return closedLabel;
return clockTime(open, locale) + " – " + clockTime(close % DAY_MINUTES, locale);
}
const CSS = `
.cf-contact-form-2{
--cfc2-gutter:clamp(16px,5vw,48px);
--cfc2-seam:clamp(32px,5vw,72px);
--cfc2-top:clamp(56px,8vw,112px);
--cfc2-bottom:clamp(64px,8.5vw,120px);
--cfc2-shadow:var(--shadow,oklch(0.22 0.03 260));
--cfc2-marker:var(--marker,#fae37c);
--cfc2-marker-ink:var(--marker-ink,oklch(from var(--cfc2-marker) clamp(0.16,calc((0.62 - l) * 1000),0.97) 0.02 h));
position:relative;
background:var(--surface,#ffffff);
color:var(--ink,#141b2d);
font-family:var(--font-body,system-ui,sans-serif);
font-size:clamp(1.0625rem,1.25vw,1.125rem);
line-height:1.5;
overflow-x:clip;
}
.cf-contact-form-2 *,.cf-contact-form-2 *::before,.cf-contact-form-2 *::after{box-sizing:border-box}
.cf-contact-form-2 :where(h2,p,ul,dl,dd,fieldset){margin:0}
.cf-contact-form-2 .cfc2-grid{position:relative;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
.cf-contact-form-2 .cfc2-call{
position:relative;isolation:isolate;overflow:clip;
background:var(--band,#1b2a4a);color:var(--band-ink,#ffffff);
padding:var(--cfc2-top) var(--cfc2-seam) var(--cfc2-bottom) var(--cfc2-gutter);
}
.cf-contact-form-2 .cfc2-call-inner{position:sticky;top:clamp(24px,4vw,48px);z-index:1;max-width:560px;margin-left:auto;container-type:inline-size}
.cf-contact-form-2 .cfc2-quote{
position:relative;background:var(--surface,#ffffff);color:var(--ink,#141b2d);
padding:var(--cfc2-top) var(--cfc2-gutter) var(--cfc2-bottom) var(--cfc2-seam);
}
.cf-contact-form-2 .cfc2-quote-inner{max-width:560px;margin-right:auto}
.cf-contact-form-2 .cfc2-h2{
font-family:var(--font-display,inherit);
font-weight:var(--display-weight,800);
letter-spacing:var(--display-tracking,-0.025em);
text-transform:var(--display-case,none);
font-size:clamp(2rem,3.6vw,3.25rem);
line-height:1.06;
text-wrap:balance;
}
.cf-contact-form-2 .cfc2-mark{
color:var(--cfc2-marker-ink);
background:linear-gradient(180deg,transparent 10%,oklch(from var(--cfc2-marker) l c h / .92) 10%,oklch(from var(--cfc2-marker) l c h / .92) 96%,transparent 96%);
padding:0 .1em;margin:0 -.04em;
border-radius:.12em .22em .14em .2em;
-webkit-box-decoration-break:clone;box-decoration-break:clone;
}
.cf-contact-form-2 .cfc2-status{
display:inline-block;max-width:100%;margin-top:24px;
padding:7px 16px 7px 12px;border-radius:999px;
background:oklch(from var(--band-ink,#ffffff) l c h / .12);
color:var(--band-ink,#ffffff);
font-size:.9375rem;font-weight:500;line-height:1.4;text-wrap:pretty;
}
.cf-contact-form-2 .cfc2-status strong{font-weight:800}
.cf-contact-form-2 .cfc2-dot{
display:inline-block;width:10px;height:10px;margin-inline:3px 10px;vertical-align:.02em;
border-radius:999px;background:oklch(from var(--band-ink,#ffffff) l c h / .45);
}
.cf-contact-form-2 [data-status="open"] .cfc2-dot{background:var(--success,#1f8a4c);outline:2px solid var(--band-ink,#ffffff);outline-offset:1px}
.cf-contact-form-2 [data-status="closed"] .cfc2-dot{background:transparent;border:2px solid var(--band-ink,#ffffff)}
.cf-contact-form-2 .cfc2-number{
display:inline-flex;align-items:center;gap:clamp(12px,3cqi,20px);max-width:100%;margin-top:20px;
color:var(--band-ink,#ffffff);text-decoration:none;border-radius:var(--radius,12px);outline:none;
}
.cf-contact-form-2 .cfc2-number:focus-visible{outline:3px solid var(--band-ink,#ffffff);outline-offset:6px}
.cf-contact-form-2 .cfc2-disc{
flex:none;display:grid;place-items:center;
width:clamp(52px,11cqi,64px);height:clamp(52px,11cqi,64px);border-radius:999px;
color:var(--button-ink,var(--cta-ink,#ffffff));
background:linear-gradient(oklch(from var(--button-bg,var(--cta,#d93a2b)) calc(l + .04) c h),oklch(from var(--button-bg-2,var(--cta-2,#b92e21)) calc(l - .02) c h));
box-shadow:inset 0 1px 0 oklch(from var(--button-bg,var(--cta,#d93a2b)) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta,#d93a2b)) calc(l - .16) c h),0 1px 2px oklch(from var(--cfc2-shadow) l c h / .45),0 8px 16px -6px oklch(from var(--cfc2-shadow) l c h / .55);
transition:transform .16s ease,box-shadow .16s ease,background .16s ease;
}
.cf-contact-form-2 .cfc2-number:hover .cfc2-disc{background:linear-gradient(oklch(from var(--button-bg,var(--cta,#d93a2b)) calc(l - .01) c h),oklch(from var(--button-bg-2,var(--cta-2,#b92e21)) calc(l - .07) c h))}
.cf-contact-form-2 .cfc2-number:active .cfc2-disc{
transform:translateY(1px);
box-shadow:inset 0 2px 4px oklch(from var(--cfc2-shadow) l c h / .35),inset 0 -2px 0 oklch(from var(--button-bg,var(--cta,#d93a2b)) calc(l - .16) c h),0 1px 2px oklch(from var(--cfc2-shadow) l c h / .4);
}
.cf-contact-form-2 .cfc2-digits{
font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);
font-size:clamp(2.25rem,10.5cqi,4.25rem);line-height:1;letter-spacing:-0.03em;
font-variant-numeric:tabular-nums lining-nums;white-space:nowrap;
text-decoration:underline;text-decoration-color:transparent;text-decoration-thickness:.06em;text-underline-offset:.14em;
transition:text-decoration-color .16s ease;
}
.cf-contact-form-2 .cfc2-number:hover .cfc2-digits{text-decoration-color:oklch(from var(--band-ink,#ffffff) l c h / .55)}
.cf-contact-form-2 .cfc2-business{margin-top:14px;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--band-ink,#ffffff)}
.cf-contact-form-2 .cfc2-more{display:grid;gap:32px;margin-top:clamp(40px,4vw,56px)}
.cf-contact-form-2 .cfc2-subhead{margin-bottom:12px;font-size:1.0625rem;font-weight:800;line-height:1.3}
.cf-contact-form-2 .cfc2-zone{font-weight:500}
.cf-contact-form-2 .cfc2-job-list{list-style:none;padding:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 24px}
.cf-contact-form-2 .cfc2-job-list li{display:grid;grid-template-columns:18px minmax(0,1fr);gap:10px;align-items:start;line-height:1.4}
.cf-contact-form-2 .cfc2-job-list svg{margin-top:.15em}
.cf-contact-form-2 .cfc2-hours-list{display:grid}
.cf-contact-form-2 .cfc2-hrow{
display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:4px 16px;
padding:10px 0;border-bottom:1px solid oklch(from var(--band-ink,#ffffff) l c h / .16);
font-variant-numeric:tabular-nums lining-nums;
}
.cf-contact-form-2 .cfc2-hrow:last-child{border-bottom:0}
.cf-contact-form-2 .cfc2-hrow dt{display:flex;align-items:center;gap:10px;font-weight:600}
.cf-contact-form-2 .cfc2-hrow dd{font-weight:500}
.cf-contact-form-2 .cfc2-hrow[data-today] dt,.cf-contact-form-2 .cfc2-hrow[data-today] dd{font-weight:800}
.cf-contact-form-2 .cfc2-today{
display:inline-flex;align-items:center;min-height:26px;padding:3px 10px;border-radius:999px;
background:oklch(from var(--band-ink,#ffffff) l c h / .14);font-size:.875rem;font-weight:800;line-height:1.2;
}
.cf-contact-form-2 .cfc2-or{
position:absolute;z-index:3;left:50%;top:calc(var(--cfc2-top) - 4px);transform:translateX(-50%);
display:grid;place-items:center;width:52px;height:52px;padding-left:.08em;border-radius:999px;
background:var(--card,#ffffff);color:var(--ink,#141b2d);
border:1px solid var(--card-border,oklch(from var(--ink,#141b2d) l c h / .12));
box-shadow:var(--shadow-md,0 1px 2px oklch(0.22 0.03 260 / .22),0 4px 10px -2px oklch(0.22 0.03 260 / .2));
font-family:var(--font-display,inherit);font-weight:800;font-size:.875rem;line-height:1;letter-spacing:.08em;text-transform:uppercase;
}
.cf-contact-form-2 .cfc2-has-art{display:grid;grid-template-columns:minmax(0,1fr) clamp(96px,10vw,136px);gap:16px;align-items:start}
.cf-contact-form-2 .cfc2-has-art .cfc2-h2{grid-column:1;grid-row:1}
.cf-contact-form-2 .cfc2-art{
grid-column:2;grid-row:1;display:block;width:100%;height:auto;aspect-ratio:1;object-fit:contain;
filter:drop-shadow(0 2px 3px oklch(from var(--cfc2-shadow) l c h / .25)) drop-shadow(0 12px 14px oklch(from var(--cfc2-shadow) l c h / .2));
}
.cf-contact-form-2 .cfc2-lead{margin-top:16px;font-size:clamp(1.125rem,1.5vw,1.375rem);font-weight:500;line-height:1.4;color:var(--muted,#4a5568);text-wrap:pretty}
.cf-contact-form-2 .cfc2-card{
display:grid;gap:20px;margin-top:28px;padding:clamp(20px,3vw,32px);
background:var(--card,#ffffff);color:var(--ink,#141b2d);
border:1px solid var(--card-border,oklch(from var(--ink,#141b2d) l c h / .12));
border-radius:var(--card-radius,var(--radius,14px));
box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(0.22 0.03 260 / .22),0 12px 24px -8px oklch(0.22 0.03 260 / .32)));
container-type:inline-size;
}
.cf-contact-form-2 .cfc2-pair{display:grid;gap:20px}
@container (min-width:440px){.cf-contact-form-2 .cfc2-pair{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px}}
.cf-contact-form-2 .cfc2-field{display:grid;gap:8px;min-width:0;align-content:start}
.cf-contact-form-2 .cfc2-label{padding:0;font-size:1rem;font-weight:700;line-height:1.3;color:var(--label-ink,var(--ink,#141b2d))}
.cf-contact-form-2 .cfc2-input{
width:100%;min-height:56px;padding:14px 16px;
font:inherit;font-size:1.0625rem;line-height:1.4;
color:var(--field-ink,#141b2d);background:var(--field,#ffffff);
border:1px solid var(--field-border,color-mix(in oklch,var(--ink,#141b2d) 22%,transparent));
border-radius:var(--field-radius,var(--radius,12px));
transition:border-color .16s ease,box-shadow .16s ease;
}
.cf-contact-form-2 textarea.cfc2-textarea{
display:block;min-height:104px;resize:vertical;
color:var(--field-ink,#141b2d);background:var(--field,#ffffff);
border-color:var(--field-border,color-mix(in oklch,var(--ink,#141b2d) 22%,transparent));
border-radius:var(--field-radius,var(--radius,12px));
}
.cf-contact-form-2 .cfc2-input::placeholder{color:color-mix(in oklch,var(--field-ink,#141b2d) 65%,var(--field,#ffffff));opacity:1}
.cf-contact-form-2 .cfc2-input:hover:not(:disabled){border-color:color-mix(in oklch,var(--ink,#141b2d) 40%,transparent)}
.cf-contact-form-2 .cfc2-input:focus-visible{outline:none;border-color:var(--field-focus,var(--accent,#2f6fdc));box-shadow:0 0 0 3px oklch(from var(--field-focus,var(--accent,#2f6fdc)) l c h / .35)}
.cf-contact-form-2 .cfc2-input[aria-invalid="true"]{border-color:var(--danger,#c0362c)}
.cf-contact-form-2 .cfc2-input[aria-invalid="true"]:focus-visible{box-shadow:0 0 0 3px oklch(from var(--danger,#c0362c) l c h / .3)}
.cf-contact-form-2 .cfc2-input:disabled{opacity:.6;cursor:not-allowed}
.cf-contact-form-2 .cfc2-times{border:0;padding:0;min-width:0}
.cf-contact-form-2 .cfc2-times legend{float:none;margin-bottom:8px}
.cf-contact-form-2 .cfc2-tiles{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.cf-contact-form-2 .cfc2-times .cfc2-err{margin-top:8px}
.cf-contact-form-2 .cfc2-tile{
position:relative;display:grid;align-content:start;gap:2px;min-height:64px;padding:12px 12px 12px 14px;
border-radius:var(--field-radius,var(--radius,12px));
background:color-mix(in oklch,var(--ink,#141b2d) 4%,var(--card,#ffffff));color:var(--ink,#141b2d);
border:1px solid oklch(from var(--ink,#141b2d) l c h / .14);cursor:pointer;
transition:border-color .16s ease,background .16s ease,box-shadow .16s ease;
}
.cf-contact-form-2 .cfc2-tile input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:inherit}
.cf-contact-form-2 .cfc2-tile:hover{border-color:oklch(from var(--ink,#141b2d) l c h / .34)}
.cf-contact-form-2 .cfc2-tile[data-checked]{
background:color-mix(in oklch,var(--accent,#2f6fdc) 10%,var(--card,#ffffff));
border-color:var(--accent,#2f6fdc);box-shadow:inset 0 0 0 1px var(--accent,#2f6fdc);
}
.cf-contact-form-2 .cfc2-tile[data-invalid]{border-color:var(--danger,#c0362c)}
.cf-contact-form-2 .cfc2-tile:has(input:focus-visible){outline:3px solid oklch(from var(--field-focus,var(--accent,#2f6fdc)) l c h / .45);outline-offset:2px}
.cf-contact-form-2 .cfc2-tile[data-disabled]{opacity:.6;cursor:not-allowed}
.cf-contact-form-2 .cfc2-tile-label{padding-right:26px;font-size:1rem;font-weight:700;line-height:1.2}
.cf-contact-form-2 .cfc2-tile-detail{font-size:.875rem;font-weight:500;line-height:1.3;color:var(--muted,#4a5568)}
.cf-contact-form-2 .cfc2-tick{
position:absolute;top:12px;right:10px;width:20px;height:20px;
display:grid;place-items:center;border-radius:999px;pointer-events:none;
background:var(--accent-fill,var(--accent,#2f6fdc));color:var(--accent-fill-ink,var(--card,#ffffff));
opacity:0;transform:scale(.9);transition:opacity .16s ease,transform .16s ease;
}
.cf-contact-form-2 .cfc2-tile[data-checked] .cfc2-tick{opacity:1;transform:none}
.cf-contact-form-2 .cfc2-actions{display:grid;gap:12px;margin-top:4px}
.cf-contact-form-2 .cfc2-btn{
appearance:none;border:0;cursor:pointer;width:100%;min-height:68px;padding:10px 28px;
display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
text-align:center;text-decoration:none;
border-radius:var(--button-radius,var(--radius,12px));
font-family:var(--button-font,var(--font-display,inherit));
color:var(--button-ink,var(--cta-ink,#ffffff));
text-transform:var(--button-case,none);
text-shadow:var(--button-text-shadow,none);
background:linear-gradient(oklch(from var(--button-bg,var(--cta,#d93a2b)) calc(l + .04) c h),oklch(from var(--button-bg-2,var(--cta-2,#b92e21)) calc(l - .02) c h));
box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta,#d93a2b)) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta,#d93a2b)) calc(l - .16) c h),0 1px 2px oklch(from var(--cfc2-shadow) l c h / .4),0 8px 16px -6px oklch(from var(--cfc2-shadow) l c h / .5));
transition:transform .16s ease,box-shadow .16s ease,background .16s ease;
}
.cf-contact-form-2 .cfc2-btn:hover:not(:disabled),.cf-contact-form-2 .cfc2-btn[data-force="hover"]{
background:linear-gradient(oklch(from var(--button-bg,var(--cta,#d93a2b)) calc(l - .01) c h),oklch(from var(--button-bg-2,var(--cta-2,#b92e21)) calc(l - .07) c h));
box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta,#d93a2b)) calc(l + .1) c h / .7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta,#d93a2b)) calc(l - .2) c h),0 1px 2px oklch(from var(--cfc2-shadow) l c h / .45),0 12px 20px -6px oklch(from var(--cfc2-shadow) l c h / .55));
}
.cf-contact-form-2 .cfc2-btn:active:not(:disabled),.cf-contact-form-2 .cfc2-btn[data-force="active"]{
transform:translateY(1px);
box-shadow:inset 0 2px 5px oklch(from var(--cfc2-shadow) l c h / .35),inset 0 -2px 0 oklch(from var(--button-bg,var(--cta,#d93a2b)) calc(l - .16) c h),0 1px 2px oklch(from var(--cfc2-shadow) l c h / .35);
}
.cf-contact-form-2 .cfc2-btn:focus-visible{outline:3px solid oklch(from var(--button-bg,var(--cta,#d93a2b)) l c h / .5);outline-offset:3px}
.cf-contact-form-2 .cfc2-btn:disabled:not([aria-busy]){
cursor:not-allowed;transform:none;text-shadow:none;
background:var(--button-2-bg,var(--secondary,#e6e9f0));color:var(--button-2-ink,var(--secondary-ink,#141b2d));
box-shadow:var(--button-2-shadow,var(--shadow-sm,0 1px 2px oklch(0.22 0.03 260 / .2)));
}
.cf-contact-form-2 .cfc2-btn[aria-busy]{cursor:progress}
.cf-contact-form-2 .cfc2-btn-main{display:inline-flex;align-items:center;justify-content:center;gap:8px;font-size:clamp(1.125rem,1.55vw,1.375rem);font-weight:var(--button-weight,800);line-height:1.15}
.cf-contact-form-2 .cfc2-btn-sub{font-family:var(--font-body,inherit);font-size:.9375rem;font-weight:600;line-height:1.3;text-transform:none;text-wrap:pretty}
.cf-contact-form-2 .cfc2-btn.cfc2-callbar{display:none;margin-top:20px}
.cf-contact-form-2 .cfc2-btn.cfc2-callbar:focus-visible{outline:3px solid var(--band-ink,#ffffff);outline-offset:3px}
.cf-contact-form-2 .cfc2-err{color:var(--danger,#c0362c);font-size:.9375rem;font-weight:600;line-height:1.4;text-wrap:pretty}
.cf-contact-form-2 .cfc2-err svg,.cf-contact-form-2 .cfc2-note svg{display:inline-block;vertical-align:-.15em;margin-inline-end:.4em}
.cf-contact-form-2 .cfc2-center{text-align:center}
.cf-contact-form-2 .cfc2-note{text-align:center;color:var(--muted,#4a5568);font-size:.9375rem;font-weight:500;line-height:1.4;text-wrap:pretty}
@keyframes cfc2-rise{from{opacity:.82;transform:translateY(8px)}}
@keyframes cfc2-spin{to{transform:rotate(360deg)}}
.cf-contact-form-2 .cfc2-rise{animation:cfc2-rise .45s cubic-bezier(.2,.7,.2,1) var(--cfc2-d,0s) both}
.cf-contact-form-2 .cfc2-spin{animation:cfc2-spin .8s linear infinite}
@media (max-width:860px){
.cf-contact-form-2 .cfc2-grid{grid-template-columns:minmax(0,1fr)}
.cf-contact-form-2 .cfc2-call{padding:40px var(--cfc2-gutter) 52px}
.cf-contact-form-2 .cfc2-call-inner,.cf-contact-form-2 .cfc2-quote-inner{max-width:560px;margin-inline:auto}
.cf-contact-form-2 .cfc2-call-inner{position:relative;top:auto}
.cf-contact-form-2 .cfc2-status{margin-top:16px}
.cf-contact-form-2 .cfc2-number,.cf-contact-form-2 .cfc2-business,.cf-contact-form-2 .cfc2-more{display:none}
.cf-contact-form-2 .cfc2-btn.cfc2-callbar{display:flex}
.cf-contact-form-2 .cfc2-or{position:relative;left:auto;top:auto;transform:none;justify-self:center;margin:-26px 0}
.cf-contact-form-2 .cfc2-quote{padding:52px var(--cfc2-gutter) var(--cfc2-bottom)}
.cf-contact-form-2 .cfc2-has-art{display:block}
.cf-contact-form-2 .cfc2-has-art::after{content:"";display:table;clear:both}
.cf-contact-form-2 .cfc2-art{float:right;width:88px;margin:0 0 8px 12px}
}
@media (prefers-reduced-motion:reduce){
.cf-contact-form-2 .cfc2-rise,.cf-contact-form-2 .cfc2-spin{animation:none}
.cf-contact-form-2 *{transition:none!important}
}
`;
pieces/forms/contact-form-2/specimen.tsx 23 lines
import __studioImagea1f3a5f4 from "../assets/15a22b13cd8c69a3.webp";
import { ContactForm2, type ContactForm2State } from "../contact-form-2";
export const states = ["default", "hover", "active", "disabled", "error"];
export default function ContactForm2Specimen({ state = "default" }: { state?: ContactForm2State }) {
return (
<ContactForm2
state={state}
business="Pine & Pipe Plumbing"
phone="(555) 014-2260"
timeZone="America/Denver"
hours={[
{ label: "Mon–Fri", days: [1, 2, 3, 4, 5], open: "07:00", close: "19:00" },
{ label: "Saturday", days: [6], open: "08:00", close: "14:00" },
{ label: "Sunday", days: [0], closed: true },
]}
urgentJobs={["Burst or leaking pipe", "No hot water", "Sewage backing up", "Toilet overflowing"]}
illustrationImage={__studioImagea1f3a5f4}
illustrationAlt=""
/>
);
}
| Name | Type | Details |
|---|---|---|
callHeadline OptionalContactForm2 |
React.ReactNode |
|
business OptionalContactForm2 |
string |
|
phone OptionalContactForm2 |
string |
|
phoneHref OptionalContactForm2 |
string |
|
hours OptionalContactForm2 |
ContactForm2Hours[] |
|
timeZone OptionalContactForm2 |
string |
|
locale OptionalContactForm2 |
string |
|
now OptionalContactForm2 |
string |
|
urgentJobs OptionalContactForm2 |
string[] |
|
quoteHeadline OptionalContactForm2 |
React.ReactNode |
|
quoteLead OptionalContactForm2 |
React.ReactNode |
|
illustrationImage OptionalContactForm2 |
string |
|
illustrationAlt OptionalContactForm2 |
string |
|
times OptionalContactForm2 |
ContactForm2Time[] |
|
label OptionalContactForm2 |
string |
|
sublabel OptionalContactForm2 |
string |
|
busyLabel OptionalContactForm2 |
string |
|
reassurance OptionalContactForm2 |
string |
|
copy OptionalContactForm2 |
Partial<ContactForm2Copy> |
|
onSubmit OptionalContactForm2 |
(values: ContactForm2Values) => void | Promise<unknown> |
|
state OptionalContactForm2 |
ContactForm2State |
|
className OptionalContactForm2 |
string |
|
id OptionalContactForm2 |
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.
This piece reads no image slots.
-
15a22b13cd8c69a3.webp
image/webp · 128 KB
-
f211b3080387e46d.webp
image/webp · 105 KB