# useBlockDelete

Source: https://sdk.pdf.net/docs/v1/reference/useBlockDelete



Returns a function that deletes blocks of any kind (paragraphs, widgets, and other annotations) by id, one or several at once as a single undo step.

```ts
const deleteBlocks = useBlockDelete()

deleteBlocks(blockIds)
```

* Every id must identify an existing block, or the call throws `InvalidInputError` and deletes nothing; with no document loaded, it throws `DocumentNotLoadedError`.
* A deleted block is not necessarily gone forever: an undo can restore it.
* Deleting a widget doesn't erase its stored field value (see [Working with forms](https://sdk.pdf.net/docs/v1/guides/working-with-forms)).

To delete whatever the user selected instead of specific ids, see [useDeleteSelection](https://sdk.pdf.net/docs/v1/reference/useDeleteSelection).

