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";- Create a board (done)
- Invite a teammateShare the link so they can join in.
- Leave a commentDrop a pin on anything.
- 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>
);
}All done. You know your way around.
- Create a board (done)
- Invite a teammate (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
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | — | 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 / onCollapsedChange | boolean | — | Folds to its header and progress. |
completeMessage | ReactNode | — | Said when every step is done. |
className | string | — | Extra classes. |