# New Feature: Component Context Menu

**URL:** <https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763>\
**Category:** Ignition Early Access\
**Tags:** perspective\
**Created:** [January 18, 2023, 11:03pm UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763 "2023-01-18T23:03:52Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [January 18, 2023, 11:03pm UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/1 "2023-01-18T23:03:52Z")

</div>

We've introduced a new concept to Perspective Components: a first-party context menu.

This context menu is configured within the props of each component, within `meta.contextMenu`. Each component's context menu is disabled by default, and may be enabled by setting the `meta.contextMenu.enabled` property. Each item (aside from Separator) also allows for configuring an icon to be displayed.

There are five types of items supported as of today:

1. Link
2. Message
3. Method
4. Separator
5. Submenu

**Link:**  
Allows for users to specify a link which will be navigated to when a user clicks this item. To specify Perspective project pages, provide the exact configured URL for that page, complete with the leading slash (`/someUrl/myPage`).

**Message:**  
Allows for calling of configured Message Handlers, including specification of a scope. The payload to be sent may be configured as part of this item object.

**Method:**  
Invokes a custom method of the component on which this context menu lives. You may configure arguments to be passed into this custom method with the `params` object. Please note that the keys entered here must match the exact kwargs specified in the custom method - though order within the param object does not matter; we do not support "positional" arguments via this route.

**Separator:**  
A general separator to keep categories of your context menu separate. This item only honors styling available to the `<hr>` HTML element. Please review [these docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hr) for more information.

**Submenu:**  
These items contain their own child items which again consist of the same available item types. Hovering over one of these items will result in a submenu appearing next to the current context menu or submenu.

 ![Screenshot 2023-01-17 at 3.08.02 PM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/2/c2eff345b240d509d5276ca01ae5714d78c2c78d.png)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 19, 2023, 12:09am UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/2 "2023-01-19T00:09:16Z")

</div>

@mazeyrat😄

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [January 19, 2023, 1:33am UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/3 "2023-01-19T01:33:49Z")

</div>

Very cool! This is a great addition, will this be in 8.1.25?

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [January 19, 2023, 7:38am UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/4 "2023-01-19T07:38:55Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/4/7431282a070180af9bd63e29ab93da6ef6f96c7d.jpeg)

---

<div class="post-metadata">

**Author:** ![Matthew.gaitan](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Matthew.gaitan](https://forum.inductiveautomation.com/u/Matthew.gaitan)\
**Post date:** [January 19, 2023, 3:42pm UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/5 "2023-01-19T15:42:38Z")

</div>

Thank you! This is a long awaited feature. Excited to try it out 😁

---

<div class="post-metadata">

**Author:** ![mmunin](https://avatars.discourse-cdn.com/v4/letter/m/c0e974/32.png) [@mmunin](https://forum.inductiveautomation.com/u/mmunin)\
**Post date:** [January 19, 2023, 6:07pm UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/6 "2023-01-19T18:07:06Z")

</div>

Excellent! Haven't installed a nightly build yet, but this is definitely a feature worth it.

I'll just mention in case the right person sees this but - these context menus as far as I know won't work on IOS for the reasons described by [this post](https://forum.inductiveautomation.com/t/triggering-oncontextmenu-events-from-the-perspective-ios-app/68638/2)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [January 27, 2023, 3:47pm UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/7 "2023-01-27T15:47:30Z")

</div>

> [@mmunin](#):
>
> won't work on IOS

As mentioned in that thread, mobile devices make use of the long-press event to trigger contextual menus, but that then causes a clash between which Event we would use to trigger this in general as we don't want the long-press Event to result in a context menu for desktop users. Additionally, we would need to change how the submenus work when it comes to mobile devices because mobile devices don't have a true concept of "hover".

All this to say that it's not impossible this could ever come to mobile devices - we could provide context menu functions just like we've done for the tooltip functionality, and we could make sure that submenus of context menus expand when users click on a submenu item - but this feature is not supported for mobile devices at this time.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [January 30, 2023, 4:51pm UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/8 "2023-01-30T16:51:57Z")

</div>

@mmunin we now have an open feature request to provide mobile users similar functionality. No ETA on when that will happen, but it's on our radar.

---

<div class="post-metadata">

**Author:** ![mmunin](https://avatars.discourse-cdn.com/v4/letter/m/c0e974/32.png) [@mmunin](https://forum.inductiveautomation.com/u/mmunin)\
**Post date:** [January 30, 2023, 5:40pm UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/9 "2023-01-30T17:40:02Z")

</div>

Great News! Do you have plans to implement something like `system.perspective.showContextMenu` similar to how it worked in vision?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [January 30, 2023, 6:11pm UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/10 "2023-01-30T18:11:18Z")

</div>

Unknown. At this time the ticket itself is to _discern_ how we will do it - and does not _define_ how we will do it. I did recommend a function of that name when the card was made, but there's no guarantee it will be the adopted approach.

---

<div class="post-metadata">

**Author:** ![ziad](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ziad/32/6841_2.png) [@ziad](https://forum.inductiveautomation.com/u/ziad)\
**Post date:** [February 21, 2023, 10:43pm UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/11 "2023-02-21T22:43:53Z")

</div>

Very exciting. I am trying to implement this, but having issues with Method. It works in Designer but in both Workstation and Browsers, I keep getting the error in the gateway log that the method does not exist. I just wrote a simple method called 'hello' with no parameters. The method just writes 'hello' to the console.

Here is the config:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/f/9fdd8a95da292d20af29c08b0b51f2efce476158.png)  
and on that label component, i have the following custom method  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/6/a6fe032a6ef8357dec010acab20ccb5b1840de5e.png)

Result in Designer (no entries on gateway logs)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/a/1a3d665a96624ba8c2c08c59657d93f465f21ccf.png)

But when triggered from workstation, safari, chrome (on both windows and mac laptops) with page refresh, project updates...etc. It doesn't write to the console and I get the following error.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/5/95cdfbab1c9e310bf3ea751b1ba455086818f4f7.png)

Am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 21, 2023, 11:02pm UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/12 "2023-02-21T23:02:02Z")

</div>

I have to ask the obvious question: did you save your work in the Designer before attempting this in a running session?

---

<div class="post-metadata">

**Author:** ![ziad](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ziad/32/6841_2.png) [@ziad](https://forum.inductiveautomation.com/u/ziad)\
**Post date:** [February 21, 2023, 11:16pm UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/13 "2023-02-21T23:16:20Z")

</div>

Fair question. But yes, absolutely. Changes to the menu were coming through as I saved. I started off with a more complex method and then started cutting it back 'hello'.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 22, 2023, 5:32pm UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/14 "2023-02-22T17:32:18Z")

</div>

Just so I can verify my own findings, what version/build are you using?

---

<div class="post-metadata">

**Author:** ![ziad](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ziad/32/6841_2.png) [@ziad](https://forum.inductiveautomation.com/u/ziad)\
**Post date:** [February 24, 2023, 9:21pm UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/15 "2023-02-24T21:21:33Z")

</div>

8.1.25 LTS from Download page. I don't have access to the gateway right this moment, but I'm pretty sure it was the Feb14 (or 16) version....

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 24, 2023, 10:22pm UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/16 "2023-02-24T22:22:45Z")

</div>

Interesting. I wasn't able to replicate in 8.1.25, but I WAS able to replicate in 8.1.26. We've opened a ticket to fix it as part of 8.1.26 but the root cause hasn't been made clear to me yet. What's also interesting is that (at least for me) custom methods put in place _before_ 8.1.26 continue to work as expected.

---

<div class="post-metadata">

**Author:** ![ziad](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ziad/32/6841_2.png) [@ziad](https://forum.inductiveautomation.com/u/ziad)\
**Post date:** [February 26, 2023, 5:41am UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/17 "2023-02-26T05:41:31Z")

</div>

That's very interesting indeed, thanks for investigating. Just to confirm that build, it was **8.1.25 (b2023021409)**

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [February 26, 2023, 10:11am UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/18 "2023-02-26T10:11:55Z")

</div>

> [@cmallonee](#):
>
> _define_

Is it possible to add new type for Embedded view support? There is a lot of crazy stuff we can do if we can pass a view for each item.

---

<div class="post-metadata">

**Author:** ![balbright](https://avatars.discourse-cdn.com/v4/letter/b/f0a364/32.png) [@balbright](https://forum.inductiveautomation.com/u/balbright)\
**Post date:** [February 27, 2023, 5:55pm UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/19 "2023-02-27T17:55:22Z")

</div>

I'm discovering that my previously configured onContextMenu events are no longer executing in 8.1.25. Is there any configuration changes required to make the new feature work in conjunction with existing onContextMenu events?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 27, 2023, 6:00pm UTC](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763/20 "2023-02-27T18:00:10Z")

</div>

No, previous onContextMenu events should not be impacted, and we have testing in place to make sure that the onContextMenu Event is still "fired" when a Context Menu is in place, regardless of the enabled state of the Context Menu. Could you provide some more insight into the previously-existing events (what they did) and also the Context Menu settings you have in place for the component in question?

An export of the View in question would be ideal.

[Next page](https://forum.inductiveautomation.com/t/new-feature-component-context-menu/68763.md?page=2)
