---
title: useDesktopMetrics
description: "Subscribes to desktop metrics in state and a ref."
---

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

const { metrics, metricsRef } = useDesktopMetrics();
```

Wait for `metrics?.calibrated` before positioning content. This hook only subscribes; it does not change view settings or reveal the desktop.

## Options

| Prop | Type | Default | Description |
| - | - | - | - |
| `initial?` | `SystemMetrics` | - | Initial value for both metrics and metricsRef. |
| `transform?` | `((metrics: SystemMetrics) => SystemMetrics)` | - | Transforms incoming metrics before storing them. |
| `onMetrics?` | `((metrics: SystemMetrics) => void)` | - | Called after each metrics update, with the transformed value. |
| `host?` | `DesktopHost` | - | Optional host adapter for tests. |

## Returns

`metrics: SystemMetrics | null` drives renders. `metricsRef` mirrors it for event and timer callbacks.
