Skip to content

Commit

Permalink
Updated documentation for Confirm component
Browse files Browse the repository at this point in the history
  • Loading branch information
asvarcas committed Oct 14, 2019
1 parent f6bf801 commit 379e539
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/List.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ export default ResetViewsButton;

**Tip**: `<Confirm>` text props such as `title` and `content` are translatable. You can pass use translation keys in these props.

**Tip**: You can customize the text of the two `<Confirm>` component buttons using the `cancel` and `confirm` prop which accepts translation keys too.
**Tip**: You can customize the text and icon of the two `<Confirm>` component buttons using the `cancel` and `confirm` prop which accepts translation keys too and the `ConfirmIcon` and `CancelIcon` prop which accepts a SvgIcon type.

**Tip**: React-admin doesn't use the `<Confirm>` component internally, because deletes and updates are applied locally immediately, then dispatched to the server after a few seconds, unless the user chooses to undo the modification. That's what we call optimistic rendering. You can do the same for the `ResetViewsButton` by setting `undoable: true` in the last argument of `useUpdateMany()`, as follows:

Expand Down
2 changes: 2 additions & 0 deletions packages/ra-ui-materialui/src/layout/Confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ const useStyles = makeStyles(theme => ({
* content="Are you sure you want to delete this item?"
* confirm="Yes"
* confirmColor="primary"
* ConfirmIcon=ActionCheck
* CancelIcon=AlertError
* cancel="Cancel"
* onConfirm={() => { // do something }}
* onClose={() => { // do something }}
Expand Down

0 comments on commit 379e539

Please sign in to comment.