Skip to content

FRD: Onboarding Flow Recipe

FieldValue
IDFRD-046
OwnerDavid Holmes
StatusDraft
PriorityP1 — Recipes
SizeM (Recipe)
Target Releasev2.0.0
Last Updated2026-05-26
RelatedADR-027 (Default Tech Stack)

Document Summary

Create an MDX recipe in Storybook that teaches developers how to compose a first-run onboarding experience using design system components. The recipe covers an onboarding checklist, spotlight/tooltip-based feature discovery, first-run call-to-action banners, activation tracking, a sample state machine for step progression, and analytics hook integration points. It provides copy-pasteable code for a standard SaaS first-run experience.


Introduction

Overview

First-run onboarding is the critical path between signup and activation. A well-composed onboarding flow guides new users through setup steps, highlights key features, and tracks progress toward activation milestones. Despite its importance, onboarding is often built ad-hoc with inconsistent patterns — inline tooltips that cannot be dismissed, checklists without persistence, and no analytics integration. This recipe provides the canonical composition pattern using design system components.

Goals

  • Provide a single MDX recipe showing the complete onboarding flow composition.
  • Show a persistent onboarding checklist (sidebar or card) with step completion tracking.
  • Show spotlight/tooltip overlays for feature discovery during first use.
  • Show first-run CTA banners that appear once and can be dismissed.
  • Provide a sample state machine (using useReducer or similar) for managing onboarding step progression.
  • Document analytics hook integration points for activation tracking.
  • Cover dismiss/skip flows so users are never trapped in onboarding.

Non-Goals

  • Building a guided tour library — the recipe uses existing Tooltip/Popover components for spotlights.
  • Product-specific onboarding content — the recipe shows the framework, not the copy.
  • A/B testing infrastructure for onboarding variants.
  • Email drip campaign integration.
  • Complex multi-role onboarding paths.

Scope

In Scope

ItemDescription
MDX recipe pagesrc/docs/recipes/onboarding-flow.mdx with Storybook sidebar entry
Onboarding checklistChecklist component showing steps with completion state, progress indicator
Spotlight overlaysPopover/Tooltip-based feature discovery pointing at UI elements
First-run CTABanner or Card that appears once for new users, dismissible
State machineuseReducer-based state machine for step transitions (not-started, in-progress, completed, skipped)
PersistencePattern for persisting onboarding state (localStorage for demo, API for production)
Analytics hooksIntegration points for tracking step completion and activation events
Dismiss/skipAllow users to skip individual steps or dismiss the entire onboarding
Overview page updateAdd Onboarding recipe to src/docs/recipes/00-overview.mdx

Out of Scope

ItemReason
Guided tour libraryExisting Popover/Tooltip components suffice for spotlights
Product copy and contentRecipe shows the structural pattern; content is product-specific
Email or notification triggersBackend service concern
A/B testing frameworkExperimentation infrastructure is a separate concern

Users and Pain Points

UserPain Point
Application developerNo canonical pattern for wiring a checklist + spotlights + CTAs into a cohesive onboarding
Application developerOnboarding state management is ad-hoc — boolean flags instead of a proper state machine
Application developerNo pattern for persisting and resuming onboarding across sessions
Application developerAnalytics integration points are an afterthought — hard to retrofit
Product managerNo visibility into onboarding completion rates because tracking was not built in
End userOnboarding cannot be dismissed or skipped — creates frustration for experienced users

Definitions

TermDefinition
Onboarding checklistA persistent UI element showing a list of setup steps with completion indicators
SpotlightA tooltip or popover that points to a specific UI element to highlight a feature
First-run CTAA call-to-action banner or card that appears only during the user’s first session
ActivationThe point at which a user has completed enough onboarding steps to derive value from the product
State machineA formal model of step transitions with defined states and allowed transitions

Current State

  • No onboarding recipe exists in src/docs/recipes/.
  • Components available: Checklist (checklist.tsx), Popover (popover.tsx), Tooltip (tooltip.tsx), Card, Button, ProgressBar, ProgressStepper (progress-stepper.tsx), StepNavigation (step-navigation.tsx), Badge, Toast.
  • A checklist foundation utility exists (checklist-foundation.tsx in widgets).
  • PanelWizard (panel-wizard.tsx) exists for multi-step flows.
  • The recipes overview does not currently list an onboarding recipe.

Proposed Solution

Create src/docs/recipes/onboarding-flow.mdx with the following structure:

  1. Introduction — What this recipe builds, when to use it, when not to use it.
  2. Component inventory — Table listing all components with links.
  3. Data model — TypeScript interfaces for OnboardingStep, OnboardingState, and the step transition actions.
  4. State machineuseReducer implementation for onboarding step management with states: not_started, in_progress, completed, skipped, dismissed.
  5. Onboarding checklist — Checklist component wired to the state machine, showing step progress, completion percentage.
  6. Spotlight overlays — Popover-based spotlights that appear when a step becomes active, pointing at the relevant UI element, with “Got it” / “Skip” actions.
  7. First-run CTA banner — Dismissible Card or Alert shown at the top of the main content area for new users, linking to the first uncompleted step.
  8. Persistence — Pattern for saving/loading onboarding state: localStorage wrapper for development, API endpoint shape for production.
  9. Analytics integration — Hook shape (useOnboardingAnalytics) that fires events on step transitions: onboarding_step_started, onboarding_step_completed, onboarding_step_skipped, onboarding_dismissed, onboarding_activated.
  10. Dismiss and skip — Patterns for skipping individual steps and dismissing the entire onboarding, with confirmation for dismiss-all.
  11. Full composition — Complete code block bringing all sections together.

Requirements

IDRequirementPriority
REQ-01Recipe is a single MDX file in src/docs/recipes/Must
REQ-02Recipe shows an onboarding checklist with step completion trackingMust
REQ-03Recipe provides a state machine for step progressionMust
REQ-04Recipe shows spotlight/tooltip overlays for feature discoveryMust
REQ-05Recipe shows a first-run CTA bannerMust
REQ-06Recipe includes analytics hook integration pointsMust
REQ-07Recipe shows dismiss/skip flowsMust
REQ-08All code blocks are copy-pasteable and self-containedMust
REQ-09Recipe shows persistence pattern (localStorage + API shape)Should
REQ-10Recipe references PanelWizard for multi-step wizard flows where applicableShould

Functional Requirements

IDDescriptionAcceptance
FR-01MDX file renders in Storybook without errorspnpm build-storybook succeeds
FR-02All code blocks compile when extractedManual verification
FR-03State machine handles all transitions without invalid statesTypeScript union types enforce valid transitions
FR-04Checklist shows progress percentage and completed/total countCode example demonstrates both
FR-05Spotlight can be dismissed and advances to the next stepCode example shows “Got it” and “Skip” handlers

Non-Functional Requirements

IDDescriptionTarget
NFR-01Recipe page load timeUnder 2 seconds
NFR-02State machine code blockUnder 50 lines
NFR-03Full composition code blockUnder 250 lines
NFR-04No external dependenciesRecipe uses only design system components and React built-ins

API/Interface Requirements

InterfaceRequirement
MDX fileMust use “
OnboardingStep interfaceid, title, description, status, spotlightTarget (CSS selector or ref), ctaLabel, ctaAction
OnboardingState interfacesteps: OnboardingStep[], currentStepId, isActive, isDismissed, completedAt
State machine actionsSTART_STEP, COMPLETE_STEP, SKIP_STEP, DISMISS_ONBOARDING, RESET_ONBOARDING
Analytics hookuseOnboardingAnalytics(state: OnboardingState) — fires events on state transitions

Accessibility Requirements

IDRequirement
A11Y-01Spotlight overlays must not trap focus — user must be able to Tab away
A11Y-02Checklist must use role="list" with role="listitem" for each step
A11Y-03Completed steps must be announced (e.g., via aria-label="Step 1: Complete")
A11Y-04Dismiss button must have an accessible name (“Dismiss onboarding guide”)
A11Y-05First-run CTA must use role="region" with aria-label="Getting started"
A11Y-06Spotlight must manage focus: move focus to the spotlight popover when shown, return to trigger when dismissed

Content and Documentation Requirements

IDRequirement
DOC-01Update src/docs/recipes/00-overview.mdx to add Onboarding recipe
DOC-02Include a state machine diagram (text-based) showing valid transitions
DOC-03Include a “When to use” / “When not to use” section
DOC-04Document the analytics event names and payloads in a table

Dependencies

DependencyTypeRisk
Checklist componentInternalMust support controlled completion state
Popover componentInternalUsed for spotlight overlays; must support arrow pointing and controlled open state
ProgressBar or ProgressStepperInternalUsed for checklist progress visualization
PanelWizardInternalReferenced for multi-step wizard flows as an alternative to spotlights
checklist-foundation.tsxInternalMay provide reusable checklist logic

Risks and Tradeoffs

RiskImpactMitigation
Spotlight positioning depends on target element layoutMay not work for all UI structuresShow the pattern using CSS selector targeting; note that complex layouts may need ref-based positioning
State machine adds complexityDevelopers may resist adopting itShow how boolean flags lead to impossible states; the state machine prevents bugs
Analytics hook is framework-agnostic but real implementations varyRecipe may not match the team’s analytics stackShow the hook interface; list common adapters (Segment, PostHog, Amplitude) as notes
Onboarding patterns are highly product-specificRecipe may be too genericFocus on the structural composition; include a “Customization points” section

Open Questions

#QuestionStatus
1Should the state machine use useReducer or recommend a library like XState?Open — leaning useReducer for simplicity
2Should spotlights use Popover or a dedicated Spotlight component?Open — leaning Popover with styling
3Should the recipe include a “resume onboarding” banner for returning users who did not complete?Open
4Should the checklist be a sidebar widget or an inline card?Open — show both patterns

Acceptance Criteria

  • src/docs/recipes/onboarding-flow.mdx exists and renders in Storybook.
  • Recipe appears in sidebar under “Docs/Best Practices/Recipes/Onboarding Flow”.
  • Recipe shows an onboarding checklist with step completion and progress.
  • Recipe provides a useReducer-based state machine with TypeScript types.
  • Recipe shows spotlight overlays using Popover with dismiss/skip actions.
  • Recipe shows a first-run CTA banner.
  • Recipe documents analytics hook integration points with event names.
  • Recipe shows dismiss/skip flows for individual steps and the entire onboarding.
  • Recipe shows a persistence pattern.
  • All code blocks compile when extracted.
  • pnpm build-storybook succeeds.

LLM Handoff Instructions

When an LLM agent picks up this FRD:

  1. Read src/docs/recipes/00-overview.mdx for recipe conventions.
  2. Read component source for: Checklist (checklist.tsx), Popover (popover.tsx), Tooltip (tooltip.tsx), ProgressBar, ProgressStepper, StepNavigation, PanelWizard, Card, Button, Toast, Badge.
  3. Read checklist-foundation.tsx in widgets to understand any reusable checklist logic.
  4. Create src/docs/recipes/onboarding-flow.mdx with the section structure from the Proposed Solution.
  5. Sample onboarding steps: “Complete your profile” (name, avatar), “Create your first project”, “Invite a team member”, “Connect an integration”, “Explore the dashboard”.
  6. State machine: define OnboardingStep and OnboardingState types, onboardingReducer with 5 actions, and a useOnboarding hook that wraps the reducer with persistence.
  7. Analytics hook: useOnboardingAnalytics that accepts the state and fires events via a callback pattern (not tied to any specific analytics vendor).
  8. All code blocks must use public package import paths.
  9. After creating, run pnpm build-storybook to verify.
  10. Update src/docs/recipes/00-overview.mdx.

Decision Log

DateDecisionRationale
2026-05-26Use useReducer for state machine rather than XStateLower barrier to adoption; no additional dependency; sufficient for the onboarding use case
2026-05-26Use Popover for spotlights rather than a custom Spotlight componentPopover already supports positioning, arrows, and controlled state; avoids creating a new component
2026-05-26Include analytics hooks as integration points, not a specific vendorTeams use different analytics stacks; the recipe should be vendor-agnostic

Document History

DateVersionAuthorChanges
2026-05-260.1David HolmesInitial draft