Skip to content
Haze UI

Dialog stack

Native modal for a short multi-step flow; finished steps peek behind the current one. All steps list in order without script.

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

When to use

  • A two to four step flow such as invite, choose a role, review, where the user should see progress behind the panel
  • A short setup wizard that must not leave the current page
  • Steps that share one trigger and one outcome, with Back and Next between them

When not to use

  • A single decision or short form needs only dialog.
  • A long flow with many fields deserves its own page; use stepper for in-page progress.
  • Side-anchored detail panels fit drawer better than a centered modal.

Installation

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

pnpm dlx shadcn@latest add @haze/dialog-stack
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. Buttons target it with commandfor="<id>"; step ids derive from it.
steps{ title: string; description: string; body?: string }[]three-step invite flowOne entry per step. Each gets its own heading and description.
triggerbooleantrueSet to false when the opening button lives elsewhere.
triggerLabelstring"Invite teammates"Trigger button text.
triggerVariant"primary" | "secondary" | "outline" | "ghost""outline"Trigger button style.
stepLabelstring"Step"First word of the counter text, "Step 2 of 3". Translate it.
ofLabelstring"of"Middle word of the counter text. Translate it.
backLabelstring"Back"Back button text.
nextLabelstring"Next"Next button text.
doneLabelstring"Done"Final button text; closes the dialog.
closeLabelstring"Close"Accessible name of the close icon button.
headingLevel2 | 3 | 4 | 5 | 62Heading level of each step title.
classstring–Extra classes on the dialog.

Keyboard interactions

EnterSpace
Open the dialog from the trigger; press Back, Next or Done
TabShiftTab
Move between the current step's controls; focus stays inside the dialog
Escape
Close the whole stack and return focus to the trigger

Accessibility

  • showModal() semantics: the page behind is inert, focus stays inside and returns to the trigger on close.
  • The dialog's aria-labelledby and aria-describedby follow the current step. Earlier and later steps are inert, so assistive tech and Tab only reach the current panel.
  • Moving Back or Next puts focus on the new step's heading; the "Step 2 of 3" counter is plain text above it.
  • Without script every step shows as a section in one scrollable dialog with a single Done button, and Back and Next stay hidden.
  • Opening uses command and commandfor (Chrome 135, Firefox 144, Safari 26.2); the small shared script covers older browsers. Panels slide over 300 ms; reduced-motion users get none.

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 "Dialog stack" with `npx shadcn@latest add @haze/dialog-stack`. 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 DialogStack from "@/components/haze/ui/dialog-stack.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/dialog-stack.md

  • Customize with real content

    Adapt the Haze dialog-stack ui for our product. Replace the demo values of these props with our real content: id, steps, trigger, triggerLabel, triggerVariant, stepLabel, ofLabel, backLabel, nextLabel, doneLabel, closeLabel, headingLevel, class. Keep the layout, the heading level rules and these accessibility details: showModal() semantics: the page behind is inert, focus stays inside and returns to the trigger on close. The dialog's aria-labelledby and aria-describedby follow the current step. Earlier and later steps are inert, so assistive tech and Tab only reach the current panel. Moving Back or Next puts focus on the new step's heading; the "Step 2 of 3" counter is plain text above it. Without script every step shows as a section in one scrollable dialog with a single Done button, and Back and Next stay hidden. Opening uses command and commandfor (Chrome 135, Firefox 144, Safari 26.2); the small shared script covers older browsers. Panels slide over 300 ms; reduced-motion users get none. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using dialog-stack, check it fits: use it when a two to four step flow such as invite, choose a role, review, where the user should see progress behind the panel; a short setup wizard that must not leave the current page; steps that share one trigger and one outcome, with back and next between them. Avoid it when a single decision or short form needs only dialog.; a long flow with many fields deserves its own page; use stepper for in-page progress.; side-anchored detail panels fit drawer better than a centered modal.. Alternatives: @haze/dialog, @haze/drawer, @haze/stepper, @haze/alert-dialog.

Dependencies

  • npm: @lucide/astro
  • @haze/button
  • @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