Basic demos

Demo 1

On instantiation, the context menu is given a selector of elements where it will be triggered.

In this example, it will open anywhere inside the box on right click.

Right click anywhere inside this box

View the code

Demo 2

You can also trigger the context menu to different events, and position it relative to the element where it was triggered.

View the code

Advanced demos

Demo 3

The onClick listeners can be aware of which one of a set of elements was clicked.

# Name Description
1 First row Lorem ipsum dolor sit amet
2 Second row Nemo enim ipsam voluptatem quia voluptas
3 Third row Ut enim ad minima veniam

View the code

Demo 4

You can give every action an id and group them in the dropdown with the actionsGroups option. You can also use isShown and isEnabled callbacks in an action to control when it should not appear, or appear disabled.

Font Awesome icons can be used adding the iconClass property to an action, with the class name of the icon to use.

# Name Description
1 First row Lorem ipsum dolor sit amet
2 Second row Nemo enim ipsam voluptatem quia voluptas Not editable
3 Third row Ut enim ad minima veniam Not deletable

View the code

Demo 5

Classes can also be added easily to an action by setting a classNames property, which will be parsed through the classnames utility. This property can be a string, an object or a function that receives the element's fetched data as a first argument.

In the same way, an action's name can be defined as a function. In that case, it will be called before each render of the menu, receiving as the first argument the data returned by fetchElementData.

# Name Description
1 John Martin Lorem ipsum dolor sit amet
2 Peter Roberts Nemo enim ipsam voluptatem quia voluptas
3 Stuart Smith Ut enim ad minima veniam Not editable

View the code