Sub topic 7
Deciding What Goes in Each Step
Assume you know basic HTML form elements, basic JavaScript or TypeScript, and how a browser submits form data. This chapter focuses on decomposing a long form into steps. The goal is to reduce cognitive load without hiding important requirements or making navigation confusing.
Start with the user's task
A step should represent a meaningful part of the user's task, not an arbitrary number of fields. Group fields that answer the same question or depend on the same decision.
For example, a checkout flow might contain these tasks:
- Choose delivery or pickup.
- Enter delivery details if delivery is selected.
- Enter payment details.
- Review the complete order.
- Submit the order.
A step usually has one main goal. If a step asks for an address, payment details, marketing preferences, and account settings, users may not understand what they are expected to finish.
Use dependencies to set the order
Put a decision before the fields that depend on it. If the user chooses ship, show the shipping address afterward. If the user chooses pickup, do not make them pass through an irrelevant address step.
A useful sequence is:
- Collect information needed to choose a path.
- Collect details for that path.
- Collect independent details.
- Show a review.
- Submit.
Do not ask for information merely because it is available. Each field should have a reason in the current flow.
type Step = {
id: string;
title: string;
fields: string[];
visibleWhen?: (values: Record<string, string>) => boolean;
};
const steps: Step[] = [
{
id: "method",
title: "Delivery method",
fields: ["delivery"],
},
{
id: "address",
title: "Delivery address",
fields: ["address", "city", "postalCode"],
visibleWhen: (values) => values.delivery === "ship",
},
{
id: "payment",
title: "Payment",
fields: ["cardNumber"],
},
{
id: "review",
title: "Review your order",
fields: [],
},
];The step definition makes the flow inspectable. It also gives validation and navigation code a shared source of truth. A hidden step must be excluded from validation and submission, not merely hidden with CSS.
Choose step boundaries
Use a boundary when one of these conditions is true:
- The next fields belong to a different task.
- The next fields depend on an earlier answer.
- The current group is long enough to feel difficult as one page.
- The user may need to pause before continuing.
- The next group requires a different explanation or permission.
Avoid creating a step for every small group. Excessive steps increase clicks and make the process feel longer. A practical step should contain enough work to feel useful, but not so much that users lose their place.
| Boundary signal | Design response |
|---|---|
| A new decision changes the questions | Put the decision first and branch afterward |
| Fields serve one clear purpose | Keep them together |
| A group is optional | Explain when it matters before showing it |
| A step becomes very long | Split it at a meaningful task boundary |
Test the flow with real scenarios
Walk through the flow using different paths:
- A user who chooses the shortest path.
- A user who changes an earlier answer.
- A user who goes back after entering dependent details.
- A user who reloads the page midway.
- A user who reaches a step with missing or invalid data.
When an earlier answer changes, decide whether dependent values remain, are cleared, or are shown for confirmation. Do not let stale values silently appear in the final submission.
Exercise
A form asks for delivery method, address, payment, and optional gift message. The address is required only for shipping. What step order would you choose, and why?
Show answer
Put delivery method first, then show either the shipping address or pickup location, followed by payment, the optional gift message, and review. The method must come before the dependent address fields, and review should come before submission.