Publishing sectionsArticleHeader
Searchastronomic.dev# ArticleHeader
To build your own post header: the topic, date and reading time, the title, a line under it, a byline and a photo. For a ready layout, use ArticleHeaderPlain or ArticleHeaderCover.
Static: no JavaScript.
## Usage
```astro
import ArticleHeader from "@astronomic-dev/ui/components/ArticleHeader.astro";
```
## Examples
### Slots
The header is a shell: the meta line (the topic pill, then the date, series and reading time), the title, the standfirst and the byline slot always show in that order, then the media slot. Here contentClass puts the photo beside the text from a 48rem header. ArticleHeaderPlain is the free recipe built on it; Pro adds ArticleHeaderCover.
```astro
---
import ArticleHeader from "@astronomic-dev/ui/components/ArticleHeader.astro";
import Media from "@astronomic-dev/ui/components/Media.astro";
// Your own image file.
import desk from "../../photos/studio-desk.webp";
---
<div class="mx-auto max-w-5xl px-6 py-16">
<ArticleHeader
title="How we plan a launch in two weeks"
text="The calendar, the checks and the one meeting we never skip, from the first sketch to the day the site goes live."
date="2026-10-14"
readingTime="8 min read"
series={{ label: "Launch notes, part 1", href: "#series-launch" }}
topic={{ label: "Process", href: "#topic-process" }}
contentClass="@3xl/article-header:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] items-end"
>
<p slot="byline" class="m-0 text-small text-muted">By Ada Brook, the slot under the line.</p>
<Media slot="media" src={desk} alt="A laptop, a framed print and a cactus on a light wood desk." ratio="4/3" loading="eager" />
</ArticleHeader>
</div>
```
## Props
### ArticleHeader
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `title` | `string` | None | Required. The post's title, in the display role in display type, sized to the text block. One long word breaks inside the box. |
| `text` | `string` | None | The standfirst: one or two sentences under the title, in the lead role. |
| `headingTag` | `"h1" \| "h2"` | `"h1"` | The title element. A post header opens its page, so h1; set h2 when the page has its own h1. |
| `date` | `DateInput` | None | The post's date: "YYYY-MM-DD", such as "2026-10-14" (the canonical form), or a Date read in UTC, as Astro content collections give. new Date(2026, 9, 14) is local midnight, which shows the day before east of UTC: pass the string instead. A bad value throws at build time with the value in the message, so no page says "Invalid Date". |
| `dateLabel` | `string` | None | Your own text in place of the printed date, such as "Updated 3 days ago". The datetime stays the date. Shown only with a date. |
| `readingTime` | `string` | None | Your own text, such as "12 min read". |
| `series` | `{ label: string; href?: string }` | None | Where the post sits in a series, your own text, such as { label: "Part 1 of 4", href: "/series/launch" }. With href the label links to the series page. |
| `topic` | `PostTopic` | None | The post's topic as a pill: { label, href? }. With href, a link to the topic's page. |
| `locale` | `string` | `"en"` | The date's language, such as "de" (formatDate in lib/date.ts). |
| `align` | `"start" \| "center"` | `"start"` | The text's alignment, inside the same structure. |
| `tone` | `"page" \| "image"` | `"page"` | For recipes. image when the text sits on the photo, under the recipe's own scrim: the text turns scrim-fg, the topic pill takes its image colors, and every link in the text gets the on-image focus ring. |
| `contentClass` | `string` | None | For recipes. Classes for the row that holds the text block and the media block. In a wider box (a breakout), its padding keeps the text on your content edge. |
| `textClass` | `string` | None | For recipes. Classes for the text block, the named container (article-text) the title sizes to. |
| `headingClass` | `string` | None | For recipes. Classes for the title, after its own. |
| `mediaClass` | `string` | None | For recipes. Classes for the media block. |
| `class` | `string` | None | More classes for the <header>, merged with cn(), so yours win on conflicts. The header is a named size container (inline-size containment): in a shrink-to-fit parent it collapses, so give it a width there. |
| Slot | Description |
| --- | --- |
| `byline` | Under the standfirst: a Byline, or your own line. |
| `media` | After the text block: the photo, or anything you lay out with contentClass. |
Any other attribute goes on the <header>.
## Accessibility
- Renders a <header>: put it inside your <article>, so it is that post's header, not a region of its own.
- The title is the page's h1 by default; set headingTag to h2 when the page has its own h1.
- The date is a <time> with a machine date (datetime="2026-10-14"), whatever the text says. The middle dots between the date, series and reading time are hidden from screen readers.
- The topic is a link with a 44px hit area on touch screens; the pill keeps its small look. The series link is a 44px box on touch screens, so its line grows there; with a mouse it is plain text size.
- With align="center" the meta items have no middle dots: they are split by space, and each line is centered. Start-aligned, a wrapped line never starts with a dot.
- The meta line wraps between its pieces, and a piece wider than the line (a long series name) breaks inside it, so nothing runs out of a narrow column.
ArticleHeader
FreeTo build your own post header: the topic, date and reading time, the title, a line under it, a byline and a photo. For a ready layout, use ArticleHeaderPlain or ArticleHeaderCover.
- File
- ArticleHeader.astro
- Group
- Publishing 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 header is a shell: the meta line (the topic pill, then the date, series and reading time), the title, the standfirst and the byline slot always show in that order, then the media slot. Here contentClass puts the photo beside the text from a 48rem header. ArticleHeaderPlain is the free recipe built on it; Pro adds ArticleHeaderCover.
This preview did not load.
main.astro
examples/articleheader/main.astro
---
import ArticleHeader from "@astronomic-dev/ui/components/ArticleHeader.astro";
import Media from "@astronomic-dev/ui/components/Media.astro";
// Your own image file.
import desk from "../../photos/studio-desk.webp";
---
<div class="mx-auto max-w-5xl px-6 py-16">
<ArticleHeader
title="How we plan a launch in two weeks"
text="The calendar, the checks and the one meeting we never skip, from the first sketch to the day the site goes live."
date="2026-10-14"
readingTime="8 min read"
series={{ label: "Launch notes, part 1", href: "#series-launch" }}
topic={{ label: "Process", href: "#topic-process" }}
contentClass="@3xl/article-header:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] items-end"
>
<p slot="byline" class="m-0 text-small text-muted">By Ada Brook, the slot under the line.</p>
<Media slot="media" src={desk} alt="A laptop, a framed print and a cactus on a light wood desk." ratio="4/3" loading="eager" />
</ArticleHeader>
</div>Minimal · Light