Delete
<DeleteButton>
uses Mantine's <Button>
and <Popconfirm>
components.
When you try to delete something, a pop-up shows up and asks for confirmation. When confirmed it executes the useDelete
method provided by your dataProvider
.
You can swizzle this component with the Refine CLI to customize it.
Usage
Properties
recordItemId
recordItemId
allows us to manage which record will be deleted. By default, recordItemId
is read from the route parameters.
Clicking the button will trigger the useDelete
method and then the record whose resource is "post" and whose id is "123" gets deleted.
resource
resource
allows us to manage which resource's record is going to be deleted. By default, resource
is read from the current route.
Clicking the button will trigger the useDelete
method and then the record whose resource is "categories" and whose id is "123" gets deleted.
If you have multiple resources with the same name, you can pass the identifier
instead of the name
of the resource. It will only be used as the main matching key for the resource, data provider methods will still work with the name
of the resource defined in the <Refine/>
component.
For more information, refer to the
identifier
of the<Refine/>
component documentation →
onSuccess
onSuccess
can be used if you want to do anything based on the result returned after the delete request.
For example, let's console.log
after deletion:
hideText
It is used to show and not show the text of the button. When true
, only the button icon is visible.