On this page

Context menu

Install, props and the parts Context menu is built from.

Install

Run this in the app, after shadcn-vue init and the Beehexa theme (Button › Code):

npx shadcn-vue@latest add https://beehexa.design/r/context-menu.json

Use

<script setup lang="ts">
import {
  ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuSeparator, ContextMenuTrigger,
} from '@/components/ui/context-menu'
</script>

<template>
  <ContextMenu>
    <ContextMenuTrigger as-child>
      <div tabindex="0">Orders to ERP</div>
    </ContextMenuTrigger>
    <ContextMenuContent>
      <ContextMenuItem>Duplicate</ContextMenuItem>
      <ContextMenuSeparator />
      <ContextMenuItem variant="destructive">Delete</ContextMenuItem>
    </ContextMenuContent>
  </ContextMenu>
</template>

Props

Part Prop Values Notes
ContextMenuTrigger disabled boolean Shows the browser’s own menu instead
ContextMenuItem variant default, destructive Danger text and icon
ContextMenuItem, ContextMenuLabel, ContextMenuSubTrigger inset boolean Lines the text up with items that have an icon
ContextMenuItem disabled boolean Skipped by the arrow keys
ContextMenuItem @select event Runs the action. @select.prevent keeps the menu open
ContextMenuCheckboxItem v-model boolean On or off
ContextMenuRadioGroup v-model string The chosen ContextMenuRadioItem value
ContextMenuCheckboxItem, ContextMenuRadioItem slot indicator-icon Replaces the check

Built on

The reka-ui ContextMenu, with the shadcn-vue ContextMenu API. reka-ui gives the menu roles, long-press on touch, focus handling, typeahead and sub-menu keys. Beehexa adds the Dropdown menu styles.