# AI feature launch

> In-product AI feature launch card with interactive 3-step tour preview, benefit checklist, admin enable switch and CTAs.

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

## Use when
- Introducing a new AI capability inside an existing SaaS workspace with clear admin opt-in
- Showing a compact interactive three-step walkthrough alongside privacy guarantees

## Avoid when
- Running a full multi-page setup wizard with source syncing; use ai-setup-wizard

## Alternatives
- [banner-release-notice](https://hazeui.com/blocks/banner-release-notice.md)
- [cta-split-benefits](https://hazeui.com/blocks/cta-split-benefits.md)

## Props

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| id | `string` | "haze-ai-feature-launch" | no | Unique prefix for section heading IDs. |
| badge | `string` | "New in Haze" | no | Pill badge above the interactive tour. |
| title | `string` | "Meet AI Triage for incoming issues" | no | Announcement headline. |
| description | `string` | Feature summary | no | Short explanation under the title. |
| steps | `{ label: string; caption: string; preview: string }[]` | 3 tour steps | no | Interactive tour steps displayed at the top. |
| benefits | `string[]` | 3 privacy and control bullets | no | Checklist shown above the workspace toggle. |
| class | `string` |  | no | Extra classes on the outer section. |

## Accessibility
- Tour steps use role="tab" buttons with aria-selected, and the workspace opt-in is a native checkbox with visible admin note.
- Toggle and Try-it-now actions update a polite role="status" message.
- Key Tab: Move across tour step tabs, enable checkbox, Learn more link and Try it now button
- Key Enter / Space: Switch tour steps, toggle workspace enablement or launch the sandbox

## Agent prompts

### Install and use

Install the Haze UI block "AI feature launch" with `npx shadcn@latest add @haze/ai-feature-launch`. 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 AiFeatureLaunch from "@/components/haze/blocks/ai-feature-launch.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/ai-feature-launch.md

### Customize with real content

Adapt the Haze ai-feature-launch block for our product. Replace the demo values of these props with our real content: id, badge, title, description, steps, benefits, class. Keep the layout, the heading level rules and these accessibility details: Tour steps use role="tab" buttons with aria-selected, and the workspace opt-in is a native checkbox with visible admin note. Toggle and Try-it-now actions update a polite role="status" message. Do not add raw color classes; use the Haze tokens.

### Choose the right block

Before using ai-feature-launch, check it fits: use it when introducing a new ai capability inside an existing saas workspace with clear admin opt-in; showing a compact interactive three-step walkthrough alongside privacy guarantees. Avoid it when running a full multi-page setup wizard with source syncing; use ai-setup-wizard. Alternatives: @haze/banner-release-notice, @haze/cta-split-benefits.

## Example requests that should lead here
- Add an in-product AI feature launch card with a three-step interactive preview and admin enable toggle

## Source

```astro
---
import { ArrowRight, Check, ShieldCheck, Sparkles } from "@lucide/astro";
import { cn } from "../../../lib/haze/utils";

interface TourStep {
  label: string;
  caption: string;
  preview: string;
}

interface Props {
  id?: string;
  badge?: string;
  title?: string;
  description?: string;
  steps?: TourStep[];
  benefits?: string[];
  class?: string;
}

const {
  id = "haze-ai-feature-launch",
  badge = "New in Haze",
  title = "Meet AI Triage for incoming issues",
  description = "Automatically label, deduplicate and route bug reports with full audit logs and workspace-level controls.",
  steps = [
    { label: "1. Detect duplicates", caption: "Matches new reports against open issues in 180 ms.", preview: "Matched issue 412 (94% similarity): Safari popover backdrop clip" },
    { label: "2. Suggest owner", caption: "Routes to the team owning the affected route or package.", preview: "Assigned to @core-ui · Priority: High · Area: Overlays" },
    { label: "3. Draft repro", caption: "Attaches a minimal reproduction checklist for the engineer.", preview: "Checklist ready: 3 steps verified from trace 9012" },
  ],
  benefits = [
    "Zero training on your private workspace data",
    "Instant per-project opt-out for workspace admins",
    "Every automated label can be reversed in one click",
  ],
  class: className,
} = Astro.props;
const firstStep = steps[0];
---

<section aria-labelledby={`${id}-title`} data-haze-ai-launch class={cn("bg-background px-4 py-10 sm:px-6 sm:py-14", className)}>
  <div class="mx-auto max-w-2xl overflow-hidden rounded-2xl border border-border bg-card shadow-float">
    <div class="border-b border-border bg-muted/40 p-5 sm:p-6">
      <div class="flex flex-wrap items-center justify-between gap-2">
        <span class="inline-flex items-center gap-1.5 rounded-full border border-frame bg-muted px-2.5 py-0.5 text-xs font-medium text-foreground">
          <Sparkles class="size-3.5" aria-hidden="true" />
          {badge}
        </span>
        <div role="tablist" aria-label="Feature tour steps" hidden={!firstStep} class="flex gap-1">
          {
            steps.map((s, idx) => (
              <button
                type="button"
                role="tab"
                data-fl-step={String(idx)}
                data-fl-caption={s.caption}
                data-fl-preview={s.preview}
                aria-selected={idx === 0 ? "true" : "false"}
                class="inline-flex h-7 cursor-pointer items-center rounded-md border border-frame bg-field px-2.5 text-xs font-medium text-muted-foreground transition-colors duration-150 hover:text-foreground aria-selected:border-foreground aria-selected:bg-accent aria-selected:text-foreground focus-visible:outline-2 focus-visible:outline-ring"
              >
                {s.label}
              </button>
            ))
          }
        </div>
      </div>

      <div class="mt-4 rounded-xl border border-border bg-card p-4">
        <p data-fl-preview-box class="font-mono text-xs/5 text-foreground">{firstStep?.preview ?? "No tour steps are available."}</p>
        <p data-fl-caption-box hidden={!firstStep} class="mt-1.5 text-xs/5 text-muted-foreground">{firstStep?.caption}</p>
      </div>
    </div>

    <div class="p-5 sm:p-6">
      <h2 id={`${id}-title`} class="text-xl/7 font-semibold tracking-tight text-foreground">{title}</h2>
      <p class="mt-1.5 text-sm/6 text-pretty text-muted-foreground">{description}</p>

      <ul role="list" class="mt-4 space-y-2 text-xs/5 text-muted-foreground">
        {
          benefits.map((b) => (
            <li class="flex items-start gap-2">
              <Check class="mt-0.5 size-4 shrink-0 text-success" aria-hidden="true" />
              <span>{b}</span>
            </li>
          ))
        }
      </ul>

      <label class="mt-5 flex cursor-pointer items-center justify-between gap-3 rounded-xl border border-border bg-muted/40 px-4 py-3">
        <span class="flex items-center gap-2.5">
          <ShieldCheck class="size-4 shrink-0 text-muted-foreground" aria-hidden="true" />
          <span>
            <span class="block text-xs/5 font-medium text-foreground">Enable for my workspace</span>
            <span class="block text-[0.6875rem]/4 text-muted-foreground">Workspace admin permission required</span>
          </span>
        </span>
        <span class="relative inline-grid size-4 shrink-0 place-items-center"><input type="checkbox" data-fl-enable 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 class="mt-5 flex flex-wrap items-center justify-between gap-3">
        <p data-fl-status role="status" class="text-xs/5 text-muted-foreground">Preview mode · Not yet enabled</p>
        <div class="flex items-center gap-2">
          <a href="#learn-more" class="inline-flex h-9 items-center rounded-lg border border-frame bg-muted/40 px-3.5 text-xs font-medium text-foreground hover:border-frame-strong hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring">Learn more</a>
          <button type="button" data-fl-try 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">
            Try it now
            <ArrowRight class="size-3.5" aria-hidden="true" />
          </button>
        </div>
      </div>
    </div>
  </div>
</section>

<script>
  function initFeatureLaunches() {
    document.querySelectorAll<HTMLElement>("[data-haze-ai-launch]").forEach((root) => {
      if (root.hasAttribute("data-enhanced")) return;
      root.setAttribute("data-enhanced", "");
      const preview = root.querySelector<HTMLElement>("[data-fl-preview-box]");
      const caption = root.querySelector<HTMLElement>("[data-fl-caption-box]");
      const status = root.querySelector<HTMLElement>("[data-fl-status]");
      const enable = root.querySelector<HTMLInputElement>("[data-fl-enable]");

      root.querySelectorAll<HTMLButtonElement>("[data-fl-step]").forEach((tab) => {
        tab.addEventListener("click", () => {
          root.querySelectorAll<HTMLButtonElement>("[data-fl-step]").forEach((t) => t.setAttribute("aria-selected", String(t === tab)));
          if (preview) preview.textContent = tab.dataset.flPreview ?? "";
          if (caption) caption.textContent = tab.dataset.flCaption ?? "";
        });
      });

      enable?.addEventListener("change", () => {
        if (status) status.textContent = enable.checked ? "Enabled for all workspace projects." : "Preview mode · Not yet enabled";
      });

      root.querySelector<HTMLButtonElement>("[data-fl-try]")?.addEventListener("click", () => {
        if (status) status.textContent = "Opened interactive sandbox with sample issues.";
      });
    });
  }
  initFeatureLaunches();
  document.addEventListener("astro:page-load", initFeatureLaunches);
</script>
```
