> For the complete documentation index, see [llms.txt](https://creatorlabs.gitbook.io/boltui-docs-preview/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://creatorlabs.gitbook.io/boltui-docs-preview/api-reference/index/onremove.md).

# onRemove

### Definition

```javascript
function onRemove(component: HTMLElement, callback: function) {
    return HTMLElement
}
```

### Input

* `component` : the reference to a valid bolt app, a bolt functional component or a valid bold variable component
* `callback` : the function to run when the component is removed from the DOM

### Returns HTMLElement

The component will return after registering the callback which will be invoked when the component is removed
