NavigationSeriesNav
Searchastronomic.dev# SeriesNav
To build your own series navigation: the series name, where this post sits in it, and the other parts. For a ready layout, use SeriesList or SeriesPager.
Static: no JavaScript.
## Usage
```astro
import SeriesNav from "@astronomic-dev/ui/components/SeriesNav.astro";
```
## Examples
### Slots
The nav is a shell: the heading (your label, a middle dot, then the series name, a link to the series page with href) and the position line from the current part always show, then the default slot, where a recipe lays out the parts. SeriesList and SeriesPager are the recipes built on it.
```astro
---
import SeriesNav from "@astronomic-dev/ui/components/SeriesNav.astro";
// The parts in order; one is the post on this page.
const parts = [
{ title: "Plan the launch", href: "#part-1" },
{ title: "Write the pages", href: "#part-2", current: true },
{ title: "Ship it", href: "#part-3" },
{ title: "Look back", meta: "Oct 30" },
];
---
<div class="mx-auto max-w-xl">
<SeriesNav title="Launch notes" label="Series" href="#series-launch" parts={parts}>
<p class="m-0 text-small text-muted">The default slot: your own layout of the parts.</p>
</SeriesNav>
</div>
```
## Props
### SeriesNav
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `title` | `string` | None | Required. The series name, such as "The Last Diners": the nav's heading. |
| `href` | `string` | None | The series page. With it, the name in the heading is a link. |
| `label` | `string` | None | Text before the name, such as "Series", muted, with a middle dot. |
| `parts` | `SeriesPart[]` | None | Required, one or more: { title, href?, meta?, current? } (SeriesPart), in order. href is the part's page; without it (not out yet) the title is plain text. meta is your own text, such as "Oct 16 · Members". current marks the part on this page: one at most. |
| `positionText` | `string` | `"Part {part} of {total}"` | Where this part sits; {part} and {total} are filled in. Shown only with a current part. |
| `headingTag` | `"h2" \| "h3" \| "h4"` | `"h2"` | The heading element. |
| `listClass` | `string` | None | For recipes. Classes for the box that holds the default slot. |
| `class` | `string` | None | More classes for the <nav>, merged with cn(). The nav is a named size container (series). |
| Slot | Description |
| --- | --- |
| `default` | Your own layout of the parts. |
Any other attribute goes on the <nav>, such as aria-label to tell two navs of one series apart.
## Accessibility
- Renders a <nav> named by the series heading, so it is a navigation landmark of its own. Two series navs for the same series on one page (a list at the top, a pager at the end) share that name: give one its own aria-label (or aria-labelledby), which goes on the <nav> through the other attributes.
- The label's middle dot is hidden from screen readers.
- The position line ("Part 2 of 4") comes from the one current part. More than one current part stops the build; no parts stop it too.
SeriesNav
FreeTo build your own series navigation: the series name, where this post sits in it, and the other parts. For a ready layout, use SeriesList or SeriesPager.
- File
- SeriesNav.astro
- Group
- Navigation
- Kind
- Static: no JavaScript
- Examples
- 1
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
Slots
The nav is a shell: the heading (your label, a middle dot, then the series name, a link to the series page with href) and the position line from the current part always show, then the default slot, where a recipe lays out the parts. SeriesList and SeriesPager are the recipes built on it.
Minimal · Light