Data displayStoryRailCard
Searchastronomic.dev# StoryRailCard
For one story in a StoryRail: its photo, topic, date, title and summary. StoryRail uses it for you.
Static: no JavaScript.
## Usage
```astro
import StoryRailCard from "@astronomic/ui-pro/components/StoryRailCard.astro";
```
## Examples
### In its rail
StoryRailCard needs its StoryRail: the widths, the open state and the summary read the rail's container and script. StoryRail draws one per story.
```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";
// 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 } },
];
---
<!-- StoryRailCard needs its rail (the widths, the open state and the summary): StoryRail draws one per story. -->
<div class="mx-auto max-w-3xl">
<StoryRail heading="Two stories" items={stories} />
</div>
```
## Props
### StoryRailCard
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `href` | `string` | None | Required. The story's URL. The title is the only link to it, and it covers the card: a tap on the photo or the summary opens the story too. |
| `title` | `string` | None | Required. The story's title, in the subhead role, sized to the card. |
| `excerpt` | `string` | None | A line or two: it shows when the card opens (two lines), and always on a touch screen or a narrow rail (three lines). |
| `date` | `DateInput` | None | The story's date, as a <time>. |
| `dateLabel` | `string` | None | Your own text in place of the printed date. Shown only with a date. |
| `topic` | `PostTopic` | None | { label, href? }: a pill on the photo; with href, a link of its own. |
| `image` | `DecorativeImage` | None | Required. The photo, as decoration: the part writes alt="". |
| `headingTag` | `"h2" \| "h3" \| "h4" \| "h5"` | None | Required. The title's level: StoryRail passes one under its heading. |
| `open` | `boolean` | `false` | The card that starts open. StoryRail sets it on the first card; the script moves it. |
| `locale` | `string` | `"en"` | The date's language. |
| `imageComponent` | `ImageComponent` | None | Your image component for the photo. |
| `imageSizes` | `string` | None | How wide the photo shows, for imageComponent's sizes. StoryRail sets it. |
| `class` | `string` | None | More classes for the <article>, merged with cn(). |
Any other attribute goes on the <article>.
## 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.
StoryRailCard
ProFor one story in a StoryRail: its photo, topic, date, title and summary. StoryRail uses it for you.
- File
- StoryRailCard.astro
- Group
- Data display
- Kind
- Static: no JavaScript
- Examples
- 1
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
In its rail
StoryRailCard needs its StoryRail: the widths, the open state and the summary read the rail's container and script. StoryRail draws one per story.
This preview did not load.
main.astro
examples/storyrailcard/main.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";
// 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 } },
];
---
<!-- StoryRailCard needs its rail (the widths, the open state and the summary): StoryRail draws one per story. -->
<div class="mx-auto max-w-3xl">
<StoryRail heading="Two stories" items={stories} />
</div>Minimal · Light