# Button not working

**URL:** <https://community.grafana.com/t/button-not-working/78147>\
**Category:** Grafana Plugin Development\
**Created:** [December 16, 2022, 5:44am UTC](https://community.grafana.com/t/button-not-working/78147 "2022-12-16T05:44:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sztibi82](https://avatars.discourse-cdn.com/v4/letter/s/67e7ee/32.png) [@sztibi82](https://community.grafana.com/u/sztibi82)\
**Post date:** [December 16, 2022, 5:44am UTC](https://community.grafana.com/t/button-not-working/78147/1 "2022-12-16T05:44:46Z")

</div>

Hi All,

I am new into Grafana. I created a custom plugin on which I have a Button. The project compiles without issues, and the button appears on the panel, but no click event is handled

Please find below the source code  
import React from ‘react’;  
import { PanelProps } from ‘@grafana/data’;  
import { SimpleOptions } from ‘types’;  
import { css, cx } from ‘@emotion/css’;  
import { Button, useStyles2, useTheme2 } from ‘@grafana/ui’;

interface Props extends PanelProps {}

const getStyles = () =\> {  
return {  
wrapper: css` font-family: Open Sans; position: relative; `,  
svg: css` position: absolute; top: 0; left: 0; `,  
textBox: css` position: absolute; bottom: 0; left: 0; padding: 10px; `,  
hover:css` background-color: rgba(255, 0, 0, 1); `,  
active:css` background-color: rgba(255, 255, 0, 1); `,  
};  
};

export const SimplePanel: React.FC = ({ options, data, width, height }) =\> {  
const theme = useTheme2();

const styles = useStyles2(getStyles);  
return (  
\<div  
className={cx(  
styles.wrapper,  
css` width: ${width}px; height: ${height}px; `  
)}  
\>  
\<svg  
className={styles.svg}  
width={width}  
height={height}  
xmlns=“[SVG namespace](http://www.w3.org/2000/svg)”  
xmlnsXlink=“[XLink namespace](http://www.w3.org/1999/xlink)”  
viewBox={`-${width / 2} -${height / 2} ${width} ${height}`}  
\>  
  
\<circle style={{ fill: theme.colors.primary.main }} r={100} /\>

```
  <div className={styles.textBox}>
    {options.showSeriesCount && <div>Number of series: {data.series.length}</div>}
    <div>Text option value: {options.text}</div>
  </div>
  <Button onClick={()=>console.log("test")}>TestButton</Button>
</div>

```

);  
};

I also changed in the defaults.ini the disable\_sanitize\_html = true but the problem didn’t get solved.

Please can you advice what to do next.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/grafana/original/2X/e/ef5308cc58c9e5a13187b5012eb99f406928462f.png) [@system](https://community.grafana.com/u/system)\
**Post date:** [December 16, 2023, 5:45am UTC](https://community.grafana.com/t/button-not-working/78147/2 "2023-12-16T05:45:24Z")

</div>

Closed on December 16, 2023, 5:45am UTC

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
