Skip to content
Marketing block

Split Contact Form

A contact form beside the channels that bypass it — a real address, a support link and a response-time promise, which is what makes a form people cannot see into feel worth filling.

279 lineslucide-reactAdded 8 Aug 2026Updated 2 Sept 2026
  • contact
  • form
  • email
  • support
  • enquiry

What's included

  • components/contact-form-split.tsx
  • Needs lucide-react

Works with

  • React
  • Next.js
  • Tailwind CSS
  • TypeScript

npx hoverlab add contact-form-split

Or over MCP, from your editor's agent — no account needed.

License

Free to read, copy and install, for personal and non-commercial projects. Shipping it in client work or a paid product needs Pro ($79 once). The source lands in your repo and stops being ours — no attribution, nothing to upgrade.

Was this useful?

Start a page with this section — add more, order them, and leave with the page source.

Preview

Tell us what you need.

Sales questions, support, partnerships — one form, and it reaches a person rather than a queue.

We reply to everything within one business day.

Rendered live in your current theme — this is the same component whose source is below, not a screenshot of it.

Source

components/contact-form-split.tsx
'use client'

/**
 * <ContactFormSplit> — a contact form beside the ways to not use it.
 *
 * The channel list is not decoration. A contact form is a black box: you
 * type, you press send, and you have no idea whether anyone will read it.
 * Putting a real email address, a support link and a response-time promise
 * next to the form is what makes the form credible, and it lets the people
 * who would rather not use it leave without bouncing.
 *
 * Form details that matter more than the layout:
 *
 *  - Every input has a real `<label>`, not a placeholder standing in for
 *    one. Placeholder-as-label vanishes the moment someone types, which is
 *    exactly when they need to check what the field was.
 *  - `autoComplete` tokens are set (`name`, `email`, `organization`), so
 *    the browser can fill three of the five fields.
 *  - The submit button keeps its accessible name while pending — the
 *    spinner is `aria-hidden`, so the word beside it is what a screen
 *    reader announces.
 *  - The result is a live region, and it replaces the form rather than
 *    appearing above it, so nobody submits twice.
 *
 * `onSubmit` receives the form values. With no handler the preview
 * resolves locally after a beat, so the pending and success states are
 * demonstrable without a backend.
 */

import * as React from 'react'
import { Check, Loader2, Mail, MapPin, MessageSquare } from 'lucide-react'

export interface ContactValues {
  name: string
  email: string
  company: string
  subject: string
  message: string
}

export interface ContactChannel {
  icon: 'mail' | 'chat' | 'map'
  label: string
  value: string
  href?: string
}

export interface ContactFormSplitProps {
  heading?: string
  subheading?: string
  channels?: ContactChannel[]
  responseNote?: string
  submitLabel?: string
  successMessage?: string
  onSubmit?: (values: ContactValues) => void | Promise<void>
  className?: string
}

const ICONS = { mail: Mail, chat: MessageSquare, map: MapPin } as const

const DEFAULT_CHANNELS: ContactChannel[] = [
  { icon: 'mail', label: 'Email', value: 'hello@acme.com', href: 'mailto:hello@acme.com' },
  { icon: 'chat', label: 'Support', value: 'Open a ticket', href: '#' },
  { icon: 'map', label: 'Office', value: '4 Bridge Street, Bristol' },
]

const EMPTY: ContactValues = { name: '', email: '', company: '', subject: '', message: '' }

type Status = 'idle' | 'pending' | 'done'

export function ContactFormSplit({
  heading = 'Tell us what you need.',
  subheading =
    'Sales questions, support, partnerships — one form, and it reaches a person rather than a queue.',
  channels = DEFAULT_CHANNELS,
  responseNote = 'We reply to everything within one business day.',
  submitLabel = 'Send message',
  successMessage = 'Thanks — your message is in. We will reply by email.',
  onSubmit,
  className = '',
}: ContactFormSplitProps) {
  // Per-instance ids. A literal id in a reusable component is a
  // collision waiting for the second copy on the page — and a <label>
  // then resolves to whichever input rendered first.
  const uid = React.useId()
  const [values, setValues] = React.useState<ContactValues>(EMPTY)
  const [status, setStatus] = React.useState<Status>('idle')

  function set<K extends keyof ContactValues>(key: K, value: ContactValues[K]) {
    setValues((v) => ({ ...v, [key]: value }))
  }

  async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
    event.preventDefault()
    if (status !== 'idle') return
    setStatus('pending')
    try {
      await (onSubmit?.(values) ?? new Promise((r) => setTimeout(r, 800)))
      setStatus('done')
    } catch {
      setStatus('idle')
    }
  }

  return (
    <section className={`mx-auto w-full max-w-7xl px-4 py-16 sm:px-6 lg:px-8 ${className}`}>
      <div className="grid gap-12 lg:grid-cols-5 lg:gap-16">
        {/* -- Copy + channels ----------------------------------------- */}
        <div className="lg:col-span-2">
          <h2 className="text-balance text-3xl font-bold tracking-tight sm:text-4xl">
            {heading}
          </h2>
          <p className="mt-4 text-pretty leading-relaxed text-muted-foreground">{subheading}</p>

          <ul className="mt-8 space-y-4">
            {channels.map((channel) => {
              const Icon = ICONS[channel.icon]
              return (
                <li key={channel.label} className="flex items-start gap-3">
                  <span className="mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-card/60 text-muted-foreground">
                    <Icon aria-hidden className="h-4 w-4" />
                  </span>
                  <span className="min-w-0">
                    <span className="block text-xs font-medium uppercase tracking-wider text-muted-foreground">
                      {channel.label}
                    </span>
                    {channel.href ? (
                      <a
                        href={channel.href}
                        className="text-sm font-semibold hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
                      >
                        {channel.value}
                      </a>
                    ) : (
                      <span className="text-sm font-semibold">{channel.value}</span>
                    )}
                  </span>
                </li>
              )
            })}
          </ul>

          {responseNote ? (
            <p className="mt-8 rounded-xl border border-border/60 bg-card/40 p-4 text-sm text-muted-foreground">
              {responseNote}
            </p>
          ) : null}
        </div>

        {/* -- Form ----------------------------------------------------- */}
        <div className="lg:col-span-3" aria-live="polite">
          {status === 'done' ? (
            <div className="flex h-full min-h-64 flex-col items-center justify-center rounded-2xl border border-emerald-500/30 bg-emerald-500/5 p-10 text-center">
              <span className="flex h-12 w-12 items-center justify-center rounded-full bg-emerald-500/15 text-emerald-600 dark:text-emerald-400">
                <Check aria-hidden className="h-6 w-6" />
              </span>
              <p className="mt-4 font-semibold">{successMessage}</p>
            </div>
          ) : (
            <form
              onSubmit={handleSubmit}
              className="rounded-2xl border border-border/60 bg-card/40 p-6 sm:p-8"
            >
              <div className="grid gap-4 sm:grid-cols-2">
                <Field
                  id={`${uid}-contact-name`}
                  label="Name"
                  autoComplete="name"
                  required
                  value={values.name}
                  onChange={(v) => set('name', v)}
                />
                <Field
                  id={`${uid}-contact-email`}
                  label="Work email"
                  type="email"
                  autoComplete="email"
                  required
                  value={values.email}
                  onChange={(v) => set('email', v)}
                />
                <Field
                  id={`${uid}-contact-company`}
                  label="Company"
                  autoComplete="organization"
                  value={values.company}
                  onChange={(v) => set('company', v)}
                />
                <Field
                  id={`${uid}-contact-subject`}
                  label="Subject"
                  required
                  value={values.subject}
                  onChange={(v) => set('subject', v)}
                />
              </div>

              <div className="mt-4">
                <label htmlFor={`${uid}-contact-message`} className="block text-sm font-medium">
                  Message
                </label>
                <textarea
                  id={`${uid}-contact-message`}
                  required
                  rows={5}
                  value={values.message}
                  onChange={(e) => set('message', e.target.value)}
                  className="mt-1.5 w-full resize-y rounded-xl border border-border/60 bg-background/60 px-3 py-2.5 text-sm placeholder:text-muted-foreground focus:border-primary/50 focus:outline-none focus:ring-2 focus:ring-ring/30"
                  placeholder="What are you trying to do?"
                />
              </div>

              <button
                type="submit"
                disabled={status === 'pending'}
                className="mt-5 inline-flex h-11 w-full items-center justify-center gap-2 rounded-xl bg-primary px-6 text-sm font-semibold text-primary-foreground transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:opacity-70 sm:w-auto"
              >
                {status === 'pending' ? (
                  <>
                    <Loader2
                      aria-hidden
                      className="h-4 w-4 animate-spin motion-reduce:[animation-duration:1.6s]"
                    />
                    Sending
                  </>
                ) : (
                  submitLabel
                )}
              </button>
            </form>
          )}
        </div>
      </div>
    </section>
  )
}

/** A labelled text input. Extracted only because it repeats four times. */
function Field({
  id,
  label,
  value,
  onChange,
  type = 'text',
  required = false,
  autoComplete,
}: {
  id: string
  label: string
  value: string
  onChange: (value: string) => void
  type?: string
  required?: boolean
  autoComplete?: string
}) {
  return (
    <div>
      <label htmlFor={id} className="block text-sm font-medium">
        {label}
        {required ? null : (
          <>
            {' '}
            <span className="text-xs font-normal text-muted-foreground">(optional)</span>
          </>
        )}
      </label>
      <input
        id={id}
        type={type}
        required={required}
        autoComplete={autoComplete}
        value={value}
        onChange={(e) => onChange(e.target.value)}
        className="mt-1.5 h-11 w-full rounded-xl border border-border/60 bg-background/60 px-3 text-sm placeholder:text-muted-foreground focus:border-primary/50 focus:outline-none focus:ring-2 focus:ring-ring/30"
      />
    </div>
  )
}

Before you paste

  • Styling is Tailwind utility classes on semantic tokens (bg-card, text-muted-foreground) — it inherits your theme instead of overriding it.
  • Install: npm i lucide-react
  • Every prop has a default, so it renders standalone before you wire it up.

Where it goes

Drop it at components/contact-form-split.tsx and import it where you need the section:

import { ContactFormSplit } from '@/components/contact-form-split'

Customize

4 of this block’s props are simple enough to drive from here. Change them and the block below re-renders — it is the same component whose source is above, not a mock of it. Everything else it accepts is in the table underneath.

Props

Read out of the component’s own type and signature, so this cannot drift from the source below. Every prop has a default — the component renders standalone before you pass it anything.

PropTypeDefault
headingstring'Tell us what you need.'
subheadingstring—
channelsContactChannel[]DEFAULT_CHANNELS
responseNotestring'We reply to everything within one business d…
submitLabelstring'Send message'
successMessagestring'Thanks — your message is in. We will reply b…
onSubmit(values: ContactValues) => void | Promise<void>—
classNamestring''

Not using React?

The same block rendered once to markup, wrapped as a file your framework compiles. Tailwind classes are framework-agnostic, so the design transfers intact — the behaviour does not.

This block is interactive. The markup below is its initial state with the event handlers stripped — you will need to re-wire the behaviour in your framework.

contact-form-split.html
<!--
  Split Contact Form — markup from the Hoverlab catalog.

  This is the block rendered once to HTML and wrapped as a component
  file. It is not a port of the React source: the Tailwind classes carry
  the design, which is the part that took the work, and they are the same
  in every framework.

  This block is interactive in React and the handlers are NOT here.
  Buttons, toggles and menus render in their initial state and do
  nothing until you wire them up.
-->
<section class="mx-auto w-full max-w-7xl px-4 py-16 sm:px-6 lg:px-8 ">
  <div class="grid gap-12 lg:grid-cols-5 lg:gap-16">
    <div class="lg:col-span-2">
      <h2 class="text-balance text-3xl font-bold tracking-tight sm:text-4xl">Tell us what you need.</h2>
      <p class="mt-4 text-pretty leading-relaxed text-muted-foreground">Sales questions, support, partnerships — one form, and it reaches a person rather than a queue.</p>
      <ul class="mt-8 space-y-4">
        <li class="flex items-start gap-3">
          <span class="mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-card/60 text-muted-foreground">
            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-mail h-4 w-4" aria-hidden="true">
              <path d="m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7"></path>
              <rect x="2" y="4" width="20" height="16" rx="2"></rect>
            </svg>
          </span>
          <span class="min-w-0">
            <span class="block text-xs font-medium uppercase tracking-wider text-muted-foreground">Email</span>
            <a href="mailto:hello@acme.com" class="text-sm font-semibold hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">hello@acme.com</a>
          </span>
        </li>
        <li class="flex items-start gap-3">
          <span class="mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-card/60 text-muted-foreground">
            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-message-square h-4 w-4" aria-hidden="true">
              <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>
            </svg>
          </span>
          <span class="min-w-0">
            <span class="block text-xs font-medium uppercase tracking-wider text-muted-foreground">Support</span>
            <a href="#" class="text-sm font-semibold hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">Open a ticket</a>
          </span>
        </li>
        <li class="flex items-start gap-3">
          <span class="mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border/60 bg-card/60 text-muted-foreground">
            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-map-pin h-4 w-4" aria-hidden="true">
              <path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"></path>
              <circle cx="12" cy="10" r="3"></circle>
            </svg>
          </span>
          <span class="min-w-0">
            <span class="block text-xs font-medium uppercase tracking-wider text-muted-foreground">Office</span>
            <span class="text-sm font-semibold">4 Bridge Street, Bristol</span>
          </span>
        </li>
      </ul>
      <p class="mt-8 rounded-xl border border-border/60 bg-card/40 p-4 text-sm text-muted-foreground">We reply to everything within one business day.</p>
    </div>
    <div class="lg:col-span-3" aria-live="polite">
      <form class="rounded-2xl border border-border/60 bg-card/40 p-6 sm:p-8">
        <div class="grid gap-4 sm:grid-cols-2">
          <div>
            <label for="_R_0_-contact-name" class="block text-sm font-medium">Name</label>
            <input id="_R_0_-contact-name" type="text" required="" autoComplete="name" class="mt-1.5 h-11 w-full rounded-xl border border-border/60 bg-background/60 px-3 text-sm placeholder:text-muted-foreground focus:border-primary/50 focus:outline-none focus:ring-2 focus:ring-ring/30" value="" />
          </div>
          <div>
            <label for="_R_0_-contact-email" class="block text-sm font-medium">Work email</label>
            <input id="_R_0_-contact-email" type="email" required="" autoComplete="email" class="mt-1.5 h-11 w-full rounded-xl border border-border/60 bg-background/60 px-3 text-sm placeholder:text-muted-foreground focus:border-primary/50 focus:outline-none focus:ring-2 focus:ring-ring/30" value="" />
          </div>
          <div>
            <label for="_R_0_-contact-company" class="block text-sm font-medium">Company <span class="text-xs font-normal text-muted-foreground">(optional)</span></label>
            <input id="_R_0_-contact-company" type="text" autoComplete="organization" class="mt-1.5 h-11 w-full rounded-xl border border-border/60 bg-background/60 px-3 text-sm placeholder:text-muted-foreground focus:border-primary/50 focus:outline-none focus:ring-2 focus:ring-ring/30" value="" />
          </div>
          <div>
            <label for="_R_0_-contact-subject" class="block text-sm font-medium">Subject</label>
            <input id="_R_0_-contact-subject" type="text" required="" class="mt-1.5 h-11 w-full rounded-xl border border-border/60 bg-background/60 px-3 text-sm placeholder:text-muted-foreground focus:border-primary/50 focus:outline-none focus:ring-2 focus:ring-ring/30" value="" />
          </div>
        </div>
        <div class="mt-4">
          <label for="_R_0_-contact-message" class="block text-sm font-medium">Message</label>
          <textarea id="_R_0_-contact-message" required="" rows="5" class="mt-1.5 w-full resize-y rounded-xl border border-border/60 bg-background/60 px-3 py-2.5 text-sm placeholder:text-muted-foreground focus:border-primary/50 focus:outline-none focus:ring-2 focus:ring-ring/30" placeholder="What are you trying to do?"></textarea>
        </div>
        <button type="submit" class="mt-5 inline-flex h-11 w-full items-center justify-center gap-2 rounded-xl bg-primary px-6 text-sm font-semibold text-primary-foreground transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:opacity-70 sm:w-auto">Send message</button>
      </form>
    </div>
  </div>
</section>
  • This is rendered HTML, not a translation of the React source. The Tailwind classes carry the design and work in any framework.
  • It is one frame: the component in its initial state, with no props applied beyond the defaults.
  • This block is interactive in React — toggles, menus or form state. None of that survives here; the markup is the closed/default state and the handlers are gone. Re-wire them in your own framework.
  • Requires Tailwind, and the design tokens the classes reference (bg-card, text-muted-foreground, and so on). The template ZIPs ship a globals.css that defines them.

What each framework gets across the whole catalog — effects convert properly; this rung is markup.

For AI

The component, its props, the design tokens it expects and the command that installs it — as one prompt. Paste it into Claude, Cursor, v0 or ChatGPT and what they build around it will match the rest of the catalog instead of inventing its own system.

See the prompt

Used in these pages

Want the whole screen instead of this one section? Open a page and copy it entire.

5 more blocks in Contact & Forms

All of them free to read, copy and install — no account, no locked tiles, no watermarked preview. The whole catalog is open, and so are the API and the CLI.

Browse Contact & Forms

Shipping one commercially

Copying the code is free. Putting it in client work or a paid product is what Pro is for — the licence, not the access.

  • A commercial licence for everything in the catalog
  • Unlimited bundle exports, in Vue, Svelte and Tailwind
  • One payment — no subscription, nothing to renew
Pro — $79 once

More Contact & Forms blocks

View category
Open the full page for this block

Multi-Step Form with Validation

A three-step form where each step validates only its own fields, errors are wired to inputs with aria-describedby, and advancing moves focus to the new heading.

Contact & Forms373 lines1 dep
Open the full page for this block

Inline Feedback Widget

One click to rate, everything after it optional — the shape that collects a complaint from someone mid-task who would never open a contact page.

Contact & Forms248 lines1 dep
Open the full page for this block

Form with Error Summary

The state every form reaches and none of them illustrate: a focused summary at the top linking to each bad field, validation that waits for submit, and somewhere for the failure that belongs to no field.

Contact & Forms320 lines1 dep
Open the full page for this block

Contact Sales Form

A qualifying contact form that asks the three things a first reply needs, and says what happens next before you send it.

Contact & Forms175 linesNo deps
Open the full page for this block

Support Ticket Form

A support form that asks for the one thing that halves resolution time — what you already tried — and says when a human will read it.

Contact & Forms169 linesNo deps