Skip to content
On this page

Component: ContextMenu

It's easier using ContextMenu component if you don't need extra control of it.

Vue
<script setup>
import { ContextMenu } from '@contextmenu/vue'
</script>

<template>
  <ContextMenu>
    Place your context menu here.
  </ContextMenu>
</template>

Apply to specific target

Additionally, you can specify the target element as well as hook usage by passing options to the props.

vue
<script setup>
import { ContextMenu } from '@contextmenu/vue'
import { ref } from 'vue'
const target = ref(null)
</script>

<template>
  <div ref="target">
    right click on me
  </div>
  <ContextMenu :target="target">
    Place your context menu here.
  </ContextMenu>
</template>

DEMO

right click on me
You got me!

Released under the MIT License.