# How to know if panel is in editing mode?

**URL:** <https://community.grafana.com/t/how-to-know-if-panel-is-in-editing-mode/39380>\
**Category:** General\
**Tags:** plugins\
**Created:** [November 18, 2020, 1:35am UTC](https://community.grafana.com/t/how-to-know-if-panel-is-in-editing-mode/39380 "2020-11-18T01:35:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandysansan](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/sandysansan/32/13715_2.png) [@sandysansan](https://community.grafana.com/u/sandysansan)\
**Post date:** [November 18, 2020, 1:35am UTC](https://community.grafana.com/t/how-to-know-if-panel-is-in-editing-mode/39380/1 "2020-11-18T01:35:48Z")

</div>

Hello 🙂  
I am creating a Custom Plugin Panel and I need to know when a panel is in editing mode.  
Some UI elements of this plugin have to be hidden in editing mode.  
I couldn’t find any help in documentation.

- I’ve read things about **AppEvents** but I didn’t manage to use it with React.
- I’ve also tried to use **document.location** (if it includes “panelEdit”) but it is not updated correctly, there is still one step behind.

Is there any way to retrieve this ?  
Thank you very much for your help!

Love Grafana \<3

---

<div class="post-metadata">

**Author:** ![agnestoulet1](https://avatars.discourse-cdn.com/v4/letter/a/dec6dc/32.png) [@agnestoulet1](https://community.grafana.com/u/agnestoulet1)\
**Post date:** [November 18, 2020, 1:41pm UTC](https://community.grafana.com/t/how-to-know-if-panel-is-in-editing-mode/39380/2 "2020-11-18T13:41:10Z")

</div>

Hello,

You can import `urlUtil` from `@grafana/data` and do something like this:

```auto
    const params = urlUtil.getUrlSearchParams();
    if (params.editPanel != null) {
        // In edit mode
    }

```

I used it once in grafana OSS and it should work for plugins too.

---

<div class="post-metadata">

**Author:** ![sandysansan](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/sandysansan/32/13715_2.png) [@sandysansan](https://community.grafana.com/u/sandysansan)\
**Post date:** [March 8, 2021, 11:47am UTC](https://community.grafana.com/t/how-to-know-if-panel-is-in-editing-mode/39380/3 "2021-03-08T11:47:43Z")

</div>

Thanks a lot agnestoulet1 for your answer. I keep the solution in mind, I’ve finally managed to design my plugin to not need this information.

---

<div class="post-metadata">

**Author:** ![sandyprolhac](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@sandyprolhac](https://community.grafana.com/u/sandyprolhac)\
**Post date:** [September 14, 2023, 4:30pm UTC](https://community.grafana.com/t/how-to-know-if-panel-is-in-editing-mode/39380/4 "2023-09-14T16:30:52Z")

</div>

More than 2 years later, I was faced with this situation again! 😂  
I’ve found at last something clean :

```auto
import { locationService } from '@grafana/runtime';
const isEditing = locationService.getSearchObject().editPanel !== undefined;

```

If the panel is currently editing, isEditing will be a number, otherwise it will be undefined.
