Skip to content

Commit c435e75

Browse files
authored
Merge pull request #235 from rvsia/updatePF4wizardDoc
Update PF4 wizard doc
2 parents e43593c + 502cced commit c435e75

File tree

1 file changed

+22
-8
lines changed
  • packages/react-renderer-demo/src/app/src/doc-components

1 file changed

+22
-8
lines changed

packages/react-renderer-demo/src/app/src/doc-components/pf4-wizard.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Don't forget hide form controls by setting \`showFormControls\` to \`false\` as
1616
| setFullWidth | bool | undefined | see Patternfly |
1717
| setFullHeight | bool | undefined | see Patternfly |
1818
| isDynamic | bool | undefined | will dynamically generate steps navigation (=progressive wizard), please use if you use any condition fields which changes any field in other steps (wizards with conditional steps are dynamic by default) |
19+
|showTitles|bool|undefined|If true, step titles will be shown in the wizard body|
20+
|predictSteps|bool|undefined|If true, dynamic wizard will predict steps in the navigation.|
1921

2022
## Default buttonLabels
2123

@@ -27,7 +29,6 @@ Don't forget hide form controls by setting \`showFormControls\` to \`false\` as
2729
submit: 'Submit',
2830
}
2931
```
30-
3132
You can rewrite only selection of them, e.g.
3233

3334
```jsx
@@ -45,9 +46,13 @@ You can rewrite only selection of them, e.g.
4546
| stepKey | string, number | For first step: 1, otherwise anything |
4647
| nextStep | object/stepKey of next step | See below |
4748
| fields | array | As usual |
48-
| substep | string | Substep title (steps are grouped by this title) |
49+
| substepOf | string | Substep title (steps are grouped by this title) |
4950
| title | string | Step title |
50-
| buttons | node, func | Custom buttons component
51+
| buttons | node, func | Custom buttons component|
52+
|showTitle|bool|If true, step titles will (not if false) be shown in the wizard body|
53+
|customTitle|node|Use if you want to render as the title different/custom title (for example, title with a popover|
54+
|disableForwardJumping|bool|When use return to this step, jumping forward in the navigation is disabled.|
55+
5156

5257
- nextStep can be stepKey of the next step
5358
- or you can branch the way by using of object:
@@ -63,6 +68,12 @@ nextStep: {
6368
},
6469
```
6570

71+
- another option is to use custom function. The custom function receives as the first argument an object with values and the function has to return a `stepKey` in string.
72+
73+
```jsx
74+
nextStep: ({ values }) => (values.aws === '123' &&& values.password === 'secret') ? 'secretStep' : 'genericStep'
75+
```
76+
6677
### Buttons
6778

6879
Each step can implement its own buttons.
@@ -98,9 +109,10 @@ The components receives these props:
98109
|buttonLabels|Object with labels.|
99110
|renderNextButton|Function which completely handle the next/submit button.|
100111

112+
101113
## How to do substeps
102114

103-
Field in Wizard fields should contain `substep` <`string`> which is title of the primary step. Steps with the same substep are grouped together by the title of primary step.
115+
Field in Wizard fields should contain `substepOf` <`string`> which is title of the primary step. Steps with the same substepOf are grouped together by the title of primary step.
104116

105117
### Example
106118

@@ -126,20 +138,20 @@ Schema: [
126138
stepKey: 'security',
127139
title: 'Security',
128140
nextStep: 'credentials',
129-
substep: 'Configuration'
141+
substepOf: 'Configuration'
130142
},{
131143
stepKey: 'credentials',
132144
title: 'Credentials',
133145
nextStep: 'summary',
134-
substep: 'Configuration'
146+
substepOf: 'Configuration'
135147
},{
136148
stepKey: 'summary',
137149
title: 'Summary'
138150
},
139151
]
140152
```
141153

142-
Progressive Wizard works same way. It checks if previous step has the same \`substep\` value and if so, it grouped them together.
154+
Progressive Wizard works same way. It checks if previous step has the same \`substepOf\` value and if so, it grouped them together.
143155
If the value is different, a new primary step is created with the step as a substep.
144156

145157
## First step
@@ -162,11 +174,13 @@ First step should have `stepKey: 1` or as a string: `'1'`
162174
- steps are visible as user visits them
163175
- user can jump only back
164176
- use `isDynamic` prop to enforce it
177+
- use `predictSteps` to allow navigation to show future steps
178+
- if you have any conditional fields in the step, you should use `disableForwardJumping` in the step definition, to disable jumping forward in the navigation, otherwise user could miss the changed fields in next steps.
165179

166180
![progressivewizard](https://user-images.githubusercontent.com/32869456/58427241-5b370a80-809f-11e9-8e79-a4a829b8d181.gif)
167181

168182
## Useful links
169183

170184
[PF4 wizard implementation](https://www.patternfly.org/v4/documentation/react/components/wizard/)
171185

172-
[Wizard design](https://www.patternfly.org/v4/design-guidelines/usage-and-behavior/wizard)
186+
[Wizard design](https://www.patternfly.org/v4/design-guidelines/usage-and-behavior/wizard)

0 commit comments

Comments
 (0)