Set the status of step on a form stepper
const [step, setStep] = useState<number>(-1);
const status: GoabFormStepStatus[] = [
"complete",
"complete",
"incomplete",
"not-started"
];
function setPage(page: number) {
if (page < 1 || page > 4) return;
setStep(page);
}<GoabFormStepper step={step} onChange={(event) => setStep(event.step)}>
<GoabFormStep text="Personal details" status={status[0]} />
<GoabFormStep text="Employment history" status={status[1]} />
<GoabFormStep text="References" status={status[2]} />
<GoabFormStep text="Review" status={status[3]} />
</GoabFormStepper>
<GoabPages current={step} mb="3xl" mt="xl" mr="xl" ml="xl">
<div>
<GoabSkeleton type="article" />
</div>
<div>
<GoabSkeleton type="header" size="2" />
<GoabSkeleton type="text" />
<GoabSkeleton type="header" size="2" />
<GoabSkeleton type="text" />
</div>
<div>
<GoabSkeleton type="text" />
<GoabSpacer vSpacing="m" />
<GoabSkeleton type="text" />
</div>
<div>
<GoabSkeleton type="header" size="2" />
<GoabSkeleton type="text" />
<GoabSpacer vSpacing="m" />
<GoabSkeleton type="text" />
</div>
</GoabPages>
<div style={{ display: "flex", justifyContent: "space-between" }}>
<GoabxButton type="secondary" onClick={() => setPage(step - 1)}>
Previous
</GoabxButton>
<GoabxButton type="primary" onClick={() => setPage(step + 1)}>
Next
</GoabxButton>
</div>step = -1;
status: GoabFormStepStatus[] = ["complete", "complete", "incomplete", "not-started"];
updateStep(event: GoabFormStepperOnChangeDetail): void {
this.step = event.step;
}
setPage(page: number): void {
if (page < 1 || page > 4) return;
this.step = page;
}<goab-form-stepper ml="s" mr="s" [step]="step" (onChange)="updateStep($event)">
<goab-form-step text="Personal details" [status]="status[0]"></goab-form-step>
<goab-form-step text="Employment history" [status]="status[1]"></goab-form-step>
<goab-form-step text="References" [status]="status[2]"></goab-form-step>
<goab-form-step text="Review" [status]="status[3]"></goab-form-step>
</goab-form-stepper>
<goab-pages [current]="step" mb="3xl" mt="xl" mr="xl" ml="xl">
<div><!-- Page 1 content --></div>
<div><!-- Page 2 content --></div>
<div><!-- Page 3 content --></div>
<div><!-- Page 4 content --></div>
</goab-pages>
<div style="display: flex; justify-content: space-between">
<goabx-button (onClick)="setPage(step-1)" type="secondary">Previous</goabx-button>
<goabx-button (onClick)="setPage(step+1)" type="primary">Next</goabx-button>
</div>const stepper = document.querySelector('goa-form-stepper');
const pages = document.querySelector('goa-pages');
const prevBtn = document.querySelector('goa-button[type="secondary"]');
const nextBtn = document.querySelector('goa-button[type="primary"]');
let step = -1;
stepper.addEventListener('_change', (e) => {
step = e.detail.step;
stepper.step = step;
pages.current = step;
});
prevBtn.addEventListener('_click', () => {
if (step > 1) {
step--;
stepper.step = step;
pages.current = step;
}
});
nextBtn.addEventListener('_click', () => {
if (step < 4) {
step++;
stepper.step = step;
pages.current = step;
}
});<goa-form-stepper ml="s" mr="s" step="-1">
<goa-form-step text="Personal details" status="complete"></goa-form-step>
<goa-form-step text="Employment history" status="complete"></goa-form-step>
<goa-form-step text="References" status="incomplete"></goa-form-step>
<goa-form-step text="Review" status="not-started"></goa-form-step>
</goa-form-stepper>
<goa-pages current="-1" mb="3xl" mt="xl" mr="xl" ml="xl">
<div><!-- Page 1 content --></div>
<div><!-- Page 2 content --></div>
<div><!-- Page 3 content --></div>
<div><!-- Page 4 content --></div>
</goa-pages>
<div style="display: flex; justify-content: space-between">
<goa-button version="2" type="secondary">Previous</goa-button>
<goa-button version="2" type="primary">Next</goa-button>
</div>Set the status of each step on a form stepper to indicate completion progress.
When to use
Use this pattern when:
- Building multi-step forms that need visual progress indication
- Users need to see which steps are complete, incomplete, or not started
- You want to provide clear navigation through a complex form process
- Form completion status needs to be tracked and displayed
Considerations
- The status property accepts “complete”, “incomplete”, or “not-started” values
- Status is controlled by the application based on form completion
- Consider updating step status as users complete each section
- Provide clear Previous/Next navigation to move between steps
- The form stepper can be clicked to navigate directly to completed steps