Marketing sectionsContactSplit
Searchastronomic.dev# ContactSplit
For a contact page: your details beside a message form.
Interactive: inline script.
## Usage
```astro
import ContactSplit from "@astronomic-dev/ui/components/ContactSplit.astro";
```
## Examples
### Details beside the form
From a 48rem section your details sit in the start column and the message form in the wider end column; below that they stack, the details first, so a reader who wants only the phone number finds it before the form. Here the form asks for a topic, has a privacy note, and posts to #.
```astro
---
import Badge from "@astronomic-dev/ui/components/Badge.astro";
import ContactSplit from "@astronomic-dev/ui/components/ContactSplit.astro";
// Made-up details: a reserved .example address and a US number from the range kept for fiction (555-0100 to 555-0199).
const hours = [
{ label: "Mon to Thu", value: "9 a.m. to 5:30 p.m." },
{ label: "Fri", value: "9 a.m. to 3 p.m." },
];
---
<div class="mx-auto max-w-6xl px-6 py-16">
<ContactSplit
heading="Start a project"
text="Tell us what you need and when. A person from the studio answers within two business days."
email="hello@astronomic.example"
phone="+1 (312) 555-0147"
address={["Astronomic", "12 Orbit Lane", "Example City, IL 60601"]}
hours={hours}
form={{ action: "#", topics: ["A new site", "A redesign", "Something else"] }}
>
<Badge slot="eyebrow">Contact</Badge>
<p slot="note" class="m-0">We only use your details to answer you. No newsletter, no sharing.</p>
</ContactSplit>
</div>
```
## Props
### ContactSplit
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `heading` | `string` | None | The section heading, in the title role in display type. Without it there is no section and no header: a plain <div> holds only the body. |
| `emphasis` | `boolean` | `false` | Turn one *phrase* in the heading into <em>: exactly two asterisks around text with no space inside, as in "Built for *the long run*". Any other asterisks show as typed. Off by default, so the heading shows as typed. How the <em> looks is the theme's. |
| `mark` | `string` | None | A short mark after the heading, such as "(12)" or "©2026", in small muted type. It sits beside the heading, outside it, so the heading's name stays plain. Shown only with a heading. |
| `markLabel` | `string` | None | What the mark says to a screen reader, such as "12 projects": the mark is then hidden from screen readers and this is read in its place. Without it, the mark is read as written. |
| `text` | `string` | None | One or two sentences under the heading, in the lead role, muted. Shown only with a heading. |
| `headingTag` | `"h2" \| "h3" \| "h4"` | `"h2"` | The heading element. Channel titles sit one level under it. |
| `class` | `string` | None | More classes for the root (the <section>, or the <div> without a heading), merged with cn(), so yours win on conflicts. The root is a named size container (inline-size containment): in a shrink-to-fit parent (inline-flex, a float, fit-content) it collapses, so give it a width there. |
| `email` | `string` | None | Your email address, shown as a mailto: link. It breaks after the @ first in a narrow column; only a part too long for the column breaks inside it. |
| `phone` | `string` | None | Your phone number, shown as written, such as "+1 (312) 555-0147". The tel: link keeps only the digits and a leading +. |
| `address` | `string[]` | None | Your address, one line each. It keeps its lines, in <address>. |
| `hours` | `ContactHours[]` | None | Opening hours, one { label, value } per line (ContactHours), such as { label: "Mon to Fri", value: "9 a.m. to 5:30 p.m." }. |
| `form` | `MessageFormOptions` | None | Required. The form's settings: its action (required) and any MessageForm prop but tone and class (MessageFormOptions), spread onto the form, such as { action: "https://formspree.io/f/<id>", topics: ["Sales", "Support"], enhance: "fetch" }. A plain post is the safe default; enhance="fetch" needs an endpoint that answers JSON (see MessageForm). |
| Slot | Description |
| --- | --- |
| `eyebrow` | A short line above the heading, such as a Badge. Shown only with a heading. |
| `note` | Under the form, small and muted: a privacy line or consent text. Passed to the MessageForm. |
Any other attribute goes on the <section>, or on the <div> without a heading.
## Accessibility
- With a heading, renders a <section> named by it, so it is a region landmark. The heading id is unique on the page.
- Without a heading, renders a plain <div>. Put your own heading above it.
- The details come before the form, in the page and on screen.
- The details are a description list (<dl>): each label is its term, so a screen reader reads "Email, hello@astronomic.example". What you leave out leaves no term.
- The email is a mailto: link that reads the address. It breaks after the @, so it is never split in the middle of a name.
- The phone is a tel: link, shown as you write it; the link keeps only the digits and a leading +, so it dials from a phone.
- On touch screens the email and phone links are boxes of 44px at least.
- The address is in <address>, its lines kept. The hours are a list of their own: the days, then the times.
- The labels are props with plain English defaults: pass your page's own words in another language.
- Every field has a visible label (Field) and its autocomplete value (name, email, organization, tel), so the browser can fill it. Name, email and message are required and marked so.
- With no script, or before it loads, the form posts to its action and the browser checks the required fields and the email itself.
- The topic is a native <select>: its first option is empty and selected, so a reader who never picks one sends no topic. It works with the keyboard and screen readers as any select does.
- With enhance="fetch", a bad field gets its error text under it, aria-invalid and the error id in aria-describedby, and focus moves to the first bad field. The FormStatus under the button says sending, then success or the error.
ContactSplit
FreeFor a contact page: your details beside a message form.
- File
- ContactSplit.astro
- Group
- Marketing sections
- Kind
- Interactive: inline script
- Examples
- 1
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
Details beside the form
From a 48rem section your details sit in the start column and the message form in the wider end column; below that they stack, the details first, so a reader who wants only the phone number finds it before the form. Here the form asks for a topic, has a privacy note, and posts to #.
This preview did not load.
main.astro
examples/contactsplit/main.astro
---
import Badge from "@astronomic-dev/ui/components/Badge.astro";
import ContactSplit from "@astronomic-dev/ui/components/ContactSplit.astro";
// Made-up details: a reserved .example address and a US number from the range kept for fiction (555-0100 to 555-0199).
const hours = [
{ label: "Mon to Thu", value: "9 a.m. to 5:30 p.m." },
{ label: "Fri", value: "9 a.m. to 3 p.m." },
];
---
<div class="mx-auto max-w-6xl px-6 py-16">
<ContactSplit
heading="Start a project"
text="Tell us what you need and when. A person from the studio answers within two business days."
email="hello@astronomic.example"
phone="+1 (312) 555-0147"
address={["Astronomic", "12 Orbit Lane", "Example City, IL 60601"]}
hours={hours}
form={{ action: "#", topics: ["A new site", "A redesign", "Something else"] }}
>
<Badge slot="eyebrow">Contact</Badge>
<p slot="note" class="m-0">We only use your details to answer you. No newsletter, no sharing.</p>
</ContactSplit>
</div>Minimal · Light