# Onboarding illustration

> Compact 4-step first-run onboarding card switching across Workspace, Files, Team and Ready scenes with Back, Next and Skip.

- Kind: block · Category: Auth · Interactivity: script
- Install: `npx shadcn@latest add @haze/onboarding-illustration`
- File: `src/components/haze/blocks/onboarding-illustration.astro`
- npm dependencies: @lucide/astro
- Registry dependencies: @haze/utils
- Docs page: https://hazeui.com/blocks/onboarding-illustration

## Use when
- Welcoming new signups with a focused 4-step feature orientation before entering the app
- Offering a lightweight, skippable walkthrough card with visual step indicators

## Avoid when
- Collecting structured user preferences or profile choices; use onboarding-survey or multi-step-form

## Alternatives
- [onboarding-checklist](https://hazeui.com/ui/onboarding-checklist.md)
- [stepper](https://hazeui.com/ui/stepper.md)

## Props

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| id | `string` | "haze-onboarding-illustration" | no | Unique prefix for section heading IDs. |
| class | `string` |  | no | Extra classes on the outer section. |

## Accessibility
- Decorative progress dots are hidden from screen readers while step transitions announce via role="status".
- Back is disabled on step 1, and Skip remains reachable at every step.
- Key Tab: Move across Skip, Back and Next/Get started buttons
- Key Enter / Space: Advance, go back or skip the onboarding tour

## Agent prompts

### Install and use

Install the Haze UI block "Onboarding illustration" with `npx shadcn@latest add @haze/onboarding-illustration`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "https://hazeui.com/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 OnboardingIllustration from "@/components/haze/blocks/onboarding-illustration.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: https://hazeui.com/blocks/onboarding-illustration.md

### Customize with real content

Adapt the Haze onboarding-illustration block for our product. Replace the demo values of these props with our real content: id, class. Keep the layout, the heading level rules and these accessibility details: Decorative progress dots are hidden from screen readers while step transitions announce via role="status". Back is disabled on step 1, and Skip remains reachable at every step. Do not add raw color classes; use the Haze tokens.

### Choose the right block

Before using onboarding-illustration, check it fits: use it when welcoming new signups with a focused 4-step feature orientation before entering the app; offering a lightweight, skippable walkthrough card with visual step indicators. Avoid it when collecting structured user preferences or profile choices; use onboarding-survey or multi-step-form. Alternatives: @haze/onboarding-checklist, @haze/stepper.

## Example requests that should lead here
- Create a 4-step first-run onboarding card with scene icons, progress dots and Back, Next and Skip controls

## Source

```astro
---
import { ArrowLeft, ArrowRight, Award, FolderOpen, Layers, Users } from "@lucide/astro";
import { cn } from "../../../lib/haze/utils";

interface Props {
  id?: string;
  class?: string;
}

const { id = "haze-onboarding-illustration", class: className } = Astro.props;

const scenes = [
  { id: "workspace", title: "Organize your workspace", body: "Group components, docs and design tokens into one shared home your whole team can browse." },
  { id: "files", title: "Drop files directly in", body: "Attach specs, tokens and reference screenshots without leaving your workflow." },
  { id: "team", title: "Invite collaborators", body: "Assign reviewers, share live previews and keep feedback tied to the exact component." },
  { id: "ready", title: "Ready to ship", body: "Your workspace is configured with dark tokens, keyboard shortcuts and agent-ready docs." },
] as const;
---

<section aria-labelledby={`${id}-title`} data-haze-onb-illus class={cn("bg-background px-4 py-10 sm:px-6 sm:py-14", className)}>
  <div class="mx-auto max-w-md overflow-hidden rounded-2xl border border-border bg-card shadow-float">
    <div class="flex h-44 items-center justify-center border-b border-border bg-muted/40 p-6">
      {
        scenes.map((s, i) => (
          <div data-oi-scene={String(i)} hidden={i !== 0} class="flex flex-col items-center gap-3">
            <span class="grid size-16 place-items-center rounded-2xl border border-frame bg-muted text-muted-foreground shadow-key" aria-hidden="true">
              {s.id === "workspace" ? <Layers class="size-7" /> : s.id === "files" ? <FolderOpen class="size-7" /> : s.id === "team" ? <Users class="size-7" /> : <Award class="size-7" />}
            </span>
            <span class="font-mono text-[0.6875rem] tracking-wider text-muted-foreground uppercase">Step {i + 1} of {scenes.length}</span>
          </div>
        ))
      }
    </div>

    <div class="p-6 text-center">
      <h2 id={`${id}-title`} data-oi-title class="text-lg/7 font-semibold tracking-tight text-foreground">{scenes[0].title}</h2>
      <p data-oi-body class="mt-2 min-h-12 text-xs/5 text-pretty text-muted-foreground">{scenes[0].body}</p>

      <div class="mt-5 flex items-center justify-center gap-1.5" aria-hidden="true">
        {
          scenes.map((_, i) => (
            <span data-oi-dot={String(i)} class={cn("h-1.5 rounded-full transition-[width,background-color] duration-200 ease-snappy", i === 0 ? "w-6 bg-primary" : "w-1.5 bg-muted")}></span>
          ))
        }
      </div>

      <div class="mt-6 flex items-center justify-between gap-2 border-t border-border pt-4">
        <button type="button" data-oi-skip class="inline-flex h-8 cursor-pointer items-center rounded-lg px-2.5 text-xs font-medium text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring transition-[background-color,border-color,color,opacity,scale] duration-150 ease-snappy active:scale-[0.97] active:duration-75">Skip</button>
        <div class="flex items-center gap-2">
          <button type="button" data-oi-prev disabled class="inline-flex h-8 cursor-pointer items-center gap-1 rounded-lg border border-frame bg-field px-2.5 text-xs font-medium text-foreground hover:bg-accent disabled:cursor-not-allowed disabled:opacity-45 focus-visible:outline-2 focus-visible:outline-ring transition-[background-color,border-color,color,opacity,scale] duration-150 ease-snappy active:scale-[0.97] active:duration-75">
            <ArrowLeft class="size-3.5" aria-hidden="true" />
            Back
          </button>
          <button type="button" data-oi-next class="inline-flex h-8 cursor-pointer items-center gap-1 rounded-lg bg-primary px-3 text-xs font-medium text-primary-foreground hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring transition-[background-color,border-color,color,opacity,scale] duration-150 ease-snappy active:scale-[0.97] active:duration-75">
            <span data-oi-next-label>Next</span>
            <ArrowRight class="size-3.5" aria-hidden="true" />
          </button>
        </div>
      </div>

      <p data-oi-status role="status" class="mt-3 min-h-4 text-xs/4 text-muted-foreground"></p>
    </div>
  </div>
</section>

<script>
  function initOnbIllus() {
    const copy = [
      { title: "Organize your workspace", body: "Group components, docs and design tokens into one shared home your whole team can browse." },
      { title: "Drop files directly in", body: "Attach specs, tokens and reference screenshots without leaving your workflow." },
      { title: "Invite collaborators", body: "Assign reviewers, share live previews and keep feedback tied to the exact component." },
      { title: "Ready to ship", body: "Your workspace is configured with dark tokens, keyboard shortcuts and agent-ready docs." },
    ];
    document.querySelectorAll<HTMLElement>("[data-haze-onb-illus]").forEach((root) => {
      if (root.hasAttribute("data-enhanced")) return;
      root.setAttribute("data-enhanced", "");
      const title = root.querySelector<HTMLElement>("[data-oi-title]");
      const body = root.querySelector<HTMLElement>("[data-oi-body]");
      const prev = root.querySelector<HTMLButtonElement>("[data-oi-prev]");
      const next = root.querySelector<HTMLButtonElement>("[data-oi-next]");
      const nextLabel = root.querySelector<HTMLElement>("[data-oi-next-label]");
      const status = root.querySelector<HTMLElement>("[data-oi-status]");
      let step = 0;

      const render = (msg?: string) => {
        root.querySelectorAll<HTMLElement>("[data-oi-scene]").forEach((el, i) => (el.hidden = i !== step));
        root.querySelectorAll<HTMLElement>("[data-oi-dot]").forEach((dot, i) => {
          dot.className = i === step ? "h-1.5 w-6 rounded-full bg-primary transition-[width,background-color] duration-200 ease-snappy" : "h-1.5 w-1.5 rounded-full bg-muted transition-[width,background-color] duration-200 ease-snappy";
        });
        if (title) title.textContent = copy[step].title;
        if (body) body.textContent = copy[step].body;
        if (prev) prev.disabled = step === 0;
        if (nextLabel) nextLabel.textContent = step === copy.length - 1 ? "Get started" : "Next";
        if (status) status.textContent = msg ?? `Step ${step + 1} of ${copy.length}: ${copy[step].title}`;
      };

      prev?.addEventListener("click", () => { if (step > 0) { step--; render(); } });
      next?.addEventListener("click", () => {
        if (step < copy.length - 1) { step++; render(); }
        else render("Onboarding complete.");
      });
      root.querySelector<HTMLButtonElement>("[data-oi-skip]")?.addEventListener("click", () => render("Skipped onboarding tour."));
    });
  }
  initOnbIllus();
  document.addEventListener("astro:page-load", initOnbIllus);
</script>
```
