Marketing sectionsNewsletterInline
Searchastronomic.dev# NewsletterInline
To ask for email signups beside a short heading, the field and button in one row.
Interactive: inline script.
## Usage
```astro
import NewsletterInline from "@astronomic-dev/ui/components/NewsletterInline.astro";
```
## Examples
### The heading beside the form
From a 48rem section (on the band, 48rem inside its padding) the header sits in the start column and the form in the end column, lined up with the header's top, so an error or a status under the form never moves the field or the button; below that they stack, the header first. The field and button share one row and the button drops under the field in a narrow box. The heading says what the field is for, so the field labels are for screen readers only (pass labelHidden: false in form to show them). It posts to # here.
```astro
---
import Badge from "@astronomic-dev/ui/components/Badge.astro";
import NewsletterInline from "@astronomic-dev/ui/components/NewsletterInline.astro";
---
<div class="mx-auto max-w-6xl px-6 py-16">
<NewsletterInline heading="Get the monthly notes" text="What we built, what we learned, and one site we liked." form={{ action: "#" }}>
<Badge slot="eyebrow">Newsletter</Badge>
<p slot="note" class="m-0">One email a month. Unsubscribe at any time.</p>
</NewsletterInline>
</div>
```
## Props
### NewsletterInline
| 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. Benefit titles, if any, sit one level under it. |
| `tone` | `"page" \| "band"` | `"page"` | The surface. page: on the page. band: the band (surface-band, the band when a preset sets --ui-band, else the page) with its focus ring, an edge and padding, wider once the section is 48rem across. The padding sits on a box inside the section, so a class you pass (padding too) goes to the section, around that box. The recipes' two columns then start when the space inside the padding is 48rem: on the band that is 48rem plus twice the wide padding. Give the form the same tone. |
| `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. |
| `form` | `SignupFormOptions` | None | Required. The form's settings: its action (required) and any SignupForm prop but tone and class (SignupFormOptions), spread onto the form, such as { action: "https://buttondown.com/api/emails/embed-subscribe/<user>", hiddenFields: [{ name: "embed", value: "1" }] }. A plain post is the safe default; see SignupForm for each provider's row. |
| 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: the privacy line. Passed to the SignupForm. |
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.
- With tone="band", the section takes the band's background, text color and focus ring. A shell cannot pass the tone into its slot, so give the SignupForm tone="band" too (the recipes do it for you).
- The header comes before the form, in the page and on screen.
- The email label is kept for screen readers (labelHidden), so the field is read as "Email"; the heading beside it says what it is for.
- Each field has a visible label, or, with labelHidden, a label kept for screen readers only, when the heading beside the form already says what it is for. A placeholder is only a hint, never the label.
- The email field is type=email with autocomplete email and no spellcheck, and is required and marked so; the optional name field has autocomplete name.
- The note slot holds the privacy line (how often you write, how to unsubscribe), under the form, small and muted.
- With no script, or before it loads, the form posts to its action and the browser checks the email itself. Buttondown, Mailchimp and Formspree each show their own page after the post, so a signup works with no JavaScript.
- With enhance="fetch", a bad email gets its error text under the field, aria-invalid and the error id in aria-describedby, and focus moves to it. The FormStatus under the button says sending, then success or the error. Use it only with an endpoint that answers JSON (Formspree); Buttondown and Mailchimp must use a plain post.
NewsletterInline
FreeTo ask for email signups beside a short heading, the field and button in one row.
- File
- NewsletterInline.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
The heading beside the form
From a 48rem section (on the band, 48rem inside its padding) the header sits in the start column and the form in the end column, lined up with the header's top, so an error or a status under the form never moves the field or the button; below that they stack, the header first. The field and button share one row and the button drops under the field in a narrow box. The heading says what the field is for, so the field labels are for screen readers only (pass labelHidden: false in form to show them). It posts to # here.
Minimal · Light