Module @grafana/ui/components/legends/legends building failed

I’m trying to develop a simple panel. Everything works fine except when I try to import the ‘Legend’ component. I get the following error:

Other imports like 'import {…} from ‘@grafana/ui/components/Graph/GraphWithLegend’ work. My package.json has the @grafana ui, data, toolkit in 7.0.0.

Can somebody help me please?


Hi, you need to import LegendList or LegendTable component:

Hi! I tried to import LegendList or Legendtable and it didn’t work :frowning: Im importing:

import { LegendDisplayMode } from ‘@grafana/ui/components/Legend/Legend’;

so I can import displayMode={LegendDisplayMode.List} but the error above appears…

All the imports should be from @grafana/ui instead from the source files:

import { LegendDisplayMode } from ‘@grafana/ui’;
1 Like

Thank you very much! It worked :smile: