---
title: Trash Bin
description: A recycle bin that lists, restores and permanently purges soft-deleted files — driven by useFiles and the softDelete plugin.
---

Lists soft-deleted objects and restores or permanently purges them. Backed by the [`softDelete()`](/plugins/soft-delete) plugin, so it needs a gateway whose `Files` instance is wrapped with it and whose `authorize` allow-lists the `trashed`, `restoreTrashed` and `purge` operations. Purges confirm first — they're the only way the bytes actually leave storage.

<ComponentPreview name="trash-bin/trash-bin-basic" />

## Installation

<ComponentInstall name="trash-bin" />

## Usage

```tsx lineNumbers
import { useFiles } from "files-sdk/react";

import { TrashBin } from "@/components/files-sdk/trash-bin";

export function Trash() {
  const files = useFiles({ endpoint: "/api/files" });

  return <TrashBin files={files} />;
}
```

The gateway must expose the plugin verbs:

```ts
createFilesRouter({
  files: createFiles({ adapter, plugins: [softDelete()] }),
  operations: ["trashed", "restoreTrashed", "purge"],
});
```

Under a multi-tenant `authorize` `keyPrefix`, the listing and "empty trash" are scoped to the caller's own keys — purging never reaches another tenant's trash.

## Props

<AutoTypeTable
  path="registry/files-sdk/trash-bin/trash-bin.tsx"
  name="TrashBinProps"
/>
