Sub topic 1
When a guided flow is the right tool
A guided flow, often called a wizard, collects information one step at a time. This chapter helps you decide when that structure fits and when a single form is the better choice. Later chapters build the pieces: steps, state, navigation, validation, and branching.
Prerequisites
This chapter assumes you have:
- Basic programming experience in a typed or dynamic language. The examples use TypeScript, but they avoid framework-specific code.
- Familiarity with forms and form fields, including labels, required fields, and submit buttons.
- A basic understanding of application state, meaning the data an app keeps in memory while a user works.
What a guided flow does
A guided flow breaks a long data-collection task into an ordered set of screens. The user sees one group of related inputs at a time. The app decides which screen comes next, checks the input before moving on, and keeps everything the user has entered so far.
That gives you three things a plain form does not:
- Focus. The user answers a few related questions instead of scanning a long page.
- Control over order. Later questions can depend on earlier answers.
- Early feedback. Mistakes are caught on the step where they happen, not after a long submit.
The cost is added machinery. A flow needs state, navigation rules, and per-step validation. You pay that cost only when the benefits are real.
Signals that a flow fits
A flow is usually the right tool when several of these are true:
- The task has many inputs, and they fall into natural groups such as account, company, and payment.
- Some questions apply only to some users. A business account needs a company name, and a personal account does not.
- Later steps depend on earlier answers, such as shipping options that depend on a chosen country.
- Users are unlikely to know everything up front, so the order in which you ask matters.
- Mistakes are costly, and a review step before submission reduces them.
- The task is done rarely and users are unfamiliar with it, such as onboarding or applying for a service.
Signals that a flow is the wrong tool
A single form or a settings page is often better when:
- There are only a few fields, roughly five or fewer, and all of them always apply.
- Users edit existing data and need to jump straight to one field. A flow forces them through steps they do not care about.
- Users repeat the task often. Experienced users find extra clicks slow.
- Users need to compare values across fields at the same time.
A common mistake is to split a short form into steps to make it look lighter. The user then has the same number of questions plus extra clicks.
| Situation | Better choice |
|---|---|
| Sign-up with an optional business branch | Guided flow |
| Editing a profile name | Single form |
| Loan application with 30 fields in groups | Guided flow |
| Search filters | Single form |
| First-time setup with dependent choices | Guided flow |
A simple decision path
The diagram below summarizes the checks. Treat it as a starting point, not a rule.
What a flow looks like in code
You do not need the full implementation yet. It helps to see the core idea now: each step declares its own validation and names the step that follows. Branching lives in data, not in scattered if statements.
type Data = Record<string, string>;
type Step = {
id: string;
validate(data: Data): string[];
next(data: Data): string | null;
};
const steps: Record<string, Step> = {
account: {
id: "account",
validate: (d) =>
/^\S+@\S+\.\S+$/.test(d.email ?? "") ? [] : ["Enter a valid email address."],
next: (d) => (d.accountType === "business" ? "company" : "review"),
},
company: {
id: "company",
validate: (d) => ((d.company ?? "").trim() ? [] : ["Enter your company name."]),
next: () => "review",
},
review: {
id: "review",
validate: () => [],
next: () => null,
},
};The account step sends business users to company and everyone else straight to review. The review step returns null, which marks the end of the flow. If you can describe your task as a small table like this, a flow is probably a good fit.
Costs to weigh
Before you commit, consider what a flow adds:
- State. You must track the current step, collected data, and history.
- Navigation edge cases. Back must return to the step the user actually came from, even after a branch.
- Testing. The number of paths grows with each branch.
- Progress display. When branches change the number of remaining steps, a fixed "step 2 of 5" can become wrong.
Summary
Choose a guided flow when inputs are many, grouped, conditional, or costly to get wrong. Choose a single form when the task is short, always the same, or frequently repeated. The next chapter covers how to split inputs into steps once you have decided on a flow.
Exercise
A settings page lets users change their display name, time zone, and notification preference. Each setting is independent, and users usually change only one at a time. Should you build a guided flow? Give two reasons.
Show answer
No. Use a single form or a settings page. The fields are few and always apply, so a flow adds extra clicks without a benefit. Users also come to edit one value, and a flow would force them through steps they do not need.
Exercise
A tax-filing tool asks about income sources. Users with freelance income answer extra questions about expenses, and others skip them. Name two properties of this task that favor a guided flow.
Show answer
The questions are conditional, since freelance users see extra steps based on an earlier answer. The inputs also fall into natural groups, and a review step before submission reduces costly mistakes.