Basic usage
Wizard renders the step selected by its step prop. Each Wizard.Step has a step name, and the
indicator above the content shows one dot per step. Pass a number to select a step by its position
instead.
import {useState} from 'react'
import {Button, Stack, Wizard} from '@pleo-io/telescope'
const ImportWizard = () => {
const [step, setStep] = useState('forwarding')
return (
<Wizard step={step}>
<Wizard.Step step="forwarding" label="Forwarding">
<Stack align="center">
<Button variant="primary" onClick={() => setStep('scanning')}>
Continue
</Button>
</Stack>
</Wizard.Step>
<Wizard.Step step="scanning" label="Scanning">
<Stack align="center">
<Button variant="primary" onClick={() => setStep('forwarding')}>
Back
</Button>
</Stack>
</Wizard.Step>
</Wizard>
)
}Step states
The steps before the current one are shown as done. Use isCurrentStepDone, isCurrentStepPending
or isCurrentStepError to show the state of the current step.
<Wizard step={1} isCurrentStepPending>
<Wizard.Step label="Connect">…</Wizard.Step>
<Wizard.Step label="Import">…</Wizard.Step>
</Wizard>Hiding the indicator
Pass hideIndicator to render only the step content, for example when the steps have their own
heading.
<Wizard step={step} hideIndicator>
<Wizard.Step step="details">…</Wizard.Step>
<Wizard.Step step="review">…</Wizard.Step>
</Wizard>Step indicator only
Wizard.StepIndicator renders the indicator on its own, for example above a page that switches
steps without Wizard. Pass one entry per step with an optional label, and the index of the
current step.
<Wizard.StepIndicator
steps={[{label: 'Connect accounting system'}, {label: 'Set up categories'}, {}]}
currentIndex={1}
/>API reference
| Prop | Type | Default |
|---|---|---|
childrenSteps to render, usually | enumnull, string, number, bigint, false, true, ReactElement<unknown, string | JSXElementConstructor<any>>, Iterable<ReactNode>, ReactPortal, Promise<AwaitedReactNode> | |
classNameNo description available | enumstring | undefined | |
hideIndicatorHides the step indicator | boolean | |
isCurrentStepDoneMarks the current step as done | boolean | |
isCurrentStepErrorShows the current step as failed | boolean | |
isCurrentStepPendingShows the current step as pending | boolean | |
labelMaxWidthWidth of each step label, in pixels | enumnumber | undefined | |
noAnimationDisables the transition between steps | boolean | |
noRelativeRemoves the relative positioning of the step container | boolean | |
step (required)Index or name of the step to render | enumstring | number | |
stepSizeWidth of each step in the indicator, in pixels | enumnumber | undefined |
Wizard.Step
| Prop | Type | Default |
|---|---|---|
children (required)Content rendered while this step is active | ReactElement<unknown, string | JSXElementConstructor<any>>ReactElement<unknown, string | JSXElementConstructor<any>> | |
labelLabel shown below the step indicator | enumnull, string, number, bigint, false, true, ReactElement<unknown, string | JSXElementConstructor<any>>, Iterable<ReactNode>, ReactPortal, Promise<AwaitedReactNode> | |
stepName used to select this step from the | enumstring | number | undefined |
Wizard.StepIndicator
| Prop | Type | Default |
|---|---|---|
currentIndex (required)Index of the current step | number | |
isCurrentStepDoneMarks the current step as done | boolean | false |
isCurrentStepErrorShows the current step as failed | boolean | false |
isCurrentStepPendingShows the current step as pending | boolean | false |
labelMaxWidthWidth of each step label, in pixels | enumnumber | undefined | |
steps (required)Steps to render, each with an optional label | { label?: ReactNode; }[]{ label?: ReactNode; }[] | |
stepSizeWidth of each step in the indicator, in pixels | enumnumber | undefined |