Skip to content

Commit 40ed219

Browse files
committed
replace WizardFormStep by WizardForm.Step
1 parent 9330e7b commit 40ed219

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

docs/AuthRBAC.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,26 +1218,24 @@ const ProductCreate = () => (
12181218
```
12191219
{% endraw %}
12201220

1221-
### `<WizardFormStep>`
1221+
### `<WizardForm.Step>`
12221222

1223-
Replacement for the default `<WizardFormStep>` that only renders a step if the user has the right permissions.
1223+
Replacement for the default `<WizardForm.Step>` that only renders a step if the user has the right permissions.
12241224
Use it with `<WizardForm>` from `@react-admin/ra-enterprise` to only display the steps the user has access to in the stepper.
12251225

1226-
This component is provided by the `@react-admin/ra-enterprise` package.
1227-
1228-
Add a `name` prop to the `<WizardFormStep>` so you can reference it in the permissions.
1229-
Then, to allow users to access a particular `<WizardFormStep>`, update the permissions definition as follows: `{ action: 'write', resource: '{RESOURCE}.step.{NAME}' }`, where `RESOURCE` is the resource name, and `NAME` the name you provided to the `<WizardFormStep>`.
1226+
Add a `name` prop to the `<WizardForm.Step>` so you can reference it in the permissions.
1227+
Then, to allow users to access a particular `<WizardForm.Step>`, update the permissions definition as follows: `{ action: 'write', resource: '{RESOURCE}.step.{NAME}' }`, where `RESOURCE` is the resource name, and `NAME` the name you provided to the `<WizardForm.Step>`.
12301228

1231-
> For instance, to allow users access to the following tab `<WizardFormStep label="Description" name="description">` in `product` resource, add this line in permissions: `{ action: 'write', resource: 'products.step.description' }`.
1229+
> For instance, to allow users access to the following tab `<WizardForm.Step label="Description" name="description">` in `product` resource, add this line in permissions: `{ action: 'write', resource: 'products.step.description' }`.
12321230
1233-
`<WizardFormStep>` also only renders the child inputs for which the user has the 'write' permissions.
1231+
`<WizardForm.Step>` also only renders the child inputs for which the user has the 'write' permissions.
12341232

12351233
To learn more about the permissions format, please refer to the [`@react-admin/ra-rbac` documentation](https://marmelab.com/ra-enterprise/modules/ra-rbac).
12361234

12371235
{% raw %}
12381236
```tsx
12391237
import { Edit, TextInput } from 'react-admin';
1240-
import { WizardForm, WizardFormStep } from '@react-admin/ra-enterprise';
1238+
import { WizardForm } from '@react-admin/ra-enterprise';
12411239

12421240
const authProvider = {
12431241
// ...
@@ -1260,22 +1258,22 @@ const authProvider = {
12601258
const ProductCreate = () => (
12611259
<Create>
12621260
<WizardForm>
1263-
<WizardFormStep label="Description" name="description">
1261+
<WizardForm.Step label="Description" name="description">
12641262
<TextInput source="reference" />
12651263
<TextInput source="width" />
12661264
<TextInput source="height" />
12671265
// not displayed
12681266
<TextInput source="description" />
1269-
</WizardFormStep>
1270-
<WizardFormStep label="Images" name="images">
1267+
</WizardForm.Step>
1268+
<WizardForm.Step label="Images" name="images">
12711269
// not displayed
12721270
<TextInput source="image" />
12731271
<TextInput source="thumbnail" />
1274-
</WizardFormStep>
1272+
</WizardForm.Step>
12751273
// not displayed
1276-
<WizardFormStep label="Stock" name="stock">
1274+
<WizardForm.Step label="Stock" name="stock">
12771275
<TextInput source="stock" />
1278-
</WizardFormStep>
1276+
</WizardForm.Step>
12791277
</WizardForm>
12801278
</Create>
12811279
);

0 commit comments

Comments
 (0)