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
|`className`| Optional |`string`| - | Class name to customize the look and feel of the dialog itself |
63
+
|`title`| Required |`string`| - | Title of the dialog |
64
+
|`content`| Required |`ReactNode`| - | Body of the dialog |
65
+
|`onClose`| Required |`MouseEventHandler`| - | onClick event handler of the cancel button |
66
+
|`onConfirm`| Required |`MouseEventHandler`| - | onClick event handler of the confirm button |
56
67
|`isOpen`| Optional |`boolean`|`false`|`true` to show the dialog, `false` to hide it |
57
68
|`loading`| Optional |`boolean`|`false`| Boolean to be applied to the `disabled` prop of the action buttons |
58
-
|`content`| Required |`ReactNode`| - | Body of the dialog |
59
69
|`cancel`| Optional |`string`| 'ra.action.cancel' | Label of the cancel button |
60
70
|`confirm`| Optional |`string`| 'ra.action.confirm' | Label of the confirm button |
61
71
|`confirmColor`| Optional |`string`| 'primary' | Color of the confirm button |
62
72
|`ConfirmIcon`| Optional |`ReactElement`|`<CheckCircle/>`| Icon element of the confirm button |
63
73
|`CancelIcon`| Optional |`ReactElement`|`<ErrorOutlineIcon/>`| Icon element of the cancel button |
64
-
|`onClose`| Required |`MouseEventHandler`| - | onClick event handler of the cancel button |
65
-
|`onConfirm`| Required |`MouseEventHandler`| - | onClick event handler of the confirm button |
66
-
|`title`| Required |`string`| - | Title of the dialog |
67
74
|`translateOptions`| Optional |`{ id?: string, name?: string }`| {} | Custom id and name to be used in the dialog title |
68
75
|`sx`| Optional |`SxProps`| '' | MUI shortcut for defining custom styles with access to the theme |
69
76
@@ -79,3 +86,38 @@ The `<Confirm>` component accepts the usual `className` prop. You can also overr
79
86
|`& .RaConfirm-confirmWarning`| Applied to the confirm button when `confirmColor` is `warning`|
80
87
81
88
To override the style of all instances of `<Confirm>` using the [MUI style overrides](https://mui.com/customization/globals/#css), use the `RaConfirm` key.
89
+
90
+
## Delete With Confirmation
91
+
92
+
React-admin's `<DeleteButton>` lets user delete the current record [in an optimistic way](./Features.md#optimistic-updates-and-undo): after clicking the button, users see a notification for the deletion with an "undo" link to cancel the deletion.
93
+
94
+
Alternately, you can force the user to confirm the deletion by using `<DeleteButton mutationMode="pessimistic">`. Under the hood, this leverages the `<Confirm>` component to ask for confirmation before deleting the record.
The same goes for deleting multiple records in a [bulk action](./Datagrid.md#bulkactionbuttons): use `<BulkDeleteButton mutationMode="pessimistic">` to ask a confirmation before the deletion.
You can also implement the same `<ResetViewsButton>` behind a confirmation dialog by using the [`mutationMode`](./Edit.md#mutationmode) prop:
196
+
You can also implement the same `<ResetViewsButton>` behind a [confirmation dialog](./Confirm.md) by using the [`mutationMode`](./Edit.md#mutationmode) prop:
Copy file name to clipboardexpand all lines: docs/Edit.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -230,7 +230,7 @@ const PostEdit = () => (
230
230
231
231
**Tip**: When using any other mode than `undoable`, the `<DeleteButton>` displays a confirmation dialog before calling the dataProvider.
232
232
233
-
**Tip**: If you want a confirmation dialog for the Delete button but don't mind undoable Edits, then pass a [custom toolbar](./SimpleForm.md#toolbar) to the form, as follows:
233
+
**Tip**: If you want a [confirmation dialog](./Confirm.md) for the Delete button but don't mind undoable Edits, then pass a [custom toolbar](./SimpleForm.md#toolbar) to the form, as follows:
0 commit comments