Marketing sectionsNewsletterCard
Searchastronomic.dev# NewsletterCard
For a signup box in a sidebar or at the end of a post.
Interactive: inline script.
## Usage
```astro
import NewsletterCard from "@astronomic/ui-pro/components/NewsletterCard.astro";
```
## Examples
### In a sidebar
The header and the form inside a kit Card, here in a 20rem column, as in a sidebar or at the end of a post. The heading takes the subhead role, sized to the card, so it never outweighs the page's own headings. The form is stacked with its label shown, and posts to # here. A Card is its own surface, so there is no band tone.
```astro
---
import NewsletterCard from "@astronomic/ui-pro/components/NewsletterCard.astro";
---
<div class="mx-auto max-w-6xl px-6 py-16">
<div class="max-w-80">
<NewsletterCard heading="Get the monthly notes" text="What we built, what we learned, and one site we liked." form={{ action: "#" }}>
<p slot="note" class="m-0">One email a month. Unsubscribe at any time.</p>
</NewsletterCard>
</div>
</div>
```
## Props
### NewsletterCard
| 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. |
| `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. |
| `class` | `string` | None | More classes for the Card, merged with cn(), such as a width cap or a margin. Other attributes (id, aria-*, data-*) go on the section inside it. |
| 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> inside the Card, 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 section is inside the Card, so the region is named by the card's own heading. Pick its level for where the card sits: headingTag="h3" under a post's h2, or "h2" in a sidebar.
- 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.
NewsletterCard
ProFor a signup box in a sidebar or at the end of a post.
- File
- NewsletterCard.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
In a sidebar
The header and the form inside a kit Card, here in a 20rem column, as in a sidebar or at the end of a post. The heading takes the subhead role, sized to the card, so it never outweighs the page's own headings. The form is stacked with its label shown, and posts to # here. A Card is its own surface, so there is no band tone.
Minimal · Light