@dslab/ra-delete-dialog-button
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

React-Admin `Delete with confirm`` dialog

Version Documentation Maintenance License: MIT

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

Form screenshot

Author

SmartCommunityLab

Show your support

Give a ⭐️ if this project helped you!

License

Copyright © 2023 SmartCommunityLab.
This project is MIT licensed.

Readme

Keywords

none

Package Sidebar

Install

npm i @dslab/ra-delete-dialog-button

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

34 kB

Total Files

20

Last publish

Collaborators

  • dslab