How to get dashboard variables from reactJs plugin?


How to get dashboard variables from reactJs plugin? Is there any solution for this topic?

This may help Variables Support Custom React-based Datasource Plugin

Hello @adriang,

I also have searched on how to get dashboard object from ReactJS plugin some time ago.
It was mentioned react part is in active development in Grafana right now.
The only way I have found is by debug info:

const dashboard = this._reactInternalFiber._debugOwner.[REPEAT _debugOwner if needed].stateNode.props.dashboard; 


Thanks for the help.

It took me some time, but I found a function in the PanelProps interface to read dashboard variable values. The function I’m talking about is replaceVariables.

Its use is as follows:

import React, { PureComponent } from ‘react’;
import { PanelProps } from ‘@grafana/data’;
import { SimpleOptions } from ‘types’;

interface Props extends PanelProps {}

export class SimplePanel extends PureComponent {
render() {
const { replaceVariables } = this.props;

return (
    { replaceVariables('$var_name') }


1 Like