Avenra
React Step FormAPI Reference
React Step FormAPI Reference

useFormWizard

Read wizard state and invoke navigation actions.

Hook for reading wizard state and invoking navigation or validation actions.

Basic usage

import { useFormWizard } from "@avenra/react-step-form";

function WizardFooter() {
    const { isFirstStep, isLastStep, prev, next, submit, progress } =
        useFormWizard<SignupValues>();

    return (
        <footer>
            <small>{progress}% complete</small>
            <button type="button" onClick={prev} disabled={isFirstStep}>
                Back
            </button>
            {!isLastStep ? (
                <button type="button" onClick={next}>
                    Continue
                </button>
            ) : (
                <button type="button" onClick={submit}>
                    Submit
                </button>
            )}
        </footer>
    );
}

Return API

Prop

Type

On this page