AI setup wizard
Three-step onboarding card for launching workspace AI Q&A: connect sources, configure guardrails and verify a cited test answer.
pnpm dlx shadcn@latest add @haze/ai-setup-wizard---
import { ArrowLeft, ArrowRight, Check, Database, Rocket, Sliders, Sparkles } from "@lucide/astro";
import { cn } from "../../../lib/haze/utils";
interface Props {
id?: string;
title?: string;
class?: string;
}
const {
id = "haze-ai-setup-wizard",
title = "Launch workspace AI Q&A",
class: className,
} = Astro.props;
const connectors = [
{ id: "notion", name: "Notion", detail: "1,240 pages synced", connected: true },
{ id: "drive", name: "Google Drive", detail: "380 docs synced", connected: true },
{ id: "confluence", name: "Confluence", detail: "Ready to connect", connected: false },
{ id: "zendesk", name: "Zendesk", detail: "Ready to connect", connected: false },
];
---
<section aria-labelledby={`${id}-title`} data-haze-ai-wizard class={cn("bg-background px-4 py-10 sm:px-6 sm:py-14", className)}>
<div class="mx-auto max-w-3xl rounded-2xl border border-border bg-card p-5 sm:p-7">
<header class="flex flex-wrap items-center justify-between gap-3 border-b border-border pb-4">
<div>
<h2 id={`${id}-title`} class="text-lg/7 font-semibold tracking-tight text-foreground">{title}</h2>
<p class="text-xs/5 text-muted-foreground">Connect knowledge, set guardrails, and test a live cited answer.</p>
</div>
<ol role="list" class="flex items-center gap-1.5 text-xs font-medium">
{
[
[0, "1. Sources"],
[1, "2. Guardrails"],
[2, "3. Test"],
].map(([idx, label]) => (
<li>
<button
type="button"
data-wiz-tab={String(idx)}
aria-current={idx === 0 ? "step" : undefined}
class="inline-flex h-7 cursor-pointer items-center rounded-md border border-frame bg-field px-2.5 text-muted-foreground transition-colors duration-150 hover:text-foreground aria-[current=step]:border-foreground aria-[current=step]:bg-accent aria-[current=step]:text-foreground focus-visible:outline-2 focus-visible:outline-ring active:scale-[0.97] active:duration-75"
>
{label}
</button>
</li>
))
}
</ol>
</header>
<div data-wiz-pane="0" class="mt-5 space-y-3">
<p class="inline-flex items-center gap-1.5 text-xs font-medium text-foreground">
<Database class="size-3.5 text-muted-foreground" aria-hidden="true" />
Workspace sources
</p>
<div class="grid gap-2.5 sm:grid-cols-2">
{
connectors.map((c) => (
<label class="flex cursor-pointer items-center justify-between gap-3 rounded-xl border border-border bg-muted/40 p-3.5 transition-colors duration-150 hover:border-border-strong">
<span>
<span class="block text-sm/5 font-medium text-foreground">{c.name}</span>
<span class="block text-xs/4 text-muted-foreground">{c.detail}</span>
</span>
<span class="relative inline-grid size-4 shrink-0 place-items-center"><input type="checkbox" checked={c.connected} class="peer col-start-1 row-start-1 shrink-0 focus-visible:outline-2 focus-visible:outline-ring size-4 shrink-0 cursor-pointer appearance-none rounded-sm border border-border-strong bg-field transition-[background-color,border-color,scale] duration-150 ease-snappy hover:border-foreground active:scale-90 checked:border-primary checked:bg-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring forced-colors:appearance-auto" /><Check class="pointer-events-none col-start-1 row-start-1 size-3 scale-50 text-primary-foreground opacity-0 transition-[opacity,scale] duration-200 ease-spring peer-checked:scale-100 peer-checked:opacity-100 forced-colors:hidden" stroke-width={3} aria-hidden="true" /></span>
</label>
))
}
</div>
</div>
<div data-wiz-pane="1" hidden class="mt-5 space-y-4">
<p class="inline-flex items-center gap-1.5 text-xs font-medium text-foreground">
<Sliders class="size-3.5 text-muted-foreground" aria-hidden="true" />
Model, tone and guardrails
</p>
<div class="grid gap-3 sm:grid-cols-2">
<div class="grid gap-1.5">
<label for={`${id}-model`} class="text-xs font-medium text-muted-foreground">Default model</label>
<select id={`${id}-model`} class="h-9 rounded-lg border border-frame-input bg-field px-2.5 text-xs text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/24 focus-visible:outline-hidden transition-[color,background-color,border-color,box-shadow] duration-150 hover:border-frame-foreground">
<option>Sonnet 4.5 (Recommended)</option>
<option>Gemini 3.8 Pro</option>
<option>GPT-5 Mini</option>
</select>
</div>
<div class="grid gap-1.5">
<label for={`${id}-tone`} class="text-xs font-medium text-muted-foreground">Response tone</label>
<select id={`${id}-tone`} class="h-9 rounded-lg border border-frame-input bg-field px-2.5 text-xs text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/24 focus-visible:outline-hidden transition-[color,background-color,border-color,box-shadow] duration-150 hover:border-frame-foreground">
<option>Concise & cited</option>
<option>Friendly support</option>
<option>Technical reference</option>
</select>
</div>
</div>
<label class="flex cursor-pointer items-center gap-2.5 rounded-xl border border-border bg-muted/40 px-3.5 py-2.5 text-xs text-foreground">
<span class="relative inline-grid size-4 shrink-0 place-items-center"><input type="checkbox" checked class="peer col-start-1 row-start-1 size-4 shrink-0 cursor-pointer appearance-none rounded-sm border border-border-strong bg-field transition-[background-color,border-color,scale] duration-150 ease-snappy hover:border-foreground active:scale-90 checked:border-primary checked:bg-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring forced-colors:appearance-auto" /><Check class="pointer-events-none col-start-1 row-start-1 size-3 scale-50 text-primary-foreground opacity-0 transition-[opacity,scale] duration-200 ease-spring peer-checked:scale-100 peer-checked:opacity-100 forced-colors:hidden" stroke-width={3} aria-hidden="true" /></span>
Abstain when no indexed source reaches 0.75 confidence
</label>
</div>
<div data-wiz-pane="2" hidden class="mt-5 space-y-3">
<p class="inline-flex items-center gap-1.5 text-xs font-medium text-foreground">
<Sparkles class="size-3.5 text-muted-foreground" aria-hidden="true" />
Live cited answer check
</p>
<div class="rounded-xl border border-border bg-muted/40 p-4 text-sm/6 text-foreground">
<p class="text-xs font-medium text-muted-foreground">Test query: "What is our SLA for Enterprise support?"</p>
<p class="mt-2 text-pretty">Enterprise plans include a 1-hour initial response SLA for Sev-1 incidents and 24/7 escalation via Slack Connect <span class="rounded-sm bg-muted px-1.5 py-0.5 font-mono text-[0.6875rem] text-foreground">[Notion · SLA Policy]</span>.</p>
</div>
</div>
<footer class="mt-6 flex flex-wrap items-center justify-between gap-3 border-t border-border pt-4">
<p data-wiz-status role="status" class="text-xs/5 text-muted-foreground">Step 1 of 3 · Select sources</p>
<div class="flex items-center gap-2">
<button type="button" data-wiz-prev disabled class="inline-flex h-9 cursor-pointer items-center gap-1.5 rounded-lg border border-frame bg-field px-3 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-wiz-next class="inline-flex h-9 cursor-pointer items-center gap-1.5 rounded-lg bg-primary px-3.5 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-wiz-next-label>Continue</span>
<ArrowRight class="size-3.5" aria-hidden="true" />
</button>
</div>
</footer>
</div>
</section>
<script>
function initSetupWizards() {
document.querySelectorAll<HTMLElement>("[data-haze-ai-wizard]").forEach((root) => {
if (root.hasAttribute("data-enhanced")) return;
root.setAttribute("data-enhanced", "");
const panes = Array.from(root.querySelectorAll<HTMLElement>("[data-wiz-pane]"));
const tabs = Array.from(root.querySelectorAll<HTMLButtonElement>("[data-wiz-tab]"));
const prev = root.querySelector<HTMLButtonElement>("[data-wiz-prev]");
const next = root.querySelector<HTMLButtonElement>("[data-wiz-next]");
const nextLabel = root.querySelector<HTMLElement>("[data-wiz-next-label]");
const status = root.querySelector<HTMLElement>("[data-wiz-status]");
const labels = ["Select sources", "Configure guardrails", "Verify live answer"];
let step = 0;
const render = (announced?: string) => {
panes.forEach((p, i) => (p.hidden = i !== step));
tabs.forEach((t, i) => (i === step ? t.setAttribute("aria-current", "step") : t.removeAttribute("aria-current")));
if (prev) prev.disabled = step === 0;
if (nextLabel) nextLabel.textContent = step === 2 ? "Publish Q&A" : "Continue";
if (status) status.textContent = announced ?? `Step ${step + 1} of 3 · ${labels[step]}`;
};
tabs.forEach((t) => t.addEventListener("click", () => { step = Number(t.dataset.wizTab); render(); }));
prev?.addEventListener("click", () => { if (step > 0) { step--; render(); } });
next?.addEventListener("click", () => {
if (step < 2) { step++; render(); }
else render("Workspace AI Q&A published and live.");
});
});
}
initSetupWizards();
document.addEventListener("astro:page-load", initSetupWizards);
</script>When to use
- Guiding workspace admins through connecting knowledge sources and setting confidence guardrails
- Letting teams test a live cited answer before publishing an AI feature
When not to use
- You only need a single-step feature announcement banner; use ai-feature-launch
Installation
Add the Haze registry to components.json once, then install AI setup wizard with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.
pnpm dlx shadcn@latest add @haze/ai-setup-wizardnpx shadcn@latest add @haze/ai-setup-wizardyarn dlx shadcn@latest add @haze/ai-setup-wizardbunx --bun shadcn@latest add @haze/ai-setup-wizardFirst 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
| Prop | Type | Default | Description |
|---|---|---|---|
| id | string | "haze-ai-setup-wizard" | Unique prefix for form labels and heading IDs. |
| title | string | "Launch workspace AI Q&A" | Wizard heading. |
| class | string | – | Extra classes on the outer section. |
Keyboard interactions
- Tab
- Move across step tabs, step form controls, Back and Continue buttons
- EnterSpace
- Jump to a step, toggle connectors or publish the Q&A assistant
Accessibility
- Step buttons mark the active stage with aria-current="step" and announce transitions in a polite role="status" footer.
- Every connector toggle, model selector and guardrail checkbox uses a native form control with an explicit label.
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 block "AI setup wizard" with `npx shadcn@latest add @haze/ai-setup-wizard`. 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 AiSetupWizard from "@/components/haze/blocks/ai-setup-wizard.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/blocks/ai-setup-wizard.md
Customize with real content
Adapt the Haze ai-setup-wizard block for our product. Replace the demo values of these props with our real content: id, title, class. Keep the layout, the heading level rules and these accessibility details: Step buttons mark the active stage with aria-current="step" and announce transitions in a polite role="status" footer. Every connector toggle, model selector and guardrail checkbox uses a native form control with an explicit label. Do not add raw color classes; use the Haze tokens.
Choose the right block
Before using ai-setup-wizard, check it fits: use it when guiding workspace admins through connecting knowledge sources and setting confidence guardrails; letting teams test a live cited answer before publishing an ai feature. Avoid it when you only need a single-step feature announcement banner; use ai-feature-launch. Alternatives: @haze/stepper, @haze/ai-feature-launch.
Dependencies
- npm: @lucide/astro
- @haze/utils
- @haze/theme (one-time setup)
Source · Original Haze UI work.