---
title: useDesktopPointInput
description: "Routes desktop pointer events by coordinates."
---

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

useDesktopPointInput({
  enabled: playing,
  onClick: ({ x, y }) => selectAt({ x, y }),
  onRightClick: ({ x, y }) => flagAt({ x, y }),
  onDrag: (event) => handleDrag(event),
});
```

Use this hook to route input by coordinates instead of by file. Each subscription is active only while `enabled` is true and its handler is set. Handlers can change on every render without resubscribing.

## Options

| Prop | Type | Default | Description |
| - | - | - | - |
| `enabled?` | `boolean` | - | Turns all subscriptions on or off. Default true. |
| `onClick?` | `((point: DesktopPoint) => void)` | - | Receives { x, y, target? }. |
| `onRightClick?` | `((point: DesktopPoint) => void)` | - | Receives { x, y, target? }. |
| `onDrag?` | `((event: DesktopDragEvent) => void)` | - | Receives { phase: 'start' \| 'move' \| 'end', x, y }. |

## Returns

Nothing (`void`).
