You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`authLoading`| Optional |`ReactNode`| - | The component to display while checking for authentication |
61
+
|`children`| Optional *|`ReactNode`| - | The components that render the form |
62
+
|`render`| Optional *|`function`| - | Alternative to children. Function that renders the form, receives the create context as argument |
63
+
|`actions`| Optional |`ReactNode`| Default toolbar | Override the actions toolbar with a custom component |
64
+
|`aside`| Optional |`ReactNode`| - | Component to render aside to the main content |
65
+
|`className`| Optional |`string`| - | Passed to the root component |
66
+
|`component`| Optional |`string`/`Component`|`Card`| Override the root component |
67
+
|`disableAuthentication`| Optional |`boolean`|`false`| Disable the authentication check |
68
+
|`mutationMode`| Optional |`string`|`pessimistic`| Switch to optimistic or undoable mutations |
69
+
|`mutationOptions`| Optional |`object`| - | Options for the `dataProvider.create()` call |
70
+
|`record`| Optional |`object`|`{}`| Initialize the form with a record |
71
+
|`redirect`| Optional |`string`/`function`|`'edit'`| Change the redirect location after successful creation |
72
+
|`resource`| Optional |`string`| From URL | Override the name of the resource to create |
73
+
|`sx`| Optional |`object`| - | Override the styles |
74
+
|`title`| Optional |`string`/`ReactNode`| Translation | Override the page title |
75
+
|`transform`| Optional |`function`| - | Transform the form data before calling `dataProvider.create()`|
75
76
76
77
`*` You must provide either `children` or `render`.
77
78
@@ -125,6 +126,20 @@ const PostCreate = () => (
125
126
126
127
{% endraw %}
127
128
129
+
## `authLoading`
130
+
131
+
By default, `<Create>` renders the children while checking for authentication and permissions. You can display a component during this time via the `authLoading` prop:
132
+
133
+
```jsx
134
+
import { Create } from'react-admin';
135
+
136
+
exportconstPostCreate= () => (
137
+
<Create authLoading={<p>Checking for permissions...</p>}>
138
+
...
139
+
</Create>
140
+
);
141
+
```
142
+
128
143
## `children`
129
144
130
145
The `<Create>` component will render its children inside a [`CreateContext`](./useCreateContext.md#return-value). Children can be any React node, but are usually a form component like [`<SimpleForm>`](./SimpleForm.md), [`<TabbedForm>`](./TabbedForm.md), or the headless [`<Form>`](./Form.md) component.
You can customize the `<CreateBase>` component using the following props:
42
42
43
+
*[`authLoading`](#authloading): the component to display while checking for authentication
43
44
*[`children`](#children): the components that renders the form
44
45
*[`render`](#render): alternative to children, a function that takes the `CreateController` context and renders the form
45
46
*[`disableAuthentication`](#disableauthentication): disable the authentication check
@@ -50,6 +51,20 @@ You can customize the `<CreateBase>` component using the following props:
50
51
*[`resource`](#resource): override the name of the resource to create
51
52
*[`transform`](#transform): transform the form data before calling `dataProvider.create()`
52
53
54
+
## `authLoading`
55
+
56
+
By default, `<CreateBase>` renders the children while checking for authentication and permissions. You can display a component during this time via the `authLoading` prop:
57
+
58
+
```jsx
59
+
import { CreateBase } from'ra-core';
60
+
61
+
exportconstPostCreate= () => (
62
+
<CreateBase authLoading={<p>Checking for permissions...</p>}>
63
+
...
64
+
</CreateBase>
65
+
);
66
+
```
67
+
53
68
## `children`
54
69
55
70
The `<CreateBase>` component will render its children inside a [`CreateContext`](./useCreateContext.md#return-value). Children can be any React node, but are usually a form component like the headless [`<Form>`](./Form.md) component.
0 commit comments