---
title: useDesktopDrag
description: "Reports a file position after dragging."
---

```tsx
import { useDesktopDrag } from 'filedom';

useDesktopDrag(path, (position) => handleDrop(position));
```

For a sprite, use its [`onDragged`](/docs/reference/components/sprite#props) prop instead.

## Parameters

```ts
useDesktopDrag(
  path: string | undefined,
  onDragged?: ((position: IconPosition) => void)
)
```

`path`: filesystem path to watch. Undefined disables the subscription.

`onDragged`: optional handler that receives the file's new `{ x, y }` position. Omit it to disable the subscription.

## Returns

Nothing (`void`).
