---
title: Contact Blocks for Astro
description: "Astro contact form blocks with labelled fields and contact links. Preview layouts and install the source, then connect your form service."
seo:
    title: "Astro Contact blocks: examples and source"
sidebar:
    label: "Contact"
related:
    - /blocks
    - /components
    - /docs/astro-business-websites
mode: wide
---

Each block renders a real form with named, required fields and a submit button.
Set `form.action` to your form handler and `form.method` to `"post"` (the
default) or `"get"`. The blocks do not provide a submission backend.
Pass `form.id` for a stable form ID; field IDs use it as their prefix.

## Split form

Place contact methods beside a labelled enquiry form.

```astro
---
import ContactSplitFormBlock from "@/components/blocks/contact/contact-split-form.astro"
---

<ContactSplitFormBlock
  title="How does a new request reach your team?"
  description="Describe one request you would like to route automatically. This gnostic AI example uses sample contact details."
  contactItems={[
    {
      icon: "mail",
      title: "Email",
      description: "projects@example.com",
      href: "mailto:projects@example.com",
    },
    {
      icon: "phone",
      title: "Phone",
      description: "+1 212 555 0124",
      href: "tel:+12125550124",
    },
    {
      icon: "map-pin",
      title: "Meeting format",
      description: "Video call by appointment",
    },
    {
      icon: "clock",
      title: "Hours",
      description: "Sample hours, Tue and Thu, 1–3 pm Eastern",
    },
  ]}
  form={{
    title: "Describe your intake process",
    legend: "Contact form",
    nameLabel: "Name",
    namePlaceholder: "Owen Patel",
    emailLabel: "Email",
    emailPlaceholder: "owen@example.com",
    messageLabel: "Message",
    messagePlaceholder:
      "A form collects customer requests. We need billing questions to go to Finance and setup questions to go to Support.",
    actionLabel: "Send message",
  }}
/>
```

```sh
bunx --bun shadcn@latest add @gnostic/contact-split-form
```

## Centered form

Give the form a central position after the contact introduction.

```astro
---
import ContactCenteredFormBlock from "@/components/blocks/contact/contact-centered-form.astro"
---

<ContactCenteredFormBlock
  title="Which task do you repeat each week?"
  description="Use this gnostic AI sample inquiry to describe one manual task. Start with what triggers it and who needs the result."
  contactItems={[
    {
      icon: "mail",
      title: "Email us",
      description: "projects@example.com",
      href: "mailto:projects@example.com",
    },
    {
      icon: "phone",
      title: "Call us",
      description: "+1 212 555 0124",
      href: "tel:+12125550124",
    },
    {
      icon: "map-pin",
      title: "Meeting format",
      description: "Video call by appointment",
    },
    {
      icon: "clock",
      title: "Support hours",
      description: "Sample hours, Tue and Thu, 1–3 pm Eastern",
    },
  ]}
  form={{
    legend: "Contact form",
    nameLabel: "Name",
    namePlaceholder: "Leila Moreno",
    emailLabel: "Email",
    emailPlaceholder: "leila@example.com",
    messageLabel: "Message",
    messagePlaceholder:
      "We copy each new support email into a ticket and assign an owner by hand.",
    messageDescription:
      "Include the tools you use and the step that still needs a person.",
    actionLabel: "Send message",
  }}
/>
```

```sh
bunx --bun shadcn@latest add @gnostic/contact-centered-form
```

## Sidebar form

Keep the contact information available beside the enquiry fields.

```astro
---
import Contact3Block from "@/components/blocks/contact/contact-3.astro"
---

<Contact3Block
  title="Where does an invoice need a second look?"
  description="Use this gnostic AI sample form to outline an invoice review. Identify the fields to extract and who approves the draft."
  contactItems={[
    {
      icon: "mail",
      title: "Email",
      description: "projects@example.com",
      href: "mailto:projects@example.com",
    },
    {
      icon: "phone",
      title: "Phone",
      description: "+1 212 555 0124",
      href: "tel:+12125550124",
    },
    {
      icon: "map-pin",
      title: "Meeting format",
      description: "Video call by appointment",
    },
    {
      icon: "clock",
      title: "Hours",
      description: "Sample hours, Tue and Thu, 1–3 pm Eastern",
    },
  ]}
  form={{
    legend: "Contact form",
    nameLabel: "Name",
    namePlaceholder: "Nadia Chen",
    emailLabel: "Email",
    emailPlaceholder: "nadia@example.com",
    messageLabel: "Message",
    messagePlaceholder:
      "We need someone to check invoices when the total differs from the purchase order.",
    actionLabel: "Send message",
  }}
/>
```

```sh
bunx --bun shadcn@latest add @gnostic/contact-3
```

## Contact details and form

Supply your own content. The section uses the selected project preset.

```astro
---
import Block from "@/components/blocks/contact/contact-details-form/contact-details-form.astro"
import type { DetailsFormContent } from "@/components/blocks/contact/contact-details-form/types"

const content = {
  email: "projects@example.com",
  phone: "+1 212 555 0124",
  hours: "Sample hours: Tuesday and Thursday, 1–3 pm Eastern",
  address: "gnostic AI · Sample remote project desk",
  label: "Draft a workflow inquiry",
  description:
    "Describe one recurring task and the person who checks the result.",
} satisfies DetailsFormContent
---

<Block {content} />
```

```sh
bunx --bun shadcn@latest add @gnostic/contact-details-form
```

<AutoTypeTable
    path="../../packages/ui/src/components/blocks/contact/contact-details-form/types.ts"
    name="DetailsFormProps"
/>

## Editorial contact

Use this section for a project enquiry with a form endpoint or email draft fallback.

```astro
---
import Section from "@/components/blocks/contact/contact-project-inquiry/contact-project-inquiry.astro"
import { getImage } from "astro:assets"
import lake from "../../../src/assets/images/mountain-beyond-lake-scene.png"

const lakeUrl = (await getImage({ src: lake, width: 1200, format: "webp" })).src
const section = {
  label: "gnostic AI · Sample project brief",
  title: "Plan a pilot",
  accent: "for your support team",
  description:
    "Describe one question your team answers often and the sources it uses to check each reply.",
  email: "projects@example.com",
  buttonLabel: "Prepare email draft",
  image: {
    src: lakeUrl,
    alt: "Mountain ridge beyond a lake",
  },
  formTitle: "About your workflow",
  extended: true,
  companyTypes: ["Service business", "Software company", "Other"],
  serviceOptions: ["Request routing", "AI-assisted replies", "Document intake"],
}
---

<Section {...section} id="contact-project-inquiry" />
```

```sh
bunx --bun shadcn@latest add @gnostic/contact-project-inquiry
```

<AutoTypeTable
    path="../../packages/ui/src/components/blocks/contact/contact-project-inquiry/types.ts"
    name="ContactProjectInquiryProps"
/>

See [serif accent font setup](/ui/docs/installation#serif-accent-fonts-for-editorial-blocks) when installing this section.

## Service map

```astro
---
import Block from "@/components/blocks/contact/contact-service-map/contact-service-map.astro"

const content = {
  eyebrow: "gnostic AI · Sample service area",
  title: "Plan an on-site workflow review",
  description:
    "This example uses two New York neighborhoods to show how a consulting team can display its workshop area.",
  benefits: ["Map the current workflow", "Identify the manual handoffs"],
  action: {
    label: "View the inquiry form",
    href: "/blocks/contact#split-form",
  },
  phone: {
    label: "+1 212 555 0124",
    href: "tel:+12125550124",
  },
  mapTitle: "Example workshop area",
  map: {
    src: "https://www.openstreetmap.org/export/embed.html?bbox=-73.998,40.726,-73.975,40.741",
    href: "https://www.openstreetmap.org/#map=15/40.733/-73.987",
    title: "Map of the East Village in New York",
    label: "Open the map",
  },
  locations: ["East Village", "Lower East Side"],
}
---

<Block {...content} />
```

```sh
bunx --bun shadcn@latest add @gnostic/contact-service-map
```

## Estimate form

```astro
---
import ContactEstimateForm from "@/components/blocks/contact/contact-estimate-form/contact-estimate-form.astro"
import { getImage } from "astro:assets"
import lake from "@/assets/images/mountain-beyond-lake-scene.png"

const lakeUrl = (await getImage({ src: lake, width: 1200, format: "webp" })).src
---

<ContactEstimateForm
  id="document-intake-estimate"

  eyebrow="gnostic AI · Sample estimate"
  title="Start your document intake"
  description="Choose the part of invoice intake you want to test and the budget available for the project."
  image={{
    src: lakeUrl,
    alt: "Mountain ridge beyond a lake",
  }}
  services={["Extract invoice fields", "Route invoices for approval"]}
  budgets={["Budget to be set", "Under $5,000", "$5,000-$10,000"]}
  submitLabel="Submit Request"
  demoNotice="Use sample details to try the request form."
  demoMessage="Your sample estimate request is complete."
/>
```

```sh
bunx --bun shadcn@latest add @gnostic/contact-estimate-form
```

## Business hours and booking

An address, opening hours, email, and a configurable booking link.

```astro
---
import ContactWithHours from "@/components/blocks/contact/contact-hours.astro"
---

<ContactWithHours
  eyebrow="gnostic AI · Sample consulting hours"
  title="Discuss a workflow with a consultant"
  description="Choose a task to walk through. Bring a sample request and the checklist your team uses to finish it."
  address={["Remote consultation", "Video call by appointment"]}
  hours={[
    {
      label: "Tuesday & Thursday",
      value: "1-3 pm Eastern",
    },
    {
      label: "Friday",
      value: "10-11 am Eastern",
    },
  ]}
  action={{
    label: "View the project inquiry",
    href: "/blocks/contact#editorial-contact",
  }}
  email="projects@example.com"
  note="These hours illustrate a sample schedule."
/>
```

```sh
bunx --bun shadcn@latest add @gnostic/contact-hours
```

## Choose a contact layout

Choose the contact layout from the ways people can actually reach you. A small site may need only direct links; a detailed enquiry can use a form with a short explanation of the next step.

## Pass content from Astro

Contact form variants accept content labels and form action/method props. Connect those to a real endpoint or Astro action. The block displays the form but does not send mail, validate server-side rules, or store submissions by itself.

## Responsive layout and images

Check label wrapping, error messages, and keyboard order on a narrow screen. Keep email and phone links usable without the form. If a variant includes an image, supply useful context rather than an image that competes with the fields.

## Compose the next section

Place [Services](/ui/blocks/services) or [FAQs](/ui/blocks/faqs) before contact when they answer common questions. Use [Field](/ui/components/field) for extra form fields.

## Named slots

These slots are optional. Use the slot name on a direct child of the block.

### `contact-service-map`

| Prop | Type | Default | Description |
| - | - | - | - |
| `map?` | `Astro content` | `Iframe from data.map` | Replaces the embedded service map. |

### `contact-estimate-form`

| Prop | Type | Default | Description |
| - | - | - | - |
| `image?` | `Astro content` | `Astro Image from data.image` | Replaces the image beside the estimate form. |

### `contact-icon-block`

| Prop | Type | Default | Description |
| - | - | - | - |
| `icon?` | `Astro content` | - | Places an icon before the contact details. |
