NavigationSeriesList
Searchastronomic.dev# SeriesList
Beside or under a post in a series: every part in order, with this one marked.
Static: no JavaScript.
## Usage
```astro
import SeriesList from "@astronomic-dev/ui/components/SeriesList.astro";
```
## Examples
### Every part
Every part in order, numbered, on hairlines: the current part is marked and not a link; a part not out yet is muted text; each other row is one link over its whole width. With no current part, the same list serves a series index page.
```astro
---
import SeriesList from "@astronomic-dev/ui/components/SeriesList.astro";
// The parts in order: the one on this page is current; one not out yet has no link.
const parts = [
{ title: "Plan the launch", href: "#part-1", meta: "Oct 2" },
{ title: "Write the pages", href: "#part-2", current: true, meta: "Reading now" },
{ title: "Ship it", href: "#part-3", meta: "Oct 23 · Members" },
{ title: "Look back", meta: "Oct 30" },
];
---
<div class="mx-auto max-w-xl">
<SeriesList title="Launch notes" label="Series" href="#series-launch" parts={parts} />
</div>
```
### In a side column
In a 16rem column, as a theme's side column; long titles wrap inside their row.
```astro
---
import SeriesList from "@astronomic-dev/ui/components/SeriesList.astro";
const parts = [
{ title: "Plan the launch", href: "#part-1" },
{ title: "Write the pages", href: "#part-2", current: true },
{ title: "Ship it", href: "#part-3", meta: "Members" },
{ title: "Look back", meta: "Oct 30" },
];
---
<!-- A 16rem column, as a theme's side column. -->
<div>
<div class="w-64 max-w-full">
<SeriesList title="Launch notes" label="Series" parts={parts} />
</div>
</div>
```
## Props
### SeriesList
| 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. |
| `class` | `string` | None | More classes for the <nav>, merged with cn(). The nav is a named size container (series). |
Any other attribute goes on the <nav>.
## 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.
- The parts are a numbered list (<ol>), so a screen reader says how many there are and which one each is.
- The current part is marked with aria-current and is not a link.
- A part that is not out yet is plain text.
- On touch screens each linked row is 44px tall at least, and the whole row is the link.
SeriesList
FreeBeside or under a post in a series: every part in order, with this one marked.
- File
- SeriesList.astro
- Group
- Navigation
- Kind
- Static: no JavaScript
- Examples
- 2
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
Every part
Every part in order, numbered, on hairlines: the current part is marked and not a link; a part not out yet is muted text; each other row is one link over its whole width. With no current part, the same list serves a series index page.
This preview did not load.
main.astro
examples/serieslist/main.astro
---
import SeriesList from "@astronomic-dev/ui/components/SeriesList.astro";
// The parts in order: the one on this page is current; one not out yet has no link.
const parts = [
{ title: "Plan the launch", href: "#part-1", meta: "Oct 2" },
{ title: "Write the pages", href: "#part-2", current: true, meta: "Reading now" },
{ title: "Ship it", href: "#part-3", meta: "Oct 23 · Members" },
{ title: "Look back", meta: "Oct 30" },
];
---
<div class="mx-auto max-w-xl">
<SeriesList title="Launch notes" label="Series" href="#series-launch" parts={parts} />
</div>In a side column
In a 16rem column, as a theme's side column; long titles wrap inside their row.
This preview did not load.
narrow.astro
examples/serieslist/narrow.astro
---
import SeriesList from "@astronomic-dev/ui/components/SeriesList.astro";
const parts = [
{ title: "Plan the launch", href: "#part-1" },
{ title: "Write the pages", href: "#part-2", current: true },
{ title: "Ship it", href: "#part-3", meta: "Members" },
{ title: "Look back", meta: "Oct 30" },
];
---
<!-- A 16rem column, as a theme's side column. -->
<div>
<div class="w-64 max-w-full">
<SeriesList title="Launch notes" label="Series" parts={parts} />
</div>
</div>Minimal · Light