@dslab/ra-delete-dialog-button
v1.0.0
Published
[![Version](https://img.shields.io/npm/v/@dslab/ra-delete-confirm.svg)](https://www.npmjs.com/package/@dslab/ra-delete-confirm) [![Documentation](https://img.shields.io/badge/documentation-yes-brightgreen.svg)](https://github.com/smartcommunitylab/react-a
Downloads
27
Readme
React-Admin `Delete with confirm`` dialog
Delete with confirm dialog for React-Admin, to render a nested field in the record to match as confirmation before performing deletion. Supports validation on user input match against resource id. Uses MUIv5 as ui library.
Install
yarn install @dslab/ra-delete-confirm
Usage
To use in an show/edit context, where the record is available, include the component as any other button in list or toolbar actions.
The list of optional parameters are
confirmTitle="Resource title"
mutationOptions="optional API query parameters"
redirect="url to redirect after deletion"
The list could be implemented like the following.
export const AppList = () => {
const params = useParams();
const options = { meta: { realmId: params.realmId } };
useListContext<any>();
return (
<>
<List>
<Datagrid bulkActionButtons={false}>
<DeleteButtonDialog
mutationOptions={options}
confirmTitle="Resource Deletion"
redirect={`/apps/r/${params.id}`}
/>
</Datagrid>
</List>
</>
);
};
Screenshot for the resulting form
Author
SmartCommunityLab
- Website: http://www.smartcommunitylab.it/
- Github: @smartcommunitylab
Show your support
Give a ⭐️ if this project helped you!
License
Copyright © 2023 SmartCommunityLab. This project is MIT licensed.