Marketing sectionsNewsletter
Searchastronomic.dev# Newsletter To build your own newsletter layout: a section heading and a signup form, on the page or on the band. For a ready layout, use NewsletterInline or NewsletterCentered. Static: no JavaScript. ## Usage ```astro import Newsletter from "@astronomic-dev/ui/components/Newsletter.astro"; ``` ## Examples ### Slots The section is a shell: the eyebrow, the heading and the text always show in that order, then the body in the default slot: here a SignupForm at a reading width. The shell sets the type, the gaps and, with tone="band", the surface; the recipes lay out the body and pass the tone to the form. NewsletterInline and NewsletterCentered are recipes built on it, and Pro adds NewsletterBenefits and NewsletterCard. The form posts to # here. ```astro --- import Badge from "@astronomic-dev/ui/components/Badge.astro"; import Newsletter from "@astronomic-dev/ui/components/Newsletter.astro"; import SignupForm from "@astronomic-dev/ui/components/SignupForm.astro"; --- <div class="mx-auto max-w-6xl px-6 py-16"> <Newsletter heading="Notes from the studio" text="Once a month: what we built, what we learned, and one site we liked." bodyClass="max-w-md"> <Badge slot="eyebrow">Newsletter</Badge> <SignupForm action="#"> <p slot="note" class="m-0">One email a month. Unsubscribe at any time.</p> </SignupForm> </Newsletter> </div> ``` ## Props ### Newsletter | 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. | | `align` | `"start" \| "center"` | `"start"` | For recipes. The alignment of the header (SectionHead) only: the recipe lays out the body. | | `contentClass` | `string` | None | For recipes. Classes for the row that holds the header and the body, such as a split from a container width. | | `headerClass` | `string` | None | For recipes. Classes for the header (the eyebrow, the heading and the text). | | `headingClass` | `string` | None | For recipes. Classes for the heading, such as text-on-band on a band. | | `leadClass` | `string` | None | For recipes. Classes for the text under the heading, such as text-on-band-muted on a band. | | `bodyClass` | `string` | None | For recipes. Classes for the body box (the form, and anything beside it), such as its width or columns. It sits inside the newsletter container, so its classes can query it (@3xl/newsletter:...). | | `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. | | Slot | Description | | --- | --- | | `eyebrow` | A short line above the heading, such as a Badge. Shown only with a heading. | | `default` | The body: a SignupForm, and anything beside it. | 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 body is a box, not a list: what you put in it is read in the order you write it. Put why to sign up before the form.
Newsletter
FreeTo build your own newsletter layout: a section heading and a signup form, on the page or on the band. For a ready layout, use NewsletterInline or NewsletterCentered.
- File
- Newsletter.astro
- Group
- Marketing sections
- Kind
- Static: no JavaScript
- Examples
- 1
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
Slots
The section is a shell: the eyebrow, the heading and the text always show in that order, then the body in the default slot: here a SignupForm at a reading width. The shell sets the type, the gaps and, with tone="band", the surface; the recipes lay out the body and pass the tone to the form. NewsletterInline and NewsletterCentered are recipes built on it, and Pro adds NewsletterBenefits and NewsletterCard. The form posts to # here.
Minimal · Light