Wizard drawer
WizardDrawer offers a way to show some information without creating a dedicated page for it. Usually used for creating a resource in many steps, while staying on the same page.
Example
Single step
When the drawer only has one step, the step indicator is hidden so the layout matches a simple form drawer. Use this for lightweight create flows that do not need multiple steps.
Controlled vs uncontrolled
The wizard drawer may be used controlled or uncontrolled.
Uncontrolled
When uncontrolled, the wizard drawer will manage the active step internally. If submit throws, then the step will not be incremented. An error function may be used to handle the error of the submit.
Controlled
To use the wizard drawer controlled, provide an activeStep prop.
When controlled, the active step is managed by the parent component. Use submit and back to manage the step state. An error function may be used to handle the error of the submit.
Note: the first step will not show a back button unless back is provided.
Close button variant
Use the "icon" close button variant to render an icon button as the exit button. This variant should be used in Journeys, since the other drawers use icon buttons as exit buttons.
Guidelines
When to use
- To display a creation flow that doesn't have a dedicated page.
- For a single-step create or edit form when you want the wizard drawer's footer and submit behavior without step navigation chrome.
When not to use
- To display information. Use the Drawer to display information in a drawer.
Props
Wizard drawer props
| Name | Default | Description |
|---|---|---|
blockBackgroundInteraction | true | booleanBlock scrolling of content behind drawer. |
closeOnOverlayClick | false | booleanClose drawer on overlay click. |
closeButtonVariant | "text" | "text" | "icon"Variant of the close button. |
isOpen | false | booleanDetermines if drawer is open. |
title | — | stringTitle to display at the top of the drawer. |
hasOverlay | false | booleanRender overlay. |
size | "md" | "sm" | "md" | "lg" | "xl" | "full"Drawer size. |
topDisplacement | 0 | number | stringTop displacement of the drawer. |
onClose | — | () => voidCallback invoked to close the drawer. |
activeStep | — | numberThe current step index. Required for controlled components. |
onStepChange | — | (step: number) => voidCallback invoked when the continue or back button is clicked. Required for controlled components. |
steps | — | ControlledWizardStep[] | UncontrolledWizardStep[]The steps of the wizard. |
Controlled wizard drawer step props
| Name | Default | Description |
|---|---|---|
continue | "Continue" | ReactNodeLabel or node to display on the continue button. The last step's default is "Save". |
submit | — | () => void | Promise<void>Callback invoked when the continue button is clicked. |
error | — | (error: unknown) => void | Promise<void>Callback invoked when the submit callback throws. |
back | — | () => voidCallback invoked when the back button is clicked. |
isDisabled | false | booleanWhether the next step is disabled. |
label | — | stringThe step label. |
tooltip | — | stringTooltip to display on the continue button. |
backLabel | "Go back" | stringLabel to display on the back button. |
bodyBackground | — | stringBackground color of the drawer body. |
render | — | FCThe step content. |
Uncontrolled wizard drawer step props
| Name | Default | Description |
|---|---|---|
continue | "Continue" | stringLabel to display on the continue button. The last step's default is "Save". |
submit | — | () => void | Promise<void>Callback invoked when the continue button is clicked. |
error | — | (error: unknown) => void | Promise<void>Callback invoked when the submit callback throws. |
isDisabled | false | booleanWhether the next step is disabled. |
label | — | stringThe step label. |
tooltip | — | stringTooltip to display on the continue button. |
backLabel | "Go back" | stringLabel to display on the back button. |
bodyBackground | — | stringBackground color of the drawer body. |
render | — | FCThe step content. |