Onboarding checklist
A setup checklist that opens the next step.
Installation
Run the CLI
Run
pnpm dlx asta-ui@latest initonce, then this. The file lands incomponents/astabyte/, installsradix-ui@base-ui/reactand the colour tokens go into your CSS. This is the Radix build. Drop --radix for Base UI.This is the Base UI build, the default. Want Radix? Add --radix.$ pnpm dlx asta-ui@latest add onboarding --radixOr install the package
Don’t want the file? Import from
asta-uiasta-ui/baseand update withpnpm update asta-ui. Add the stylesheet once. More.$ pnpm add asta-ui radix-ui @base-ui/reactimport { Onboarding } from "asta-ui";import { Onboarding } from "asta-ui/base";Or copy it by hand
Install
radix-ui@base-ui/react, then copy these files. Keep the paths, or fix the@/imports. Then add the tokens fromglobals.css."use client"; import { useId, useRef, useState, type ReactNode } from "react"; import { Button } from "@/components/kit/button"; const cx = (...c: (string | false | null | undefined)[]) => c.filter(Boolean).join(" "); const EASE = "ease-[cubic-bezier(.16,1,.3,1)]"; const CURVE = "cubic-bezier(.16,1,.3,1)"; export interface OnboardingStep { id: string; title: string; description: ReactNode; /** Label of the button that completes the step. */ action?: string; /** Rough time, e.g. "2 min". */ duration?: string; } export interface OnboardingProps { title?: string; subtitle?: string; steps: OnboardingStep[]; defaultCompleted?: string[]; /** Runs when a step's button is pressed. Return a promise and the button shows progress until it resolves. */ onStep?: (id: string) => void | Promise<void>; /** The done state's button. Leave it out to hide the button. */ onFinish?: () => void; finishLabel?: string; className?: string; } const Check = ({ className = "" }: { className?: string }) => ( <svg viewBox="0 0 24 24" className={className} fill="none" stroke="currentColor" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round" aria-hidden> <path d="m5 12.5 4.5 4.5L19 7.5" /> </svg> ); function Mark({ done, current }: { done: boolean; current: boolean }) { return ( <span className="relative flex h-5 w-5 shrink-0 items-center justify-center" aria-hidden> <span className={cx( "absolute inset-0 rounded-full transition-[opacity,transform] duration-300", EASE, done ? "scale-75 opacity-0" : "scale-100 opacity-100", current ? "shadow-[inset_0_0_0_1.5px_var(--color-ink)]" : "shadow-[inset_0_0_0_1.5px_color-mix(in_srgb,var(--color-ink)_22%,transparent)]", )} /> <span className={cx( "absolute inset-0 flex items-center justify-center rounded-full bg-brand text-on-brand transition-[opacity,transform] duration-500", EASE, done ? "scale-100 opacity-100" : "scale-50 opacity-0", )} > <Check className="h-3 w-3" /> </span> </span> ); } /** * A setup checklist. One step is open at a time. Completing it ticks the mark, fills the bar and opens * the next step that is still to do. When everything is done the card turns into a short done state. */ export function Onboarding({ title = "Get set up", subtitle, steps, defaultCompleted = [], onStep, onFinish, finishLabel = "Go to dashboard", className }: OnboardingProps) { const [done, setDone] = useState<string[]>(defaultCompleted); // Latest done list, so completions that resolve together don't overwrite each other. const doneRef = useRef(done); const firstOpen = steps.find((s) => !defaultCompleted.includes(s.id))?.id ?? null; const [open, setOpen] = useState<string | null>(firstOpen); const [busy, setBusy] = useState<string | null>(null); const [review, setReview] = useState(false); const uid = useId(); const total = steps.length; const count = steps.filter((s) => done.includes(s.id)).length; const finished = count === total && !review; const complete = async (id: string) => { try { const r = onStep?.(id); if (r instanceof Promise) { setBusy(id); await r; } } catch (err) { // A failed step stays open and to do. The caller owns the error message. console.error(err); return; } finally { setBusy((b) => (b === id ? null : b)); } const next = doneRef.current.includes(id) ? doneRef.current : [...doneRef.current, id]; doneRef.current = next; setDone((d) => (d.includes(id) ? d : [...d, id])); // Open the next step still to do, looking forward first, then from the top. const i = steps.findIndex((s) => s.id === id); const after = [...steps.slice(i + 1), ...steps.slice(0, i)].find((s) => !next.includes(s.id)); setOpen(after?.id ?? null); }; return ( <div className={cx( "kit-ob relative w-full max-w-[440px] overflow-hidden rounded-[14px] bg-paper shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--color-ink)_10%,transparent),0_18px_40px_-24px_rgb(0_0_0/0.3)]", className, )} > <style href="asta-onboarding" precedence="asta">{` @keyframes kit-ob-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } } @keyframes kit-ob-pop { 0% { opacity: 0; transform: scale(.6); } 60% { opacity: 1; transform: scale(1.06); } 100% { transform: none; } } @media (prefers-reduced-motion: reduce) { .kit-ob, .kit-ob * { animation: none !important; transition-duration: 0s !important; } } `}</style> {finished ? ( <div className="flex flex-col items-center px-8 py-12 text-center" style={{ animation: `kit-ob-in .5s ${CURVE} both` }}> <span className="flex h-12 w-12 items-center justify-center rounded-full bg-brand text-on-brand" style={{ animation: `kit-ob-pop .6s ${CURVE} .1s both` }}> <Check className="h-6 w-6" /> </span> <h3 className="mt-5 text-[18px] font-medium tracking-[-0.02em] text-ink">You are all set</h3> <p className="mt-1.5 max-w-[30ch] text-[13.5px] leading-relaxed text-mute">Every step is done. You can come back to this list from Settings.</p> <div className="mt-6 flex gap-2"> <Button variant="ghost" size="sm" onClick={() => setReview(true)}> Review steps </Button> {onFinish && ( <Button size="sm" onClick={onFinish}> {finishLabel} </Button> )} </div> </div> ) : ( <> <div className="px-5 pb-4 pt-5"> <div className="flex items-baseline justify-between gap-4"> <h3 className="text-[15px] font-medium tracking-[-0.01em] text-ink">{title}</h3> <span className="text-[12.5px] tabular-nums text-mute"> {count} of {total} </span> </div> {subtitle && <p className="mt-1 text-[13px] text-mute">{subtitle}</p>} <div role="progressbar" aria-label="Setup progress" aria-valuemin={0} aria-valuemax={total} aria-valuenow={count} className="mt-4 h-1 overflow-hidden rounded-full bg-[color-mix(in_srgb,var(--color-ink)_8%,transparent)]" > <div className={cx("h-full origin-left rounded-full bg-brand transition-transform duration-700", EASE)} style={{ transform: `scaleX(${count / total})` }} /> </div> </div> <ol className="px-2 pb-2"> {steps.map((s) => { const isDone = done.includes(s.id); const isOpen = open === s.id; const panel = `${uid}-${s.id}`; return ( <li key={s.id} className={cx("rounded-[10px] transition-colors duration-300", isOpen && "bg-paper-2")}> <button type="button" aria-expanded={isOpen} aria-controls={panel} onClick={() => setOpen(isOpen ? null : s.id)} className="flex w-full items-center gap-3 rounded-[10px] px-3 py-3 text-left outline-none focus-visible:ring-2 focus-visible:ring-brand/50" > <Mark done={isDone} current={isOpen} /> <span className={cx("flex-1 text-[14px] transition-colors duration-300", isDone && !isOpen ? "text-mute" : "text-ink")}> {s.title} {isDone && <span className="sr-only"> (done)</span>} </span> {s.duration && !isDone && <span className="text-[12px] tabular-nums text-mute">{s.duration}</span>} <svg viewBox="0 0 24 24" className={cx("h-3.5 w-3.5 shrink-0 text-mute transition-transform duration-300", EASE, isOpen && "rotate-180")} fill="none" stroke="currentColor" strokeWidth="2.55" strokeLinecap="round" strokeLinejoin="round" aria-hidden > <path d="m6 9.5 6 6 6-6" /> </svg> </button> <div id={panel} role="region" aria-label={s.title} className={cx("grid transition-[grid-template-rows] duration-500", EASE, isOpen ? "grid-rows-[1fr]" : "grid-rows-[0fr]")}> <div className="overflow-hidden" inert={!isOpen}> <div className={cx("pb-4 pl-11 pr-4 transition-[opacity,transform] duration-500", EASE, isOpen ? "translate-y-0 opacity-100" : "-translate-y-1 opacity-0")}> <div className="text-[13px] leading-relaxed text-mute">{s.description}</div> <div className="mt-3.5 flex items-center gap-2"> {isDone ? ( <span className="flex items-center gap-1.5 text-[12.5px] text-mute"> <Check className="h-3.5 w-3.5 text-brand" /> Done </span> ) : ( <Button size="sm" loading={busy === s.id} onClick={() => complete(s.id)}> {s.action ?? "Mark as done"} </Button> )} </div> </div> </div> </div> </li> ); })} </ol> </> )} </div> ); } export default Onboarding;"use client"; import { useId, useRef, useState, type ReactNode } from "react"; import { Button } from "@/components/kit/base/button"; const cx = (...c: (string | false | null | undefined)[]) => c.filter(Boolean).join(" "); const EASE = "ease-[cubic-bezier(.16,1,.3,1)]"; const CURVE = "cubic-bezier(.16,1,.3,1)"; export interface OnboardingStep { id: string; title: string; description: ReactNode; /** Label of the button that completes the step. */ action?: string; /** Rough time, e.g. "2 min". */ duration?: string; } export interface OnboardingProps { title?: string; subtitle?: string; steps: OnboardingStep[]; defaultCompleted?: string[]; /** Runs when a step's button is pressed. Return a promise and the button shows progress until it resolves. */ onStep?: (id: string) => void | Promise<void>; /** The done state's button. Leave it out to hide the button. */ onFinish?: () => void; finishLabel?: string; className?: string; } const Check = ({ className = "" }: { className?: string }) => ( <svg viewBox="0 0 24 24" className={className} fill="none" stroke="currentColor" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round" aria-hidden> <path d="m5 12.5 4.5 4.5L19 7.5" /> </svg> ); function Mark({ done, current }: { done: boolean; current: boolean }) { return ( <span className="relative flex h-5 w-5 shrink-0 items-center justify-center" aria-hidden> <span className={cx( "absolute inset-0 rounded-full transition-[opacity,transform] duration-300", EASE, done ? "scale-75 opacity-0" : "scale-100 opacity-100", current ? "shadow-[inset_0_0_0_1.5px_var(--color-ink)]" : "shadow-[inset_0_0_0_1.5px_color-mix(in_srgb,var(--color-ink)_22%,transparent)]", )} /> <span className={cx( "absolute inset-0 flex items-center justify-center rounded-full bg-brand text-on-brand transition-[opacity,transform] duration-500", EASE, done ? "scale-100 opacity-100" : "scale-50 opacity-0", )} > <Check className="h-3 w-3" /> </span> </span> ); } /** * A setup checklist. One step is open at a time. Completing it ticks the mark, fills the bar and opens * the next step that is still to do. When everything is done the card turns into a short done state. */ export function Onboarding({ title = "Get set up", subtitle, steps, defaultCompleted = [], onStep, onFinish, finishLabel = "Go to dashboard", className }: OnboardingProps) { const [done, setDone] = useState<string[]>(defaultCompleted); // Latest done list, so completions that resolve together don't overwrite each other. const doneRef = useRef(done); const firstOpen = steps.find((s) => !defaultCompleted.includes(s.id))?.id ?? null; const [open, setOpen] = useState<string | null>(firstOpen); const [busy, setBusy] = useState<string | null>(null); const [review, setReview] = useState(false); const uid = useId(); const total = steps.length; const count = steps.filter((s) => done.includes(s.id)).length; const finished = count === total && !review; const complete = async (id: string) => { try { const r = onStep?.(id); if (r instanceof Promise) { setBusy(id); await r; } } catch (err) { // A failed step stays open and to do. The caller owns the error message. console.error(err); return; } finally { setBusy((b) => (b === id ? null : b)); } const next = doneRef.current.includes(id) ? doneRef.current : [...doneRef.current, id]; doneRef.current = next; setDone((d) => (d.includes(id) ? d : [...d, id])); // Open the next step still to do, looking forward first, then from the top. const i = steps.findIndex((s) => s.id === id); const after = [...steps.slice(i + 1), ...steps.slice(0, i)].find((s) => !next.includes(s.id)); setOpen(after?.id ?? null); }; return ( <div className={cx( "kit-ob relative w-full max-w-[440px] overflow-hidden rounded-[14px] bg-paper shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--color-ink)_10%,transparent),0_18px_40px_-24px_rgb(0_0_0/0.3)]", className, )} > <style href="asta-onboarding" precedence="asta">{` @keyframes kit-ob-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } } @keyframes kit-ob-pop { 0% { opacity: 0; transform: scale(.6); } 60% { opacity: 1; transform: scale(1.06); } 100% { transform: none; } } @media (prefers-reduced-motion: reduce) { .kit-ob, .kit-ob * { animation: none !important; transition-duration: 0s !important; } } `}</style> {finished ? ( <div className="flex flex-col items-center px-8 py-12 text-center" style={{ animation: `kit-ob-in .5s ${CURVE} both` }}> <span className="flex h-12 w-12 items-center justify-center rounded-full bg-brand text-on-brand" style={{ animation: `kit-ob-pop .6s ${CURVE} .1s both` }}> <Check className="h-6 w-6" /> </span> <h3 className="mt-5 text-[18px] font-medium tracking-[-0.02em] text-ink">You are all set</h3> <p className="mt-1.5 max-w-[30ch] text-[13.5px] leading-relaxed text-mute">Every step is done. You can come back to this list from Settings.</p> <div className="mt-6 flex gap-2"> <Button variant="ghost" size="sm" onClick={() => setReview(true)}> Review steps </Button> {onFinish && ( <Button size="sm" onClick={onFinish}> {finishLabel} </Button> )} </div> </div> ) : ( <> <div className="px-5 pb-4 pt-5"> <div className="flex items-baseline justify-between gap-4"> <h3 className="text-[15px] font-medium tracking-[-0.01em] text-ink">{title}</h3> <span className="text-[12.5px] tabular-nums text-mute"> {count} of {total} </span> </div> {subtitle && <p className="mt-1 text-[13px] text-mute">{subtitle}</p>} <div role="progressbar" aria-label="Setup progress" aria-valuemin={0} aria-valuemax={total} aria-valuenow={count} className="mt-4 h-1 overflow-hidden rounded-full bg-[color-mix(in_srgb,var(--color-ink)_8%,transparent)]" > <div className={cx("h-full origin-left rounded-full bg-brand transition-transform duration-700", EASE)} style={{ transform: `scaleX(${count / total})` }} /> </div> </div> <ol className="px-2 pb-2"> {steps.map((s) => { const isDone = done.includes(s.id); const isOpen = open === s.id; const panel = `${uid}-${s.id}`; return ( <li key={s.id} className={cx("rounded-[10px] transition-colors duration-300", isOpen && "bg-paper-2")}> <button type="button" aria-expanded={isOpen} aria-controls={panel} onClick={() => setOpen(isOpen ? null : s.id)} className="flex w-full items-center gap-3 rounded-[10px] px-3 py-3 text-left outline-none focus-visible:ring-2 focus-visible:ring-brand/50" > <Mark done={isDone} current={isOpen} /> <span className={cx("flex-1 text-[14px] transition-colors duration-300", isDone && !isOpen ? "text-mute" : "text-ink")}> {s.title} {isDone && <span className="sr-only"> (done)</span>} </span> {s.duration && !isDone && <span className="text-[12px] tabular-nums text-mute">{s.duration}</span>} <svg viewBox="0 0 24 24" className={cx("h-3.5 w-3.5 shrink-0 text-mute transition-transform duration-300", EASE, isOpen && "rotate-180")} fill="none" stroke="currentColor" strokeWidth="2.55" strokeLinecap="round" strokeLinejoin="round" aria-hidden > <path d="m6 9.5 6 6 6-6" /> </svg> </button> <div id={panel} role="region" aria-label={s.title} className={cx("grid transition-[grid-template-rows] duration-500", EASE, isOpen ? "grid-rows-[1fr]" : "grid-rows-[0fr]")}> <div className="overflow-hidden" inert={!isOpen}> <div className={cx("pb-4 pl-11 pr-4 transition-[opacity,transform] duration-500", EASE, isOpen ? "translate-y-0 opacity-100" : "-translate-y-1 opacity-0")}> <div className="text-[13px] leading-relaxed text-mute">{s.description}</div> <div className="mt-3.5 flex items-center gap-2"> {isDone ? ( <span className="flex items-center gap-1.5 text-[12.5px] text-mute"> <Check className="h-3.5 w-3.5 text-brand" /> Done </span> ) : ( <Button size="sm" loading={busy === s.id} onClick={() => complete(s.id)}> {s.action ?? "Mark as done"} </Button> )} </div> </div> </div> </div> </li> ); })} </ol> </> )} </div> ); } export default Onboarding;Or ask your AI agent
Paste this into Claude Code, Cursor, Codex, v0 or Lovable. Fill in the last line. More in Prompts.
Add the Astabyte UI Onboarding checklist component to my project. A setup checklist that opens the next step. It includes: progress, steps, done state. Install it (Radix build): ```sh pnpm dlx asta-ui@latest add onboarding --radix ``` Or with the shadcn CLI: ```sh pnpm dlx shadcn@latest add https://ui.astabyte.com/r/onboarding.json ``` If the project isn't set up yet, run `pnpm dlx asta-ui@latest init --radix` first: it runs `shadcn init` when needed and adds the @astabyte registry (Next.js, Vite, React Router, Astro, TanStack Start; Tailwind CSS v4). Import it like this: ```tsx import { Onboarding, type OnboardingStep } from "@/components/astabyte/onboarding"; ``` Usage example and props: https://ui.astabyte.com/onboarding Full catalogue for context: https://ui.astabyte.com/llms.txt Rules: - Keep the colour tokens (paper, paper-2, ink, ink-2, mute, brand). Don't restyle with hard-coded colours; rebrand by changing the token values in the CSS. - Keep the motion as it is: transform and opacity only, and the prefers-reduced-motion fallback. - Keep keyboard, focus and ARIA behaviour (interactive pieces are built on Radix primitives from the radix-ui package). - Stay on Radix: install other Astabyte UI components with `--radix` so the project uses one primitive library. - Use fake data and fake brand names in examples. Use it to: [describe where it goes and what it should do]Add the Astabyte UI Onboarding checklist component to my project. A setup checklist that opens the next step. It includes: progress, steps, done state. Install it (Base UI build): ```sh pnpm dlx asta-ui@latest add onboarding ``` Or with the shadcn CLI: ```sh pnpm dlx shadcn@latest add https://ui.astabyte.com/r/base/onboarding.json ``` If the project isn't set up yet, run `pnpm dlx asta-ui@latest init` first: it runs `shadcn init` when needed and adds the @astabyte registry (Next.js, Vite, React Router, Astro, TanStack Start; Tailwind CSS v4). Import it like this: ```tsx import { Onboarding, type OnboardingStep } from "@/components/astabyte/onboarding"; ``` Usage example and props: https://ui.astabyte.com/onboarding Full catalogue for context: https://ui.astabyte.com/llms.txt Rules: - Keep the colour tokens (paper, paper-2, ink, ink-2, mute, brand). Don't restyle with hard-coded colours; rebrand by changing the token values in the CSS. - Keep the motion as it is: transform and opacity only, and the prefers-reduced-motion fallback. - Keep keyboard, focus and ARIA behaviour (interactive pieces are built on Base UI primitives from the @base-ui/react package). - Stay on Base UI: install other Astabyte UI components without `--radix` so the project uses one primitive library. - Use fake data and fake brand names in examples. Use it to: [describe where it goes and what it should do]Or use plain HTML + CSS
Not on React? Use it from Django, Rails, Laravel, Go
html/template, htmx or a static page. Loadasta.cssandasta.jsonce (thehead.htmltab), then paste the markup. Theui.astabyte.com/cdnlink is temporary: pin a version from jsDelivr for production. More in HTML + CSS.<!-- Needs asta.js to open and close steps; each action posts to /onboarding, which returns the updated list. --> <div style="max-width:440px"> <div id="onboarding" data-asta-onboarding class="asta-onboarding"><div data-asta-onboarding-list> <div class="asta-onboarding-head"><div class="asta-onboarding-heading"><h3 class="asta-onboarding-title">Get started with Astabyte</h3><span class="asta-onboarding-count">1 of 4</span></div><p class="asta-onboarding-subtitle">Four steps and your workspace is ready.</p> <div class="asta-progress asta-progress-sm asta-onboarding-progress"><div class="asta-progress-track" role="progressbar" aria-label="Setup progress" aria-valuemin="0" aria-valuemax="4" aria-valuenow="1" aria-valuetext="1 of 4 steps"><span class="asta-progress-fill" style="transform:translateX(-75%)"></span></div></div></div> <ol class="asta-onboarding-steps"> <li data-asta-onboarding-step class="asta-onboarding-step asta-onboarding-step-done"><button type="button" data-asta-onboarding-toggle aria-expanded="false" aria-controls="ob-profile" class="asta-onboarding-toggle"><span class="asta-onboarding-mark" aria-hidden="true"><span class="asta-onboarding-ring"></span><span class="asta-onboarding-tick"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 8.5l2.5 2.5 5.5-6"/></svg></span></span><span class="asta-onboarding-label">Add your profile<span class="asta-sr-only">(done)</span></span><svg class="asta-onboarding-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" aria-hidden="true"><path d="m4.5 6.5 3.5 3.5 3.5-3.5"/></svg></button> <div id="ob-profile" role="region" aria-label="Add your profile" class="asta-onboarding-panel" hidden><div class="asta-onboarding-desc">A name and photo help your team know who's who.</div><div class="asta-onboarding-actions"><span class="asta-onboarding-done-note"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 8.5l2.5 2.5 5.5-6"/></svg>Done</span></div></div></li> <li data-asta-onboarding-step class="asta-onboarding-step"><button type="button" data-asta-onboarding-toggle aria-expanded="true" aria-controls="ob-invite" class="asta-onboarding-toggle"><span class="asta-onboarding-mark" aria-hidden="true"><span class="asta-onboarding-ring"></span><span class="asta-onboarding-tick"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 8.5l2.5 2.5 5.5-6"/></svg></span></span><span class="asta-onboarding-label">Invite your team</span><span class="asta-onboarding-duration">2 min</span><svg class="asta-onboarding-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" aria-hidden="true"><path d="m4.5 6.5 3.5 3.5 3.5-3.5"/></svg></button> <div id="ob-invite" role="region" aria-label="Invite your team" class="asta-onboarding-panel"><div class="asta-onboarding-desc">Astabyte works best with the people you build with. Invite as many as you like.</div><div class="asta-onboarding-actions"><button type="button" class="asta-btn asta-btn-sm" hx-post="/onboarding" hx-vals='{"step":"invite"}' hx-target="#onboarding" hx-swap="outerHTML"><span class="asta-btn-label">Send invites</span><span class="asta-btn-spinner" aria-hidden="true"><svg viewBox="0 0 16 16" fill="none" aria-hidden="true"><circle cx="8" cy="8" r="6" stroke="currentColor" stroke-opacity="0.25" stroke-width="2"/><path d="M14 8a6 6 0 0 0-6-6" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></span></button></div></div></li> <li data-asta-onboarding-step class="asta-onboarding-step"><button type="button" data-asta-onboarding-toggle aria-expanded="false" aria-controls="ob-project" class="asta-onboarding-toggle"><span class="asta-onboarding-mark" aria-hidden="true"><span class="asta-onboarding-ring"></span><span class="asta-onboarding-tick"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 8.5l2.5 2.5 5.5-6"/></svg></span></span><span class="asta-onboarding-label">Create a project</span><span class="asta-onboarding-duration">1 min</span><svg class="asta-onboarding-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" aria-hidden="true"><path d="m4.5 6.5 3.5 3.5 3.5-3.5"/></svg></button> <div id="ob-project" role="region" aria-label="Create a project" class="asta-onboarding-panel" hidden><div class="asta-onboarding-desc">Start from a template or a blank page. You can rename it later.</div><div class="asta-onboarding-actions"><button type="button" class="asta-btn asta-btn-sm" hx-post="/onboarding" hx-vals='{"step":"project"}' hx-target="#onboarding" hx-swap="outerHTML"><span class="asta-btn-label">Create project</span><span class="asta-btn-spinner" aria-hidden="true"><svg viewBox="0 0 16 16" fill="none" aria-hidden="true"><circle cx="8" cy="8" r="6" stroke="currentColor" stroke-opacity="0.25" stroke-width="2"/><path d="M14 8a6 6 0 0 0-6-6" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></span></button></div></div></li> <li data-asta-onboarding-step class="asta-onboarding-step"><button type="button" data-asta-onboarding-toggle aria-expanded="false" aria-controls="ob-github" class="asta-onboarding-toggle"><span class="asta-onboarding-mark" aria-hidden="true"><span class="asta-onboarding-ring"></span><span class="asta-onboarding-tick"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 8.5l2.5 2.5 5.5-6"/></svg></span></span><span class="asta-onboarding-label">Connect GitHub</span><span class="asta-onboarding-duration">30 sec</span><svg class="asta-onboarding-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" aria-hidden="true"><path d="m4.5 6.5 3.5 3.5 3.5-3.5"/></svg></button> <div id="ob-github" role="region" aria-label="Connect GitHub" class="asta-onboarding-panel" hidden><div class="asta-onboarding-desc">Link a repository to preview every pull request.</div><div class="asta-onboarding-actions"><button type="button" class="asta-btn asta-btn-sm" hx-post="/onboarding" hx-vals='{"step":"github"}' hx-target="#onboarding" hx-swap="outerHTML"><span class="asta-btn-label">Connect</span><span class="asta-btn-spinner" aria-hidden="true"><svg viewBox="0 0 16 16" fill="none" aria-hidden="true"><circle cx="8" cy="8" r="6" stroke="currentColor" stroke-opacity="0.25" stroke-width="2"/><path d="M14 8a6 6 0 0 0-6-6" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></span></button></div></div></li> </ol></div></div> </div>
Usage
The demo above, as code.
"use client";
import { useState } from "react";
import { Onboarding, type OnboardingStep } from "@/components/astabyte/onboarding";
const STEPS: OnboardingStep[] = [
{ id: "profile", title: "Create your profile", description: "Add a name and a photo so your team knows who is who.", duration: "1 min" },
{ id: "invite", title: "Invite your team", description: "Send invites by email. People join with one click.", action: "Send invites", duration: "2 min" },
{ id: "connect", title: "Connect a data source", description: "Pick a database or upload a CSV. We only read what you choose.", action: "Connect", duration: "3 min" },
{ id: "dashboard", title: "Build your first dashboard", description: "Start from a template, then make it yours.", action: "Open templates", duration: "5 min" },
];
const wait = () => new Promise<void>((r) => setTimeout(r, 700));
export default function OnboardingDemo() {
// Bump the key to start over.
const [run, setRun] = useState(0);
return (
<div className="flex min-h-[460px] w-full flex-col items-center justify-center gap-3 p-4 sm:p-8">
<Onboarding
key={run}
title="Get set up"
subtitle="Four steps, about ten minutes."
steps={STEPS}
defaultCompleted={["profile"]}
onStep={wait}
onFinish={() => setRun((n) => n + 1)}
finishLabel="Start over"
/>
<p className="text-[12.5px] text-mute">Finish a step and the next one opens.</p>
</div>
);
}