--- title: Advanced Usage sort: 2 --- ## Scoped Slot To pass any data from the `contextmenu` event to your template, you can pass it as the second parameter of the `open` event and access it within a [scoped slot](https://vuejs.org/v2/guide/components.html#Scoped-Slots) under the `data` property. `$event` **must be passed as the first parameter**, otherwise the context menu will not function properly. ```html ``` ## Props There are many props available on the context menu. Some of them include: - `closeOnClick` - `closeOnScroll` - `lazy` - `itemSelector` - `role` - `tag` All props are optional. It is **not recommended** to use anything other than `ul` as a value for the tag property. If you do choose a different tag, be sure to update the `itemSelector` prop accordingly to ensure proper keyboard navigation can be used and the accessiblity attributes can be added to each menu item. ```html ``` See [the api](/docs/vue-context/v6/api/api) for more information on props. ## Events There are two events emitted by the context menu: - `close` - `open` The `close` event receives no parameters and is emitted when the context menu is closed. The `open` event is emitted when the context menu is shown and receives the following parameters: - `event`: The event that triggered the menu opening - `data`: Any data passed to the menu from the trigger element. - `top`: The top (y) position of the menu. - `left`: The left (x) position of the menu. ```html ``` ## Left Click If you want to use a _left_ click to open the menu instead, just replace `@contextmenu.prevent` with `@click.prevent` as your event listener. If you have issues with the menu closing right after you click on your target element, you probably just need to append the `stop` modifier onto the click event. See [issue #14](https://github.com/rawilk/vue-context/issues/14) for more information. ```html ``` ## Nested Menus Nested context menus are possible by adding the class `v-context__sub` to a child `
  • ` element in the menu. Inside the `v-context__sub` element a new container (e.g. a `