Blocks / Onboarding checklist

Onboarding checklist

Steps to get started with a done mark, a bar of progress, an action and “Mark done” on each; folds and dismisses.

import { OnboardingChecklist, editorChecklistProgress, editorNextStep } from "@forgeron/ui";
/01 → Default
1 of 4 done
  1. Create a board (done)
  2. Invite a teammateShare the link so they can join in.
  3. Leave a commentDrop a pin on anything.
  4. Export as PNGFrom the File menu.
import { OnboardingChecklist, type OnboardingStep } from "@forgeron/ui";
import { useState } from "react";

const initial: OnboardingStep[] = [
  { id: "create", title: "Create a board", done: true },
  {
    id: "invite",
    title: "Invite a teammate",
    description: "Share the link so they can join in.",
  },
  { id: "comment", title: "Leave a comment", description: "Drop a pin on anything." },
  { id: "export", title: "Export as PNG", description: "From the File menu." },
];

export default function Default() {
  const [steps, setSteps] = useState(initial);
  const set = (id: string, done: boolean) =>
    setSteps((list) => list.map((s) => (s.id === id ? { ...s, done } : s)));
  return (
    <div style={{ width: "100%", maxWidth: 400 }}>
      <OnboardingChecklist
        title="Get started"
        steps={steps.map((s) => ({
          ...s,
          action: s.done ? undefined : { label: "Do it", onClick: () => set(s.id, true) },
        }))}
        onMarkDone={(id) => set(id, true)}
        onMarkUndone={(id) => set(id, false)}
        onDismiss={() => setSteps(initial)}
      />
    </div>
  );
}
/02 → Complete
2 of 2 done
import { OnboardingChecklist } from "@forgeron/ui";

export default function Complete() {
  return (
    <div style={{ width: "100%", maxWidth: 400 }}>
      <OnboardingChecklist
        title="Get started"
        defaultCollapsed
        steps={[
          { id: "a", title: "Create a board", done: true },
          { id: "b", title: "Invite a teammate", done: true },
        ]}
        completeMessage="All done. You know your way around."
      />
    </div>
  );
}
API → Props
PropTypeDefaultDescription
titlestring—The heading: “Get started”.
steps{ id, title, description?, done?, action?: { label, onClick } }[]—The app owns what is done. The first step not done is marked as the next.
onMarkDone / onMarkUndone(id) => void—The Mark done and Undo buttons; without them, no button.
onDismiss() => void—The close button; the app hides the checklist.
collapsed / defaultCollapsed / onCollapsedChangeboolean—Folds to its header and progress.
completeMessageReactNode—Said when every step is done.
classNamestring—Extra classes.