Skip to content

Installation

Terminal window
npm install grafana-react react@19 tsx@4

Or with other package managers:

Terminal window
# pnpm
pnpm add grafana-react react@19 tsx@4
# yarn
yarn add grafana-react react@19 tsx@4
# bun
bun add grafana-react react@19 tsx@4
  • Node.js 18 or later
  • React 19
  • tsx 4 (for CLI)

Create a simple dashboard file to verify the installation:

test-dashboard.dashboard.tsx
import { Dashboard, Row, Stat } from 'grafana-react';
export default function TestDashboard() {
return (
<Dashboard uid="test" title="Test Dashboard" datasource="prometheus">
<Row title="Test">
<Stat title="Test Metric">up</Stat>
</Row>
</Dashboard>
);
}

Build it:

Terminal window
npx grafana-react build test-dashboard.dashboard.tsx

If successful, you’ll see the JSON output printed to stdout (or written to a file if you specify an output path).