Skip to content

useWizard

Hook that manages a wizard

state
medium
test coverage
Last changed: 7 months ago

Installation

Library
CLI
Manual
typescript
import { useWizard } from '@siberiacancode/reactuse';

Usage

typescript
const { currentStepId, set, reset, back, next, history } = useWizard([ { id: 'step1', nodes: ['step2', 'step3'] }, { id: 'step2', nodes: ['step3'] }, { id: 'step3', nodes: [] }, ])

Demo

Api

Parameters

NameTypeDefaultNote
mapWizardItem<WizardStepId>[]-The map of the wizard
initialStepId?WizardStepId-The initial step id

Returns

UseWizardReturn<WizardStepId>

Type declaration

typescript
export interface WizardItem<WizardStepId> {
  id: WizardStepId;
  nodes?: WizardStepId[];
}

Source

SourceDemo

Contributors

D
debabin
debabin
H
hywax
hywax

Released under the MIT License.