Publishing sectionsStoryRail
Searchastronomic.dev# StoryRail
At the top of a home page that leads with many stories at once: a row of tall photo cards that scrolls sideways, each opening to show its summary.
Interactive: inline script.
## Usage
```astro
import StoryRail from "@astronomic/ui-pro/components/StoryRail.astro";
```
## Examples
### Eight stories
Tall photo cards in a row that scrolls sideways and snaps to each card. The first card starts open, wider, with its summary; the pointer or focus opens another. The arrows scroll by card.
```astro
---
import StoryRail from "@astronomic/ui-pro/components/StoryRail.astro";
// Your own photos.
import binders from "../../photos/folder-stack.webp";
import concrete from "../../photos/concrete-slab.webp";
import desk from "../../photos/studio-desk.webp";
import notebook from "../../photos/leather-notebook.webp";
import plants from "../../photos/plants-shelf.webp";
import shelves from "../../photos/studio-shelves.webp";
import sketch from "../../photos/sketching-wireframes.webp";
import stairway from "../../photos/white-stairway.webp";
// Your stories, newest first. Dates are "YYYY-MM-DD" strings; each photo is decoration (the title says the story).
const stories = [
{ href: "#launch", title: "How we plan a launch in two weeks", excerpt: "One page of dates on the studio wall, and the one meeting we never skip.", date: "2026-10-14", topic: { label: "Process", href: "#topic-process" }, image: { src: desk } },
{ href: "#sketch", title: "Sketch the page before the first pixel", excerpt: "Why every Astronomic project starts with a pencil, and what the sketches decide.", date: "2026-10-12", topic: { label: "Design", href: "#topic-design" }, image: { src: sketch } },
{ href: "#cut", title: "What we cut from our own site", excerpt: "Three pages, two animations and one font: less was the faster way to say it.", date: "2026-10-09", topic: { label: "Studio", href: "#topic-studio" }, image: { src: stairway } },
{ href: "#files", title: "How we name the files we hand over", excerpt: "A client should find any file in ten seconds, a year later.", date: "2026-10-07", topic: { label: "Process", href: "#topic-process" }, image: { src: binders } },
{ href: "#kitchen", title: "The studio kitchen, in plates", excerpt: "Who cooks on Fridays, and why the bowls never match.", date: "2026-10-05", topic: { label: "Studio", href: "#topic-studio" }, image: { src: shelves } },
{ href: "#notes", title: "Notes that outlive the project", excerpt: "The one notebook every project gets, and what goes in it after launch.", date: "2026-10-02", topic: { label: "Writing", href: "#topic-writing" }, image: { src: notebook } },
{ href: "#plants", title: "The plants that outlived three offices", excerpt: "Who waters them, who moved them, and the fern from the first room.", date: "2026-09-29", topic: { label: "Studio", href: "#topic-studio" }, image: { src: plants } },
{ href: "#concrete", title: "Building pages like buildings", excerpt: "What a concrete facade taught us about grids that hold.", date: "2026-09-25", topic: { label: "Design", href: "#topic-design" }, image: { src: concrete } },
];
---
<div class="mx-auto max-w-6xl px-6 py-10">
<StoryRail heading="This week in the Astronomic journal" items={stories} />
</div>
```
### Three stories
Nothing to scroll in a wide rail: both arrows end disabled.
```astro
---
import StoryRail from "@astronomic/ui-pro/components/StoryRail.astro";
// Your own photos.
import desk from "../../photos/studio-desk.webp";
import sketch from "../../photos/sketching-wireframes.webp";
import stairway from "../../photos/white-stairway.webp";
// Your stories, newest first. Dates are "YYYY-MM-DD" strings; each photo is decoration (the title says the story).
const stories = [
{ href: "#launch", title: "How we plan a launch in two weeks", excerpt: "One page of dates on the studio wall, and the one meeting we never skip.", date: "2026-10-14", topic: { label: "Process", href: "#topic-process" }, image: { src: desk } },
{ href: "#sketch", title: "Sketch the page before the first pixel", excerpt: "Why every Astronomic project starts with a pencil, and what the sketches decide.", date: "2026-10-12", topic: { label: "Design", href: "#topic-design" }, image: { src: sketch } },
{ href: "#cut", title: "What we cut from our own site", excerpt: "Three pages, two animations and one font: less was the faster way to say it.", date: "2026-10-09", topic: { label: "Studio", href: "#topic-studio" }, image: { src: stairway } },
];
---
<!-- Three stories: at 1280 nothing scrolls, so both arrows end disabled. -->
<div class="mx-auto max-w-6xl px-6 py-10">
<StoryRail heading="Three from the studio" items={stories} />
</div>
```
### Edge to edge
Outside the Container: headerClass gives the heading row the container's classes, and listClass a start padding and scroll padding that line the first card up with it, so the rail runs to the window's edge.
```astro
---
import StoryRail from "@astronomic/ui-pro/components/StoryRail.astro";
// Your own photos.
import binders from "../../photos/folder-stack.webp";
import concrete from "../../photos/concrete-slab.webp";
import desk from "../../photos/studio-desk.webp";
import notebook from "../../photos/leather-notebook.webp";
import plants from "../../photos/plants-shelf.webp";
import shelves from "../../photos/studio-shelves.webp";
import sketch from "../../photos/sketching-wireframes.webp";
import stairway from "../../photos/white-stairway.webp";
// Your stories, newest first. Dates are "YYYY-MM-DD" strings; each photo is decoration (the title says the story).
const stories = [
{ href: "#launch", title: "How we plan a launch in two weeks", excerpt: "One page of dates on the studio wall, and the one meeting we never skip.", date: "2026-10-14", topic: { label: "Process", href: "#topic-process" }, image: { src: desk } },
{ href: "#sketch", title: "Sketch the page before the first pixel", excerpt: "Why every Astronomic project starts with a pencil, and what the sketches decide.", date: "2026-10-12", topic: { label: "Design", href: "#topic-design" }, image: { src: sketch } },
{ href: "#cut", title: "What we cut from our own site", excerpt: "Three pages, two animations and one font: less was the faster way to say it.", date: "2026-10-09", topic: { label: "Studio", href: "#topic-studio" }, image: { src: stairway } },
{ href: "#files", title: "How we name the files we hand over", excerpt: "A client should find any file in ten seconds, a year later.", date: "2026-10-07", topic: { label: "Process", href: "#topic-process" }, image: { src: binders } },
{ href: "#kitchen", title: "The studio kitchen, in plates", excerpt: "Who cooks on Fridays, and why the bowls never match.", date: "2026-10-05", topic: { label: "Studio", href: "#topic-studio" }, image: { src: shelves } },
{ href: "#notes", title: "Notes that outlive the project", excerpt: "The one notebook every project gets, and what goes in it after launch.", date: "2026-10-02", topic: { label: "Writing", href: "#topic-writing" }, image: { src: notebook } },
{ href: "#plants", title: "The plants that outlived three offices", excerpt: "Who waters them, who moved them, and the fern from the first room.", date: "2026-09-29", topic: { label: "Studio", href: "#topic-studio" }, image: { src: plants } },
{ href: "#concrete", title: "Building pages like buildings", excerpt: "What a concrete facade taught us about grids that hold.", date: "2026-09-25", topic: { label: "Design", href: "#topic-design" }, image: { src: concrete } },
];
---
<!-- Outside the Container: the heading row takes your container's classes, and the list a start padding (and scroll padding) that lines the first card up with it. -->
<div class="py-10">
<StoryRail
heading="This week in the Astronomic journal"
items={stories}
headerClass="mx-auto w-full max-w-6xl px-6"
listClass="ps-[max(1.5rem,calc((100%_-_72rem)/2_+_1.5rem))] pe-6 scroll-ps-[max(1.5rem,calc((100%_-_72rem)/2_+_1.5rem))]"
/>
</div>
```
## Props
### StoryRail
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `heading` | `string` | None | Required. The rail's label heading, such as "This week in Port Calder", small and semibold. The region is named by it. |
| `headingTag` | `"h2" \| "h3" \| "h4"` | `"h2"` | The heading element. Each card's title sits one level under it. |
| `itemHeadingTag` | `"h2" \| "h3" \| "h4" \| "h5"` | None | Passed to childHeadingTag (lib/heading.ts); the rail always has a heading, so the titles sit one level under headingTag. |
| `items` | `StoryRailItem[]` | None | Required, two or more (six to eight reads best; fewer than two stop the build): { href, title, excerpt?, date?, dateLabel?, topic?, image } (StoryRailItem). image is { src, width?, height?, focalPoint?, loading? }, required, decoration: the part writes alt="". The first three load eagerly unless they set loading. date is "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". |
| `previousLabel` | `string` | `"Previous stories"` | The previous arrow's name. |
| `nextLabel` | `string` | `"Next stories"` | The next arrow's name. |
| `locale` | `string` | `"en"` | The dates' language, such as "de" (14.10.2026). The default prints "Oct 14, 2026". |
| `imageComponent` | `ImageComponent` | None | Your image component, for every photo: Astro's <Image>, or a small wrapper for your CMS. It gets sizes="(max-width: 48rem) 80vw, 35rem" (the open card at most). |
| `headerClass` | `string` | None | Classes for the heading row. To run the rail full bleed, put StoryRail outside your Container and give this your container's classes. |
| `listClass` | `string` | None | Classes for the rail (the scroller): its start padding and scroll padding, so the first card lines up (such as ps-6 scroll-ps-6). |
| `class` | `string` | None | More classes for the <section>, merged with cn(). The section is a named size container (rail): the card widths read it. |
Any other attribute goes on the <section>.
## Accessibility
- A region named by its heading; the stories are a list (<ul role="list">).
- Each card is one link, through its title; the topic is a link of its own, before the title, with a 44px hit area on touch screens.
- The photos are decorative: the title says what each story is.
- Each title sits one level under the rail's heading (h2 gives h3).
- The arrows show only with the script, and stop at each end: a disabled arrow leaves the Tab order, and focus moves to the other arrow if it was on it.
- Tab moves card by card, the topic then the title; a focused card opens and scrolls fully into view.
- On touch screens and narrow rails every summary shows and no card widens.
- With reduced motion nothing animates and the arrows jump.
- The text on each photo is in --ui-scrim-fg on the scrim, so it reads at 4.5:1 on any photo in every kit preset, light and dark; the focus ring shows on any photo.
StoryRail
ProAt the top of a home page that leads with many stories at once: a row of tall photo cards that scrolls sideways, each opening to show its summary.
- File
- StoryRail.astro
- Group
- Publishing sections
- Kind
- Interactive: inline script
- Examples
- 3
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
Eight stories
Tall photo cards in a row that scrolls sideways and snaps to each card. The first card starts open, wider, with its summary; the pointer or focus opens another. The arrows scroll by card.
This preview did not load.
examples/storyrail/main.astro
---
import StoryRail from "@astronomic/ui-pro/components/StoryRail.astro";
// Your own photos.
import binders from "../../photos/folder-stack.webp";
import concrete from "../../photos/concrete-slab.webp";
import desk from "../../photos/studio-desk.webp";
import notebook from "../../photos/leather-notebook.webp";
import plants from "../../photos/plants-shelf.webp";
import shelves from "../../photos/studio-shelves.webp";
import sketch from "../../photos/sketching-wireframes.webp";
import stairway from "../../photos/white-stairway.webp";
// Your stories, newest first. Dates are "YYYY-MM-DD" strings; each photo is decoration (the title says the story).
const stories = [
{ href: "#launch", title: "How we plan a launch in two weeks", excerpt: "One page of dates on the studio wall, and the one meeting we never skip.", date: "2026-10-14", topic: { label: "Process", href: "#topic-process" }, image: { src: desk } },
{ href: "#sketch", title: "Sketch the page before the first pixel", excerpt: "Why every Astronomic project starts with a pencil, and what the sketches decide.", date: "2026-10-12", topic: { label: "Design", href: "#topic-design" }, image: { src: sketch } },
{ href: "#cut", title: "What we cut from our own site", excerpt: "Three pages, two animations and one font: less was the faster way to say it.", date: "2026-10-09", topic: { label: "Studio", href: "#topic-studio" }, image: { src: stairway } },
{ href: "#files", title: "How we name the files we hand over", excerpt: "A client should find any file in ten seconds, a year later.", date: "2026-10-07", topic: { label: "Process", href: "#topic-process" }, image: { src: binders } },
{ href: "#kitchen", title: "The studio kitchen, in plates", excerpt: "Who cooks on Fridays, and why the bowls never match.", date: "2026-10-05", topic: { label: "Studio", href: "#topic-studio" }, image: { src: shelves } },
{ href: "#notes", title: "Notes that outlive the project", excerpt: "The one notebook every project gets, and what goes in it after launch.", date: "2026-10-02", topic: { label: "Writing", href: "#topic-writing" }, image: { src: notebook } },
{ href: "#plants", title: "The plants that outlived three offices", excerpt: "Who waters them, who moved them, and the fern from the first room.", date: "2026-09-29", topic: { label: "Studio", href: "#topic-studio" }, image: { src: plants } },
{ href: "#concrete", title: "Building pages like buildings", excerpt: "What a concrete facade taught us about grids that hold.", date: "2026-09-25", topic: { label: "Design", href: "#topic-design" }, image: { src: concrete } },
];
---
<div class="mx-auto max-w-6xl px-6 py-10">
<StoryRail heading="This week in the Astronomic journal" items={stories} />
</div>Three stories
Nothing to scroll in a wide rail: both arrows end disabled.
This preview did not load.
examples/storyrail/few.astro
---
import StoryRail from "@astronomic/ui-pro/components/StoryRail.astro";
// Your own photos.
import desk from "../../photos/studio-desk.webp";
import sketch from "../../photos/sketching-wireframes.webp";
import stairway from "../../photos/white-stairway.webp";
// Your stories, newest first. Dates are "YYYY-MM-DD" strings; each photo is decoration (the title says the story).
const stories = [
{ href: "#launch", title: "How we plan a launch in two weeks", excerpt: "One page of dates on the studio wall, and the one meeting we never skip.", date: "2026-10-14", topic: { label: "Process", href: "#topic-process" }, image: { src: desk } },
{ href: "#sketch", title: "Sketch the page before the first pixel", excerpt: "Why every Astronomic project starts with a pencil, and what the sketches decide.", date: "2026-10-12", topic: { label: "Design", href: "#topic-design" }, image: { src: sketch } },
{ href: "#cut", title: "What we cut from our own site", excerpt: "Three pages, two animations and one font: less was the faster way to say it.", date: "2026-10-09", topic: { label: "Studio", href: "#topic-studio" }, image: { src: stairway } },
];
---
<!-- Three stories: at 1280 nothing scrolls, so both arrows end disabled. -->
<div class="mx-auto max-w-6xl px-6 py-10">
<StoryRail heading="Three from the studio" items={stories} />
</div>Edge to edge
Outside the Container: headerClass gives the heading row the container's classes, and listClass a start padding and scroll padding that line the first card up with it, so the rail runs to the window's edge.
This preview did not load.
examples/storyrail/full-bleed.astro
---
import StoryRail from "@astronomic/ui-pro/components/StoryRail.astro";
// Your own photos.
import binders from "../../photos/folder-stack.webp";
import concrete from "../../photos/concrete-slab.webp";
import desk from "../../photos/studio-desk.webp";
import notebook from "../../photos/leather-notebook.webp";
import plants from "../../photos/plants-shelf.webp";
import shelves from "../../photos/studio-shelves.webp";
import sketch from "../../photos/sketching-wireframes.webp";
import stairway from "../../photos/white-stairway.webp";
// Your stories, newest first. Dates are "YYYY-MM-DD" strings; each photo is decoration (the title says the story).
const stories = [
{ href: "#launch", title: "How we plan a launch in two weeks", excerpt: "One page of dates on the studio wall, and the one meeting we never skip.", date: "2026-10-14", topic: { label: "Process", href: "#topic-process" }, image: { src: desk } },
{ href: "#sketch", title: "Sketch the page before the first pixel", excerpt: "Why every Astronomic project starts with a pencil, and what the sketches decide.", date: "2026-10-12", topic: { label: "Design", href: "#topic-design" }, image: { src: sketch } },
{ href: "#cut", title: "What we cut from our own site", excerpt: "Three pages, two animations and one font: less was the faster way to say it.", date: "2026-10-09", topic: { label: "Studio", href: "#topic-studio" }, image: { src: stairway } },
{ href: "#files", title: "How we name the files we hand over", excerpt: "A client should find any file in ten seconds, a year later.", date: "2026-10-07", topic: { label: "Process", href: "#topic-process" }, image: { src: binders } },
{ href: "#kitchen", title: "The studio kitchen, in plates", excerpt: "Who cooks on Fridays, and why the bowls never match.", date: "2026-10-05", topic: { label: "Studio", href: "#topic-studio" }, image: { src: shelves } },
{ href: "#notes", title: "Notes that outlive the project", excerpt: "The one notebook every project gets, and what goes in it after launch.", date: "2026-10-02", topic: { label: "Writing", href: "#topic-writing" }, image: { src: notebook } },
{ href: "#plants", title: "The plants that outlived three offices", excerpt: "Who waters them, who moved them, and the fern from the first room.", date: "2026-09-29", topic: { label: "Studio", href: "#topic-studio" }, image: { src: plants } },
{ href: "#concrete", title: "Building pages like buildings", excerpt: "What a concrete facade taught us about grids that hold.", date: "2026-09-25", topic: { label: "Design", href: "#topic-design" }, image: { src: concrete } },
];
---
<!-- Outside the Container: the heading row takes your container's classes, and the list a start padding (and scroll padding) that lines the first card up with it. -->
<div class="py-10">
<StoryRail
heading="This week in the Astronomic journal"
items={stories}
headerClass="mx-auto w-full max-w-6xl px-6"
listClass="ps-[max(1.5rem,calc((100%_-_72rem)/2_+_1.5rem))] pe-6 scroll-ps-[max(1.5rem,calc((100%_-_72rem)/2_+_1.5rem))]"
/>
</div>