New Feature: Component Context Menu

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 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.

17 Likes

@mazeyrat :smile:

1 Like

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

image

2 Likes

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

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