Skip to content

Commit f781362

Browse files
committed
chore: add start index in wizard
1 parent cd2bcc0 commit f781362

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export type WizardProps = {
55
header?: React.ReactNode;
66
/** Optional footer that is shown below the active step */
77
footer?: React.ReactNode;
8+
/** Optional start index @default 0 */
9+
startIndex?: number;
810
};
911

1012
export type WizardValues = {

src/wizard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { Handler, WizardProps } from './types';
44
import WizardContext from './wizardContext';
55

66
const Wizard: React.FC<WizardProps> = React.memo(
7-
({ header, footer, children }) => {
8-
const [activeStep, setActiveStep] = React.useState(0);
7+
({ header, footer, startIndex = 0, children }) => {
8+
const [activeStep, setActiveStep] = React.useState(startIndex);
99
const [isLoading, setIsLoading] = React.useState(false);
1010
const hasNextStep = React.useRef(true);
1111
const hasPreviousStep = React.useRef(false);

0 commit comments

Comments
 (0)