DevHUD
The main wrapper component that enables performance monitoring. Renders a floating HUD overlay in development and passes children through unchanged in production.
Import
tsx
import { DevHUD } from "react-performance-monitoring"Usage
tsx
<DevHUD>
<App />
</DevHUD>Props
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
children | ReactNode | — | Yes | Your app or root component |
position | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top-right" | No | HUD overlay position |
theme | "light" | "dark" | "dark" | No | Visual theme |
trackNetwork | boolean | true | No | Enable network tracking (fetch + optional axios) |
trackLongTasks | boolean | true | No | Enable long-task monitoring |
trackFPS | boolean | true | No | Enable FPS sampling |
sessionTimeout | number | 2000 | No | Inactivity timeout (ms) before session closes |
forceEnabled | boolean | false | No | Show HUD regardless of NODE_ENV. Use for deployed demos/previews. |
Behavior
- Collapsible: Click × to fully collapse the panel; a small "RPM" tab remains to re-open it.
- Repositionable: Use the corner icons in the panel header to move the HUD to any corner at runtime.
- Dev-only: When
NODE_ENV === "production"andforceEnabledis not set,DevHUDrenders onlychildren; no overlay or trackers are mounted. - SSR-safe: If
windowis undefined (e.g. during SSR), it behaves as in production. - Profiler wrapper: Children are wrapped in a React
Profilerso render timings are captured. - Portal: The HUD is rendered via
createPortalinto a dedicated container ([data-rpm-root]) appended todocument.body.
TypeScript
tsx
import type { DevHUDProps } from "react-performance-monitoring"