Installation
Install from npm
Section titled “Install from npm”npm install grafana-react react@19 tsx@4Or with other package managers:
# pnpmpnpm add grafana-react react@19 tsx@4
# yarnyarn add grafana-react react@19 tsx@4
# bunbun add grafana-react react@19 tsx@4Requirements
Section titled “Requirements”- Node.js 18 or later
- React 19
- tsx 4 (for CLI)
Verify Installation
Section titled “Verify Installation”Create a simple dashboard file to verify the installation:
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:
npx grafana-react build test-dashboard.dashboard.tsxIf successful, you’ll see the JSON output printed to stdout (or written to a file if you specify an output path).