Skip to content
Haze UI

Story viewer

Portrait stories frame with segmented progress, tap zones and auto-advance for short sequential updates; a scroll-snap list without script.

pnpm dlx shadcn@latest add @haze/story-viewer
Open preview in a new tab
Livesmall script

When to use

  • A short "What's new" sequence of three to six slides in a product or app tour
  • Release highlights that read best one at a time in a phone-shaped frame
  • Onboarding tips where each step is a title and a sentence

When not to use

  • Content readers must scan side by side or revisit freely; use carousel
  • A stack of cards the reader dismisses one by one; use card-stack
  • Long text or forms inside a slide; auto-advance moves on before people finish

Installation

Add the Haze registry to components.json once, then install Story viewer with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/story-viewer
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
id*string–Unique on the page.
slides{ title: string; body: string; accent?: "default" | "brand" | "success" | "warning" | "destructive" }[]four Ledgerline updatesOne entry per slide. accent tints the slide surface with a token color.
authorstring"Ledgerline"Name beside the avatar; its initials fill the avatar.
timestring"2 hours ago"Relative time text shown after the author. Written by the caller, never computed.
durationnumber5Seconds each slide stays before the next starts. Ignored under prefers-reduced-motion.
headingLevel2 | 3 | 4 | 53Heading level of each slide title.
labelstring"What's new in Ledgerline"Accessible name of the viewer.
previousLabelstring"Previous slide"Accessible name of the previous button.
nextLabelstring"Next slide"Accessible name of the next button.
pauseLabelstring"Pause"Accessible name of the pause toggle.
slideLabelstring"Slide"Word before the position in announcements and counters, as in "Slide 2 of 4".
ofLabelstring"of"Word between position and total in announcements.
classstring–Extra classes on the wrapper.

Keyboard interactions

LeftRight
Go to the previous or next slide while focus is on the frame or one of its buttons
Space
Pause or resume auto-advance while the frame itself has focus
Tab
Move between the frame, Previous, Pause and Next
EnterSpace
Activate the focused button

Accessibility

  • Without script every slide is a list item in a horizontal scroll-snap list inside the frame, each with a visible "1 / 4" counter; the list is focusable so keyboard users can scroll it.
  • With script one slide shows at a time and the others are hidden from assistive technology. The segmented progress bars are decorative; the counter text and live region carry the position.
  • Auto-advance pauses while the pointer rests on the frame, while keyboard focus is inside it, while the tab is hidden or the viewer is off screen, and through the Pause toggle (aria-pressed).
  • Under prefers-reduced-motion nothing advances on its own and the Pause button is removed; readers move with the buttons, tap zones or arrow keys, and the current bar is shown full.
  • Slide changes are announced politely only after a reader's own navigation. Automatic advances are never announced.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI component "Story viewer" with `npx shadcn@latest add @haze/story-viewer`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import StoryViewer from "@/components/haze/ui/story-viewer.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/story-viewer.md

  • Customize with real content

    Adapt the Haze story-viewer ui for our product. Replace the demo values of these props with our real content: id, slides, author, time, duration, headingLevel, label, previousLabel, nextLabel, pauseLabel, slideLabel, ofLabel, class. Keep the layout, the heading level rules and these accessibility details: Without script every slide is a list item in a horizontal scroll-snap list inside the frame, each with a visible "1 / 4" counter; the list is focusable so keyboard users can scroll it. With script one slide shows at a time and the others are hidden from assistive technology. The segmented progress bars are decorative; the counter text and live region carry the position. Auto-advance pauses while the pointer rests on the frame, while keyboard focus is inside it, while the tab is hidden or the viewer is off screen, and through the Pause toggle (aria-pressed). Under prefers-reduced-motion nothing advances on its own and the Pause button is removed; readers move with the buttons, tap zones or arrow keys, and the current bar is shown full. Slide changes are announced politely only after a reader's own navigation. Automatic advances are never announced. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using story-viewer, check it fits: use it when a short "what's new" sequence of three to six slides in a product or app tour; release highlights that read best one at a time in a phone-shaped frame; onboarding tips where each step is a title and a sentence. Avoid it when content readers must scan side by side or revisit freely; use carousel; a stack of cards the reader dismisses one by one; use card-stack; long text or forms inside a slide; auto-advance moves on before people finish. Alternatives: @haze/carousel, @haze/card-stack.

Dependencies

  • npm: @lucide/astro
  • @haze/avatar
  • @haze/placeholder
  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog