Debian Codegraph @

node/@patternfly/react-core/src/components/Wizard/examples/Wizard.md

raw
1 ---
2 id: Wizard
3 section: components
4 cssPrefix: pf-v6-c-wizard
5 propComponents:
6 [
7 'Wizard',
8 'WizardFooter',
9 'WizardFooterWrapper',
10 'WizardToggle',
11 'WizardStep',
12 'WizardBody',
13 'WizardHeader',
14 'WizardNav',
15 'WizardNavItem',
16 'WizardContextProps',
17 'WizardBasicStep',
18 'WizardParentStep',
19 'WizardSubStep'
20 ]
21 ---
22
23 import { createContext, useCallback, useContext, useRef, useState } from 'react';
24 import {
25 FormGroup,
26 TextInput,
27 Drawer,
28 DrawerContent,
29 Button,
30 Title,
31 Flex,
32 Checkbox,
33 DrawerPanelContent,
34 DrawerColorVariant,
35 DrawerHead,
36 DrawerActions,
37 DrawerCloseButton,
38 Modal,
39 ModalVariant,
40 Wizard,
41 WizardFooter,
42 WizardFooterWrapper,
43 WizardToggle,
44 WizardStep,
45 WizardBody,
46 useWizardFooter,
47 useWizardContext,
48 WizardNavItem,
49 WizardNav,
50 WizardHeader
51 } from '@patternfly/react-core';
52 import RhMicronsExternalLinkIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-external-link-icon';
53 import SlackHashIcon from '@patternfly/react-icons/dist/esm/icons/slack-hash-icon';
54 import CogsIcon from '@patternfly/react-icons/dist/esm/icons/cogs-icon';
55 import styles from '@patternfly/react-styles/css/components/Wizard/wizard';
56 import layout from '@patternfly/react-styles/css/layouts/Bullseye/bullseye';
57
58 ## Examples
59
60 ### Basic
61
62 ```ts file="./WizardBasic.tsx"
63
64 ```
65
66 ### Plain
67
68 ```ts file="./WizardPlain.tsx"
69
70 ```
71
72 ### Focus content on next/back
73
74 To focus the main content element of the `Wizard`, pass in the `shouldFocusContent` property. It is recommended that this is passed in so that users can navigate through a `WizardStep` content in order.
75
76 ```ts file="./WizardFocusOnNextBack.tsx"
77
78 ```
79
80 ### Basic with disabled steps
81
82 ```ts file="./WizardBasicDisabledSteps.tsx"
83
84 ```
85
86 ### Anchors for nav items
87
88 ```ts file="./WizardWithNavAnchors.tsx"
89
90 ```
91
92 ### Incrementally enabled steps
93
94 ```ts file="./WizardStepVisitRequired.tsx"
95
96 ```
97
98 ### Expandable steps
99
100 ```ts file="./WizardExpandableSteps.tsx"
101
102 ```
103
104 ### Progress after submission
105
106 ```ts file="./WizardWithSubmitProgress.tsx"
107
108 ```
109
110 ### Enabled on form validation
111
112 ```ts file="./WizardEnabledOnFormValidation.tsx"
113
114 ```
115
116 ### Validate on button press
117
118 ```ts file="./WizardValidateOnButtonPress.tsx"
119
120 ```
121
122 ### Progressive steps
123
124 ```ts file="./WizardProgressiveSteps.tsx"
125
126 ```
127
128 ### Get current step
129
130 ```ts file="./WizardGetCurrentStep.tsx"
131
132 ```
133
134 ### Within modal
135
136 ```ts file="./WizardWithinModal.tsx"
137
138 ```
139
140 ### Step drawer content
141
142 ```ts file="./WizardStepDrawerContent.tsx"
143
144 ```
145
146 ### Custom navigation
147
148 ```ts file="./WizardWithCustomNav.tsx"
149
150 ```
151
152 ### Header
153
154 ```ts file="./WizardWithHeader.tsx"
155
156 ```
157
158 ### Custom footer
159
160 ```ts file="./WizardWithCustomFooter.tsx"
161
162 ```
163
164 ### Custom navigation item
165
166 ```ts file="./WizardWithCustomNavItem.tsx"
167
168 ```
169
170 ### Toggle step visibility
171
172 ```ts file="./WizardToggleStepVisibility.tsx"
173
174 ```
175
176 ### Step status
177
178 ```ts file="./WizardStepStatus.tsx"
179
180 ```
181
182 ## Hooks
183
184 ### useWizardContext
185
186 Used to access any property of [WizardContext](#wizardcontextprops):
187
188 ```noLive
189 import { useWizardContext } from '@patternfly/react-core';
190
191 const StepContent = () => {
192 const { activeStep } = useWizardContext();
193 return <>This is the current step: {activeStep}</>;
194 }
195 ```
196
197 ### useWizardFooter
198
199 Used to set a unique footer for the wizard on any given step.
200
201 ```noLive
202 import { useWizardFooter } from '@patternfly/react-core';
203
204 const StepContent = () => {
205 useWizardFooter(<>Some footer</>);
206 return <>Step content</>;
207 }
208 ```