react-gauge-component is a customizable React component designed for displaying gauge charts, often used for data visualization like speedometers or Grafana-style gauges. The current stable version is 2.0.28, with frequent patch and minor updates within the 2.x series. It was forked from `@Martin36/react-gauge-chart` and significantly re-architected in its v2 release to provide enhanced customization options and modern React compatibility. Key differentiators include robust TypeScript support, a flexible API for segment and value rendering, and an online sandbox editor for easy configuration. It requires React 16.8.2 or newer as a peer dependency, ensuring broad compatibility with contemporary React ecosystems.
npm install react-gauge-componentVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates installing the package and rendering a basic gauge component with custom colored arcs, a value, and a formatted label.
Refer to the official API documentation for v2.x (API.md on GitHub) and the demo page to update component props and structure. The core API for `arc`, `value`, and `labels` has changed.
Use dynamic imports with `ssr: false` (e.g., `const GaugeComponent = dynamic(() => import('react-gauge-component'), { ssr: false });`) to ensure the component is only loaded on the client-side.Ensure your project's `react` and `react-dom` versions satisfy the peer dependency requirements (`^16.8.2 || ^17.0 || ^18.x || ^19.x`). Use `npm install` or `yarn install` to resolve peer dependency warnings.
For Next.js, use `const GaugeComponent = dynamic(() => import('react-gauge-component'), { ssr: false });`. For other SSR frameworks, ensure the component is only loaded client-side.This is often related to SSR issues. Apply dynamic import with `ssr: false` as described in the warnings. Also, ensure React and React-DOM peer dependencies are correctly installed and compatible.
Check for duplicate React installations using `npm ls react` or `yarn why react`. Ensure `react` and `react-dom` peer dependencies are met and are singular in your dependency tree. Re-evaluate any custom rendering logic around the gauge component.