# Onboarding (Notchset): prompt.md (v1.0.0)

- id: `onboarding` · version 1.0.0 · block · pro (Pro)
- category: Application UI
- build: Base UI (one set of files; its dependencies follow the build)
- install (this build): `npx shadcn@latest add @beautiful-ui-pro/onboarding`
- npm dependencies: class-variance-authority@^0.7
- registry dependencies: utils, @beautiful-ui/segmented-control, @beautiful-ui-pro/token-field, https://beautiful-ui.dev/r/notchset-foundation.json
- docs: https://beautiful-ui.dev/components/onboarding
- The install command carries everything this item needs (files, CSS, tokens, npm and registry dependencies). Prefer it to copying source by hand.

A four-step setup for a workspace, a first agent and a team: a step rail that traces as you advance, a URL that follows the name with a live availability check and an alternative when taken, region cards, template rows, invites as tokens, a review with EDIT on every row, a draft that saves itself, and creation tasks that run in sequence only after you confirm.

## Build it
- Stack: React 19 (`ref` is a plain prop), TypeScript, Tailwind CSS v4 utilities, a shadcn-initialised project with the `@/*` alias.
- Packages: `class-variance-authority@^0.7`.
- Files: `components/ui/notchset/blocks/onboarding.tsx`; shared code: `lib/beautiful-ui/notchset/instrument.tsx`, `lib/beautiful-ui/notchset/root.ts`, `lib/beautiful-ui/notchset/button-variants.ts`, `lib/beautiful-ui/notchset/field-classes.ts`.
- Registry dependencies, installed with it automatically: shadcn `utils` (cn), `segmented-control`, `token-field`, `notchset-foundation`.
- Builds: one set of files for both, but its dependencies come in Base UI and Radix builds. Install the one that matches the project (see Install): a free item's bare URL installs the Base UI build of it and its dependencies.
- Exports to keep: `Onboarding`, and every exported type.
- CSS: the install adds the notchset foundation (tokens, keyframes, motion levels) to your global stylesheet once. Nothing to import by hand.
- Re-running `add` (or `--overwrite`) re-applies those rules: put overrides in your own CSS, never in the installed rules.
- Tokens: retheme with the `--notchset-*` custom properties (`--notchset-check`, `--notchset-control-edge`, `--notchset-draw-from`, `--notchset-ease-bloom`, `--notchset-ease-glide`, `--notchset-ease-key-down`, `--notchset-ease-key-up`, `--notchset-ease-travel`, `--notchset-fade`, `--notchset-focus-color`, `--notchset-focus-inset`, `--notchset-grow-to`, `--notchset-key-down`, `--notchset-key-up`, `--notchset-life-from`, `--notchset-life-ms`, `--notchset-node-blink`, `--notchset-node-bloom`, `--notchset-node-delay`, `--notchset-plate-color`, `--notchset-rise-from`, `--notchset-rule`, `--notchset-scan-to`, `--notchset-scroll`, `--notchset-signal`, `--notchset-sweep-to`, `--notchset-travel`). Never add Tailwind colour classes inside the component.

```tsx
import { Onboarding } from "@/components/ui/notchset/blocks/onboarding";
```

## Parts

| Part | data-slot | What it is for |
|---|---|---|
| `Onboarding` | `onboarding` | Rail, steps, review, creation and done. |

Style a part with `[data-slot="<slot>"]` selectors or its `className`; keep the attributes when editing.

## Sound
- Keep every `data-slot` and `data-sound` attribute: the sound layer reads them.
- Installing this item adds no audio. Nothing plays until the app mounts `SoundProvider` once (install: `npx shadcn@latest add https://beautiful-ui.dev/r/notchset-sound.json`, import from `@/components/ui/notchset/sound-provider`); `useSound()` gives `muted` and `setMuted` for a mute control. Without a provider the audio engine never loads.

## Match the original
- Read `components/ui/notchset/blocks/onboarding.tsx` as the reference implementation before changing or recreating anything, and match it: sizes, colours per theme, motion timings, copy and behaviour.
- If you deviate (a prop you can't honour, a style you changed, a dependency you swapped), say so in your reply, part by part.
- Keep the accessibility contract, the keyboard map and the motion levels listed below.

## Use it when
- onboarding, setup wizard, create workspace, first run, signup flow, multi-step form, stepper form, invite team, Notchset
- The first minutes after sign-up: workspace, first project, team
- Any setup where nothing should exist until the person confirms

### Not when
- One or two fields: a single form is faster
- Settings people change later: use a settings page

## Mistakes
- Check the slug again on the server when creating: the live check is only a hint
- Create nothing before the review step

## Usage

```tsx
import { Onboarding } from "@/components/ui/notchset/blocks/onboarding";

export function Setup() {
  return (
    <Onboarding
      title="SET UP RELAY"
      regions={[{ value: "us", label: "US · VIRGINIA", detail: "Lowest latency in the Americas" }]}
      templates={[{ id: "support", name: "Support planner", description: "Answers tickets from your docs.", tools: ["search_docs", "send_email"] }]}
      models={[{ value: "flash", label: "FLASH", note: "$0.0007 A RUN" }]}
      checkSlug={async (slug) => (await fetch(`/api/slugs/${slug}`)).ok || `${slug}-labs`}
      tasks={[{ label: "Creating the workspace", run: (draft) => fetch("/api/workspaces", { method: "POST", body: JSON.stringify(draft) }) }]}
      done={{ command: (d) => `relay login --workspace ${d.slug}`, action: { label: "OPEN DASHBOARD", href: "/" } }}
    />
  );
}
```

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `checkSlug` | `(slug) => Promise<true \| string>` |  | Resolve true when free, or a suggestion when taken. |
| `tasks` | `{ label, run(draft) => Promise }[]` |  | What CREATE WORKSPACE runs, in order; a rejection stops there with RETRY. |
| `onSaveDraft / initialDraft` | `(draft) => Promise / Partial<OnboardingDraft>` |  | Autosave (700ms after a change) and restore. |
| `regions / templates / models / roles` | `options` |  | The choices on each step. |
| `done` | `{ command(draft), action }` |  | The CLI line to copy and the next action. |

Full docs: https://beautiful-ui.dev/components/onboarding

## Customising
- Colours: the component reads your shadcn tokens (`--background`, `--foreground`, `--border` …), refined by the `--notchset-*` tokens. The signal colour is `--notchset-signal` (it falls back to `--destructive`). Set tokens on `:root`, or on any container to retheme one area.
- Dark mode follows the `.dark` class on an ancestor (the shadcn and next-themes convention).
- Update later by re-running the install with `--overwrite` (review the diff if you edited it). Changelog: https://beautiful-ui.dev/r/changelog.json

## Keyboard

| Keys | Action |
|---|---|
| Enter | Continue (create on the review step) |
| Tab | Fields, choices, BACK, SKIP and CONTINUE |

## Performance

- The slug check waits 450ms after typing and only the newest answer counts; autosave waits 700ms.

## Responsive

- Region cards stack under 480px (container width); the rail keeps four columns down to 320px.

## Motion inventory

| Interaction | What moves |
|---|---|
| Advance | The rail's connector traces to the next node (520ms); completed nodes fill and their checks draw |
| Step change | Content slides 16px in from the direction of travel (300ms) |
| Slug check | The scanner while checking, then ✓ AVAILABLE or TAKEN |
| Create | Each task goes waiting → scanner → check |

## Accessibility contract (preserve when editing)
- The section is named by its title; the rail's steps are buttons with their names, the current one aria-current=step
- Region, template and the review rows are radio groups and labelled controls; messages are announced (aria-live)
- Creation progress is announced as each task finishes

## Install

```bash
npx shadcn@latest add @beautiful-ui-pro/onboarding
```

Pro item: needs the `@beautiful-ui-pro` registry in `components.json` and `BEAUTIFUL_UI_TOKEN` in `.env.local` (https://beautiful-ui.dev/account). Setup: https://beautiful-ui.dev/docs/pro. Your components.json `style` picks the build: radix-*, new-york and default get Radix, base-* gets Base UI.

## Credits
- Built on shadcn/ui (https://ui.shadcn.com)

The notchset foundation (the tokens listed above, keyframes and motion levels) installs once with the first component; its CSS is public at https://beautiful-ui.dev/r/notchset-foundation.json.
