Contact blocks
Contact, demo, and inquiry forms with labels, descriptions, and every state designed.
Labels stay visible, errors say what to do, and focus goes to the first field that needs attention. When a message is sent, the confirmation takes the place of the form at the same height and receives focus. Until you pass onSubmit, the forms wait a moment and succeed, and nothing is sent.
Split contact form
An introduction and real contact details beside a form.
import * as React from "react"
import {
MarketingForm,
type FormStatus,
type MarketingField,
} from "@/components/marketing/foundation/marketing-form"
import {
MarketingContainer,
MarketingSection,
} from "@/components/marketing/foundation/section"
import { SectionHeading } from "@/components/marketing/foundation/section-heading"
import type { MarketingLink } from "@/components/marketing/foundation/types"
interface ContactDetail {
label: string
/** A link, or plain lines of text. */
value: MarketingLink | string[]
}
interface ContactSplitFormProps {
title?: React.ReactNode
description?: React.ReactNode
details?: ContactDetail[]
fields?: MarketingField[]
submitLabel?: string
note?: React.ReactNode
success?: { title: string; description: React.ReactNode }
onSubmit?: (data: FormData) => Promise<void> | void
initialStatus?: FormStatus
/** An anchor for links within the page. */
id?: string
className?: string
}
const DEFAULT_DETAILS: ContactDetail[] = [
{ label: "Email", value: { label: "help@recto.example", href: "mailto:help@recto.example" } },
{ label: "Phone", value: { label: "+46 8 555 0142", href: "tel:+4685550142" } },
{ label: "Office", value: ["Hornsgatan 48", "118 21 Stockholm"] },
]
const DEFAULT_FIELDS: MarketingField[] = [
{ name: "name", label: "Name", autoComplete: "name", required: true, half: true },
{
name: "email",
label: "Work email",
type: "email",
autoComplete: "email",
required: true,
half: true,
},
{
name: "topic",
label: "What is it about?",
type: "select",
options: ["Using Recto", "Billing", "Security and data", "Something else"],
required: true,
},
{
name: "message",
label: "Message",
type: "textarea",
description: "If something went wrong, tell us what you expected to happen.",
required: true,
rows: 5,
},
]
/** An introduction and real contact details beside a form that finishes well. */
export function ContactSplitForm({
title = "Write to a person.",
description = "Your message goes to the five of us who build Recto. We answer in English, Swedish and German.",
details = DEFAULT_DETAILS,
fields = DEFAULT_FIELDS,
submitLabel = "Send message",
note = "We reply within one working day.",
success = {
title: "Thanks, we have it.",
description: "One of us will reply by email within one working day.",
},
onSubmit,
initialStatus,
id,
className,
}: ContactSplitFormProps) {
const titleId = React.useId()
return (
<MarketingSection aria-labelledby={titleId} id={id} className={className}>
<MarketingContainer>
<div className="grid gap-x-(--mkt-column-gap) gap-y-11 lg:grid-cols-12">
<div className="flex flex-col lg:col-span-5 lg:pe-12">
<SectionHeading titleId={titleId} title={title} description={description} />
<dl className="m-0 mt-9 lg:mt-auto lg:pt-14">
{details.map((detail) => (
<div
key={detail.label}
className="grid grid-cols-[5.5rem_1fr] items-baseline border-t-[0.5px] border-(--mkt-line-strong) py-3"
>
<dt className="mkt-meta">{detail.label}</dt>
<dd className="m-0 text-[0.9375rem] leading-6 tracking-[-0.008em] text-(--mkt-ink) [overflow-wrap:anywhere]">
{Array.isArray(detail.value) ? (
detail.value.map((line) => (
<span key={line} className="block">
{line}
</span>
))
) : (
<a
href={detail.value.href}
className="mkt-link inline-block"
data-underline=""
data-touch=""
>
{detail.value.label}
</a>
)}
</dd>
</div>
))}
</dl>
</div>
<div className="lg:col-span-7">
<div className="rounded-(--mkt-radius-panel) bg-(--mkt-frame) p-5 shadow-[0_0_0_0.5px_var(--mkt-line-strong)] sm:p-9 lg:p-11">
<MarketingForm
fields={fields}
submitLabel={submitLabel}
note={note}
success={success}
onSubmit={onSubmit}
initialStatus={initialStatus}
/>
</div>
</div>
</div>
</MarketingContainer>
</MarketingSection>
)
}
export type { ContactDetail, ContactSplitFormProps }
Demo request
A short form beside an account of what happens after it: when you reply, what the call covers, and what the visitor keeps.
import * as React from "react"
import {
MarketingForm,
type FormStatus,
type MarketingField,
} from "@/components/marketing/foundation/marketing-form"
import { PersonAttribution } from "@/components/marketing/foundation/person"
import {
MarketingContainer,
MarketingSection,
} from "@/components/marketing/foundation/section"
import { SectionHeading } from "@/components/marketing/foundation/section-heading"
import type { MarketingPerson } from "@/components/marketing/foundation/types"
interface ContactDemoRequestProps {
title?: React.ReactNode
description?: React.ReactNode
/** What the demo covers, then what happens after the form. */
steps?: { title: string; description: string }[]
stepsLabel?: string
host?: MarketingPerson
fields?: MarketingField[]
submitLabel?: string
note?: React.ReactNode
success?: { title: string; description: React.ReactNode }
onSubmit?: (data: FormData) => Promise<void> | void
initialStatus?: FormStatus
/** An anchor for links within the page. */
id?: string
className?: string
}
const DEFAULT_STEPS = [
{
title: "You pick a time today",
description: "We reply with three slots, usually within two hours.",
},
{
title: "We use your document",
description: "Send one over and we run a real approval with it. Thirty minutes.",
},
{
title: "You keep the workspace",
description: "It stays open for 14 days with everything we set up.",
},
]
const DEFAULT_FIELDS: MarketingField[] = [
{ name: "name", label: "Name", autoComplete: "name", required: true },
{ name: "email", label: "Work email", type: "email", autoComplete: "email", required: true },
{
name: "size",
label: "How many people approve documents?",
type: "choice",
options: ["1 to 10", "11 to 50", "51 to 200", "More"],
required: true,
},
{
name: "goal",
label: "What should we cover?",
type: "textarea",
rows: 3,
description: "A sentence is plenty.",
},
]
/** A short form, and an honest account of what happens after it. */
export function ContactDemoRequest({
title = "See it with your own document.",
description = "A half-hour call with someone who knows the product, and no slides.",
steps = DEFAULT_STEPS,
stepsLabel = "What happens next",
host = { name: "Lena Hoff", role: "You will speak with Lena, in Stockholm" },
fields = DEFAULT_FIELDS,
submitLabel = "Request a demo",
note = "We only use this to arrange the call.",
success = {
title: "Request received.",
description: "Lena will email you three times to choose from, usually within two hours.",
},
onSubmit,
initialStatus,
id,
className,
}: ContactDemoRequestProps) {
const titleId = React.useId()
return (
<MarketingSection aria-labelledby={titleId} id={id} className={className}>
<MarketingContainer>
<div className="grid gap-2 rounded-(--mkt-radius-panel) bg-(--mkt-wash) p-2 lg:grid-cols-12">
<div className="flex flex-col gap-y-10 p-5 sm:p-9 lg:col-span-6 lg:p-12">
<SectionHeading titleId={titleId} title={title} description={description} />
<div className="lg:mt-auto">
<p className="mkt-meta">{stepsLabel}</p>
<ol className="m-0 mt-2 list-none p-0">
{steps.map((step, index) => (
<li
key={step.title}
className="grid grid-cols-[2rem_1fr] border-b-[0.5px] border-(--mkt-line-strong) py-4 last:border-b-0"
>
<span className="text-[0.9375rem] leading-6 text-(--mkt-ink-soft) tabular-nums">
{index + 1}
</span>
<span>
<span className="block text-[1rem] leading-6 tracking-[-0.012em] text-(--mkt-ink) [font-weight:500]">
{step.title}
</span>
<span className="mkt-body block [font-size:0.9375rem]">
{step.description}
</span>
</span>
</li>
))}
</ol>
</div>
{host && <PersonAttribution person={host} className="[&_[data-slot=portrait]]:bg-(--mkt-frame)" />}
</div>
<div className="flex flex-col rounded-[calc(var(--mkt-radius-panel)-0.5rem)] bg-(--mkt-frame) p-5 shadow-[0_0_0_0.5px_var(--mkt-line-strong)] sm:p-9 lg:col-span-6 lg:justify-center lg:p-12">
<MarketingForm
fields={fields}
submitLabel={submitLabel}
note={note}
success={success}
onSubmit={onSubmit}
initialStatus={initialStatus}
/>
</div>
</div>
</MarketingContainer>
</MarketingSection>
)
}
export type { ContactDemoRequestProps }
Studio inquiry
A project brief, asked for in the order people think about one. Service and budget are single choices, so a phone needs few taps.
import * as React from "react"
import {
MarketingForm,
type FormStatus,
type MarketingField,
} from "@/components/marketing/foundation/marketing-form"
import {
MarketingContainer,
MarketingSection,
} from "@/components/marketing/foundation/section"
import { MarketingHeading } from "@/components/marketing/foundation/section-heading"
interface ContactStudioInquiryProps {
title?: React.ReactNode
description?: React.ReactNode
/** How the studio works, in two or three short notes. */
notes?: { label: string; text: React.ReactNode }[]
fields?: MarketingField[]
submitLabel?: string
note?: React.ReactNode
success?: { title: string; description: React.ReactNode }
onSubmit?: (data: FormData) => Promise<void> | void
initialStatus?: FormStatus
/** An anchor for links within the page. */
id?: string
className?: string
}
const DEFAULT_NOTES = [
{ label: "Availability", text: "Taking two projects for spring 2027." },
{ label: "First reply", text: "From Inês or Rui, within three days." },
{
label: "Prefer email",
text: (
<a
href="mailto:hello@ferrow.example"
className="mkt-link inline-block [overflow-wrap:anywhere]"
data-underline=""
data-touch=""
>
hello@ferrow.example
</a>
),
},
]
const DEFAULT_FIELDS: MarketingField[] = [
{
name: "service",
label: "What do you need?",
type: "choice",
options: ["Identity", "Signs and wayfinding", "Website", "Not sure yet"],
required: true,
},
{
name: "scope",
label: "Roughly what budget?",
type: "choice",
options: ["Under €20k", "€20k to €60k", "Over €60k", "Help us decide"],
},
{
name: "project",
label: "Tell us about the place",
type: "textarea",
rows: 5,
description: "Where it is, who comes, and what should be different in a year.",
required: true,
},
{ name: "name", label: "Your name", autoComplete: "name", required: true, half: true },
{
name: "email",
label: "Email",
type: "email",
autoComplete: "email",
required: true,
half: true,
},
]
/** A project brief, asked for in the order people think about one. */
export function ContactStudioInquiry({
title = "Start with the place.",
description = "A few lines are enough. We read every inquiry and say so when we are not the right studio.",
notes = DEFAULT_NOTES,
fields = DEFAULT_FIELDS,
submitLabel = "Send inquiry",
note,
success = {
title: "Thank you. It is on our desk.",
description: "Inês or Rui will write back within three days, with questions or a time to talk.",
},
onSubmit,
initialStatus,
id,
className,
}: ContactStudioInquiryProps) {
const titleId = React.useId()
return (
<MarketingSection aria-labelledby={titleId} id={id} className={className}>
<MarketingContainer size="wide">
<MarketingHeading size="hero" id={titleId} className="-ms-[0.04em] max-w-[12em]">
{title}
</MarketingHeading>
<div className="mt-[clamp(2.5rem,1.500rem+4vw,5rem)] grid gap-x-(--mkt-column-gap) gap-y-11 lg:grid-cols-12">
<div className="lg:col-span-4 lg:pe-8">
<p className="mkt-lead max-w-[30rem]">{description}</p>
<dl className="m-0 mt-9 max-w-[30rem] lg:mt-14">
{notes.map((item) => (
<div
key={item.label}
className="grid grid-cols-[7rem_1fr] items-baseline border-t-[0.5px] border-(--mkt-line-strong) py-3"
>
<dt className="mkt-meta">{item.label}</dt>
<dd className="m-0 text-[0.9375rem] leading-6 tracking-[-0.008em] text-(--mkt-ink)">
{item.text}
</dd>
</div>
))}
</dl>
</div>
<MarketingForm
fields={fields}
submitLabel={submitLabel}
note={note}
success={success}
onSubmit={onSubmit}
initialStatus={initialStatus}
className="lg:col-span-7 lg:col-start-6 [&_form]:gap-y-8"
/>
</div>
</MarketingContainer>
</MarketingSection>
)
}
export type { ContactStudioInquiryProps }
Usage
Every prop has a default, so a block renders as soon as it is installed. Pass your own content to replace it.
"use client"
import { ContactSplitForm } from "@/components/marketing/contact-split-form"
export function Contact() {
return (
<ContactSplitForm
onSubmit={async (data) => {
const response = await fetch("/api/contact", { method: "POST", body: data })
if (!response.ok) throw new Error("Not sent")
}}
/>
)
}