# Contact: split introduction and form

> A contact introduction with response details and a labelled three-field form.

- Kind: block · Category: Contact · Interactivity: native
- Install: `npx shadcn@latest add @haze/contact-split-form`
- File: `src/components/haze/blocks/contact-split-form.astro`
- npm dependencies: @lucide/astro
- Registry dependencies: @haze/button, @haze/input, @haze/textarea, @haze/utils
- Docs page: https://hazeui.com/blocks/contact-split-form

## Use when
- Collecting a visitor's name, email and message for a team
- You can supply a real endpoint to receive form submissions

## Avoid when
- You only need an email signup; use newsletter-inline

## Alternatives
- [newsletter-inline](https://hazeui.com/blocks/newsletter-inline.md)

## Props

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| id | `string` | "contact-split-form" | no | Unique ID prefix for the section and all its fields. |
| eyebrow | `string` | "Get in touch" | no | Label above the section heading. |
| title | `string` | demo heading | no | Heading above the contact details. |
| description | `string` | demo copy | no | Introductory contact copy. |
| headingLevel | `1 \| 2 \| 3` | 2 | no | Heading level for the section title. |
| email | `string` | "hello@example.com" | no | Displayed contact address; the default is an example. |
| responseTime | `string` | demo response time | no | Expected response time shown alongside the email address. |
| formAction | `string` | "" | no | POST endpoint. With no endpoint, submission is disabled and the form is labelled as a demo. |
| submitLabel | `string` | "Send message" | no | Submit button text. |
| class | `string` |  | no | Additional classes on the section. |

## Accessibility
- All three required controls have visible labels and use native browser validation.
- The default preview announces that submission is unavailable until an endpoint is configured.
- Key Tab: Move through the fields and, once configured, the submit button.

## Agent prompts

### Install and use

Install the Haze UI block "Contact: split introduction and form" with `npx shadcn@latest add @haze/contact-split-form`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "https://hazeui.com/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import ContactSplitForm from "@/components/haze/blocks/contact-split-form.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: https://hazeui.com/blocks/contact-split-form.md

### Customize with real content

Adapt the Haze contact-split-form block for our product. Replace the demo values of these props with our real content: id, eyebrow, title, description, headingLevel, email, responseTime, formAction, submitLabel, class. Keep the layout, the heading level rules and these accessibility details: All three required controls have visible labels and use native browser validation. The default preview announces that submission is unavailable until an endpoint is configured. Do not add raw color classes; use the Haze tokens.

### Choose the right block

Before using contact-split-form, check it fits: use it when collecting a visitor's name, email and message for a team; you can supply a real endpoint to receive form submissions. Avoid it when you only need an email signup; use newsletter-inline. Alternatives: @haze/newsletter-inline.

## Example requests that should lead here
- Add a contact section with name, email and message fields that posts to our endpoint

## Source

```astro
---
import { Clock3, Mail } from "@lucide/astro";
import { cn } from "../../../lib/haze/utils";
import Button from "../ui/button.astro";
import Input from "../ui/input.astro";
import Textarea from "../ui/textarea.astro";

interface Props {
  id?: string;
  eyebrow?: string;
  title?: string;
  description?: string;
  headingLevel?: 1 | 2 | 3;
  email?: string;
  responseTime?: string;
  formAction?: string;
  submitLabel?: string;
  class?: string;
}

const {
  id = "contact-split-form",
  eyebrow = "Get in touch",
  title = "Tell us what you're working on",
  description = "Have a question or an idea? Share a little context and we'll help you find the right next step.",
  headingLevel = 2,
  email = "hello@example.com",
  responseTime = "We usually reply within two business days.",
  formAction = "",
  submitLabel = "Send message",
  class: className,
} = Astro.props;
const Heading = ({ 1: "h1", 2: "h2", 3: "h3" } as const)[headingLevel];
---

<section aria-labelledby={`${id}-title`} class={cn("bg-background px-6 py-20 sm:py-24", className)}>
  <div class="mx-auto grid max-w-6xl gap-10 lg:grid-cols-2 lg:gap-24">
    <div class="max-w-lg">
      <p class="text-[0.6875rem]/4 font-medium tracking-wider text-muted-foreground uppercase">{eyebrow}</p>
      <Heading id={`${id}-title`} class="mt-3 text-3xl/9 font-semibold tracking-tight text-balance text-foreground sm:text-4xl/11">{title}</Heading>
      <p class="mt-4 text-base/7 text-pretty text-muted-foreground">{description}</p>
      <div class="mt-8 grid gap-4 border-t border-border pt-6 text-sm/6 text-muted-foreground">
        <p class="flex items-start gap-3"><Mail aria-hidden="true" class="mt-1 size-4 shrink-0" /><span>{email}</span></p>
        <p class="flex items-start gap-3"><Clock3 aria-hidden="true" class="mt-1 size-4 shrink-0" /><span>{responseTime}</span></p>
      </div>
    </div>
    <form action={formAction || undefined} method="post" class="grid gap-5 rounded-xl border border-border bg-card p-6 sm:p-8">
      <div class="grid gap-1.5">
        <label for={`${id}-name`} class="text-sm/5 font-medium text-foreground">Name</label>
        <Input id={`${id}-name`} name="name" autocomplete="name" required />
      </div>
      <div class="grid gap-1.5">
        <label for={`${id}-email`} class="text-sm/5 font-medium text-foreground">Email address</label>
        <Input id={`${id}-email`} name="email" type="email" autocomplete="email" required />
      </div>
      <div class="grid gap-1.5">
        <label for={`${id}-message`} class="text-sm/5 font-medium text-foreground">How can we help?</label>
        <Textarea id={`${id}-message`} name="message" rows={5} required />
      </div>
      <div class="grid justify-items-start gap-3">
        <Button type="submit" disabled={!formAction}>{submitLabel}</Button>
        {!formAction && <p class="text-[0.8125rem]/5 text-muted-foreground">Demo form: add a form endpoint to receive messages.</p>}
      </div>
    </form>
  </div>
</section>
```
