Design.dev design.dev
Forms · Component Template

Multi-Step Form Wizard

A multi-step form with progress indicator, per-step validation, sessionStorage persistence, and a review summary. Vanilla HTML, CSS, and JavaScript with no libraries.

Live demo

Stepper · Validation · Persistence

Fill in each step to see inline validation. Refresh the page and your input is restored.

The Prompt 546 words

Build a multi-step form wizard with progress indicators, per-step validation, sessionStorage persistence, and a review summary. Match my project's existing stack, conventions, and design tokens. If there are none, output a single HTML file with inline CSS and JavaScript and zero dependencies.

STRUCTURE
- 4 named steps in a single <form>:
  1. Basics — text input "Project name" (required, 3–60 chars) + optional textarea "Description" (max 240 chars)
  2. Team — radiogroup with 4 cards (Solo / Small / Medium / Enterprise), exactly one required
  3. Stack — checkbox chips with 8–10 options (React, Vue, Svelte, Next.js, Astro, Node, Python, Go, Rust, Postgres), at least one required
  4. Review — read-only summary of all entries with an "Edit" link per row that jumps back to that step
- After successful submit, replace the form body with a success panel ("Project created" + restart button)

STEPPER UI
- Horizontal row of numbered dots above the form, one per step
- States per dot: pending (muted outline), active (cyan glow + ring), complete (filled emerald with check icon)
- Connectors between dots fill from left to right with a green→cyan gradient as the user advances
- Animated 2px progress bar across the top of the form, width = (currentStep / totalSteps) * 100%
- Dots for completed steps are clickable to jump back; pending dots are not clickable

VALIDATION
- Validate per-step on Next click — never validate forward (don't validate fields the user hasn't reached)
- Show error text below each invalid field via aria-live="polite" regions
- Disable the Next button while the current step is invalid (validate on input/change, debounce text inputs at 100ms)
- On Enter key inside a text input, advance to next step if step is valid
- Trim whitespace before validating text fields

PERSISTENCE
- Save the entire form state to sessionStorage under key "wizard-state" on every change
- Save the current step index too
- On page load, hydrate the form and jump to the saved step
- Wipe storage after successful submit

ANIMATIONS
- Step transitions slide horizontally (right→left for Next, left→right for Back) with a 0.3s cubic-bezier easing
- Step dots animate state changes (scale pop on complete, glow on active)
- All animations honor prefers-reduced-motion: reduce — fall back to opacity fades

ACCESSIBILITY
- Each step panel is a <section role="group" aria-labelledby="…"> with a heading
- Active step dot has aria-current="step"
- Radiogroup uses role="radiogroup" with arrow-key navigation and Space to select
- Checkbox chips use real <input type="checkbox"> — Space toggles
- Visible focus rings (2px cyan outline, offset 2px) on every interactive element
- Required fields marked with <span aria-hidden="true">*</span> plus a real "required" attribute
- Success panel announced via role="status" aria-live="polite"

VISUAL DESIGN
- Dark theme: form bg #131316, body bg #0a0a0a, 1px white/8% border, 14px border-radius, 12px shadow
- Inputs: rgba(255,255,255,0.04) background, 1px white/10% border, cyan focus ring
- Primary buttons (Next, Submit): cyan gradient (#00d4ff → #00a4d8) with dark text and a soft glow shadow
- Secondary button (Back): transparent with subtle outline
- Card max-width 580px, footer pinned at the bottom with a top border

OUTPUT
- Should work as a drop-in inside any container, mobile-friendly down to 320px wide
- Production-grade aesthetic — should feel like a polished SaaS onboarding flow
  1. CopyThe full prompt, one click.
  2. PasteInto Cursor, Claude Code, or any agent.
  3. CompareAgainst the live demo above.
Multi-Step Form Wizard
Copied to clipboard