@primevue/mcp 4.5.5 → 5.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/LICENSE.md +45 -21
  2. package/README.md +48 -250
  3. package/data/components.json +47269 -0
  4. package/data/llms/components/accordion.md +629 -0
  5. package/data/llms/components/animateonscroll.md +165 -0
  6. package/data/llms/components/autocomplete.md +995 -0
  7. package/data/llms/components/avatar.md +264 -0
  8. package/data/llms/components/badge.md +200 -0
  9. package/data/llms/components/blockui.md +99 -0
  10. package/data/llms/components/breadcrumb.md +269 -0
  11. package/data/llms/components/button.md +902 -0
  12. package/data/llms/components/card.md +209 -0
  13. package/data/llms/components/carousel.md +506 -0
  14. package/data/llms/components/cascadeselect.md +1207 -0
  15. package/data/llms/components/chart.md +1022 -0
  16. package/data/llms/components/checkbox.md +401 -0
  17. package/data/llms/components/chip.md +206 -0
  18. package/data/llms/components/colorpicker.md +213 -0
  19. package/data/llms/components/commandmenu.md +660 -0
  20. package/data/llms/components/compare.md +407 -0
  21. package/data/llms/components/confirmdialog.md +343 -0
  22. package/data/llms/components/confirmpopup.md +252 -0
  23. package/data/llms/components/contextmenu.md +522 -0
  24. package/data/llms/components/datatable.md +5266 -0
  25. package/data/llms/components/dataview.md +569 -0
  26. package/data/llms/components/datepicker.md +964 -0
  27. package/data/llms/components/deferredcontent.md +96 -0
  28. package/data/llms/components/dialog.md +702 -0
  29. package/data/llms/components/divider.md +152 -0
  30. package/data/llms/components/dock.md +488 -0
  31. package/data/llms/components/drawer.md +469 -0
  32. package/data/llms/components/dynamicdialog.md +214 -0
  33. package/data/llms/components/editor.md +205 -0
  34. package/data/llms/components/fieldset.md +253 -0
  35. package/data/llms/components/fileupload.md +459 -0
  36. package/data/llms/components/floatlabel.md +144 -0
  37. package/data/llms/components/fluid.md +104 -0
  38. package/data/llms/components/focustrap.md +59 -0
  39. package/data/llms/components/forms.md +344 -0
  40. package/data/llms/components/galleria.md +1119 -0
  41. package/data/llms/components/gallery.md +1003 -0
  42. package/data/llms/components/iconfield.md +283 -0
  43. package/data/llms/components/iftalabel.md +96 -0
  44. package/data/llms/components/image.md +179 -0
  45. package/data/llms/components/imagecompare.md +108 -0
  46. package/data/llms/components/inplace.md +183 -0
  47. package/data/llms/components/inputcolor.md +869 -0
  48. package/data/llms/components/inputgroup.md +419 -0
  49. package/data/llms/components/inputmask.md +345 -0
  50. package/data/llms/components/inputnumber.md +551 -0
  51. package/data/llms/components/inputotp.md +345 -0
  52. package/data/llms/components/inputpassword.md +738 -0
  53. package/data/llms/components/inputtags.md +432 -0
  54. package/data/llms/components/inputtext.md +569 -0
  55. package/data/llms/components/installation.md +1 -0
  56. package/data/llms/components/keyfilter.md +116 -0
  57. package/data/llms/components/knob.md +318 -0
  58. package/data/llms/components/label.md +151 -0
  59. package/data/llms/components/laravel.md +53 -0
  60. package/data/llms/components/listbox.md +636 -0
  61. package/data/llms/components/mask.md +203 -0
  62. package/data/llms/components/mcp.md +39 -0
  63. package/data/llms/components/megamenu.md +563 -0
  64. package/data/llms/components/menu.md +651 -0
  65. package/data/llms/components/menubar.md +446 -0
  66. package/data/llms/components/message.md +497 -0
  67. package/data/llms/components/metergroup.md +281 -0
  68. package/data/llms/components/multiselect.md +752 -0
  69. package/data/llms/components/orderlist.md +224 -0
  70. package/data/llms/components/organizationchart.md +418 -0
  71. package/data/llms/components/paginator.md +221 -0
  72. package/data/llms/components/panel.md +321 -0
  73. package/data/llms/components/panelmenu.md +703 -0
  74. package/data/llms/components/password.md +657 -0
  75. package/data/llms/components/picklist.md +286 -0
  76. package/data/llms/components/popover.md +145 -0
  77. package/data/llms/components/progressbar.md +242 -0
  78. package/data/llms/components/progressspinner.md +104 -0
  79. package/data/llms/components/radiobutton.md +427 -0
  80. package/data/llms/components/rating.md +312 -0
  81. package/data/llms/components/ripple.md +91 -0
  82. package/data/llms/components/scrollarea.md +700 -0
  83. package/data/llms/components/scrollpanel.md +131 -0
  84. package/data/llms/components/scrolltop.md +87 -0
  85. package/data/llms/components/select.md +1251 -0
  86. package/data/llms/components/selectbutton.md +268 -0
  87. package/data/llms/components/sidebar.md +2232 -0
  88. package/data/llms/components/skeleton.md +302 -0
  89. package/data/llms/components/slider.md +416 -0
  90. package/data/llms/components/speeddial.md +402 -0
  91. package/data/llms/components/splitbutton.md +840 -0
  92. package/data/llms/components/splitter.md +447 -0
  93. package/data/llms/components/stepper.md +551 -0
  94. package/data/llms/components/styleclass.md +226 -0
  95. package/data/llms/components/tabs.md +609 -0
  96. package/data/llms/components/tag.md +178 -0
  97. package/data/llms/components/terminal.md +123 -0
  98. package/data/llms/components/textarea.md +519 -0
  99. package/data/llms/components/tieredmenu.md +578 -0
  100. package/data/llms/components/timeline.md +494 -0
  101. package/data/llms/components/toast.md +472 -0
  102. package/data/llms/components/togglebutton.md +276 -0
  103. package/data/llms/components/toggleswitch.md +271 -0
  104. package/data/llms/components/toolbar.md +140 -0
  105. package/data/llms/components/tooltip.md +160 -0
  106. package/data/llms/components/tree.md +1076 -0
  107. package/data/llms/components/treeselect.md +660 -0
  108. package/data/llms/components/treetable.md +2493 -0
  109. package/data/llms/components/virtualscroller.md +265 -0
  110. package/data/llms/guides/autoimport.md +28 -0
  111. package/data/llms/guides/cdn.md +72 -0
  112. package/data/llms/guides/configuration.md +158 -0
  113. package/data/llms/guides/customicons.md +67 -0
  114. package/data/llms/guides/guides/accessibility.md +27 -0
  115. package/data/llms/guides/guides/animations.md +119 -0
  116. package/data/llms/guides/guides/rtl.md +7 -0
  117. package/data/llms/guides/icons.md +136 -0
  118. package/data/llms/guides/installation.md +3 -0
  119. package/data/llms/guides/laravel.md +66 -0
  120. package/data/llms/guides/llms.md +15 -0
  121. package/data/llms/guides/mcp.md +104 -0
  122. package/data/llms/guides/migration/v4.md +15 -0
  123. package/data/llms/guides/migration/v5.md +15 -0
  124. package/data/llms/guides/nuxt.md +141 -0
  125. package/data/llms/guides/passthrough.md +137 -0
  126. package/data/llms/guides/primeclt.md +43 -0
  127. package/data/llms/guides/tailwind.md +151 -0
  128. package/data/llms/guides/theming/styled.md +497 -0
  129. package/data/llms/guides/theming/unstyled.md +57 -0
  130. package/data/llms/guides/uikit.md +3 -0
  131. package/data/llms/guides/vite.md +90 -0
  132. package/data/llms/llms-full.txt +54465 -0
  133. package/data/llms/llms.txt +132 -0
  134. package/data/llms/pages/accessibility.md +27 -0
  135. package/data/llms/pages/animations.md +119 -0
  136. package/data/llms/pages/autoimport.md +28 -0
  137. package/data/llms/pages/cdn.md +72 -0
  138. package/data/llms/pages/configuration.md +158 -0
  139. package/data/llms/pages/contribution.md +31 -0
  140. package/data/llms/pages/customicons.md +67 -0
  141. package/data/llms/pages/designer.md +79 -0
  142. package/data/llms/pages/dynamicimports.md +7 -0
  143. package/data/llms/pages/forms.md +63 -0
  144. package/data/llms/pages/guides/accessibility.md +27 -0
  145. package/data/llms/pages/guides/animations.md +119 -0
  146. package/data/llms/pages/guides/rtl.md +7 -0
  147. package/data/llms/pages/icons.md +136 -0
  148. package/data/llms/pages/installation.md +3 -0
  149. package/data/llms/pages/introduction.md +23 -0
  150. package/data/llms/pages/laravel.md +66 -0
  151. package/data/llms/pages/llms.md +15 -0
  152. package/data/llms/pages/mcp.md +104 -0
  153. package/data/llms/pages/migration/v4.md +15 -0
  154. package/data/llms/pages/migration/v5.md +15 -0
  155. package/data/llms/pages/nuxt.md +141 -0
  156. package/data/llms/pages/passthrough.md +137 -0
  157. package/data/llms/pages/primeclt.md +43 -0
  158. package/data/llms/pages/rtl.md +7 -0
  159. package/data/llms/pages/setup.md +3 -0
  160. package/data/llms/pages/styled.md +497 -0
  161. package/data/llms/pages/tailwind.md +151 -0
  162. package/data/llms/pages/theming/styled.md +497 -0
  163. package/data/llms/pages/theming/unstyled.md +57 -0
  164. package/data/llms/pages/uikit.md +3 -0
  165. package/data/llms/pages/unstyled.md +57 -0
  166. package/data/llms/pages/v4.md +15 -0
  167. package/data/llms/pages/v5.md +15 -0
  168. package/data/llms/pages/vite.md +90 -0
  169. package/data/manifest.json +11117 -0
  170. package/data/mcp-data.json +55940 -0
  171. package/dist/index.d.ts +17 -1
  172. package/dist/index.js +66066 -72541
  173. package/package.json +10 -12
@@ -0,0 +1,522 @@
1
+ # ContextMenu
2
+
3
+ ContextMenu displays an overlay menu on right click of its target.
4
+
5
+ ## Basic
6
+
7
+ ContextMenu is attached to a target element and activated with a right-click.
8
+
9
+ ```vue
10
+ <template>
11
+ <div class="flex justify-center">
12
+ <div
13
+ class="flex items-center justify-center w-full max-w-md mx-auto h-40 rounded-md border-2 border-dashed border-surface-200 dark:border-surface-700 text-sm text-surface-500 dark:text-surface-400 select-none"
14
+ @contextmenu="onRightClick"
15
+ >
16
+ Right-click here
17
+ </div>
18
+ <ContextMenu ref="menu" :model="items" />
19
+ </div>
20
+ </template>
21
+
22
+ <script setup>
23
+ import { ref } from 'vue';
24
+
25
+ const menu = ref();
26
+ const items = ref([
27
+ { label: 'Cut' },
28
+ { label: 'Copy' },
29
+ { label: 'Paste' },
30
+ { label: 'Rename' },
31
+ { separator: true },
32
+ {
33
+ label: 'Delete',
34
+ class: '[&>.p-contextmenu-item-content]:text-red-500! dark:[&>.p-contextmenu-item-content]:text-red-400!'
35
+ }
36
+ ]);
37
+
38
+ const onRightClick = (event) => {
39
+ menu.value.show(event);
40
+ };
41
+ <\/script>
42
+ ```
43
+
44
+ ## Submenus
45
+
46
+ Submenus are defined by nesting menu items within the items property of a parent menu item.
47
+
48
+ ```vue
49
+ <template>
50
+ <div class="flex justify-center">
51
+ <div
52
+ class="flex items-center justify-center w-full max-w-md mx-auto h-40 rounded-md border-2 border-dashed border-surface-200 dark:border-surface-700 text-sm text-surface-500 dark:text-surface-400 select-none"
53
+ @contextmenu="onRightClick"
54
+ >
55
+ Right-click here
56
+ </div>
57
+ <ContextMenu ref="menu" :model="items" />
58
+ </div>
59
+ </template>
60
+
61
+ <script setup>
62
+ import { ref } from 'vue';
63
+ import Copy from '@primeicons/vue/copy';
64
+ import Download from '@primeicons/vue/download';
65
+ import ExternalLink from '@primeicons/vue/external-link';
66
+ import File from '@primeicons/vue/file';
67
+ import Folder from '@primeicons/vue/folder';
68
+ import Link from '@primeicons/vue/link';
69
+ import Send from '@primeicons/vue/send';
70
+ import Trash from '@primeicons/vue/trash';
71
+
72
+ const menu = ref();
73
+ const items = ref([
74
+ { label: 'Copy', icon: Copy },
75
+ {
76
+ label: 'Share',
77
+ icon: Link,
78
+ items: [
79
+ { label: 'Send via email', icon: Send },
80
+ { label: 'Copy link', icon: Link },
81
+ { label: 'Open in new tab', icon: ExternalLink }
82
+ ]
83
+ },
84
+ {
85
+ label: 'Save as',
86
+ icon: Download,
87
+ items: [
88
+ { label: 'PDF', icon: File },
89
+ {
90
+ label: 'Image',
91
+ icon: File,
92
+ items: [{ label: 'PNG' }, { label: 'JPG' }, { label: 'WebP' }, { label: 'SVG' }]
93
+ },
94
+ { label: 'ZIP archive', icon: Folder }
95
+ ]
96
+ },
97
+ { separator: true },
98
+ {
99
+ label: 'Delete',
100
+ icon: Trash,
101
+ class: 'text-red-500! dark:text-red-400!'
102
+ }
103
+ ]);
104
+
105
+ const onRightClick = (event) => {
106
+ menu.value.show(event);
107
+ };
108
+ <\/script>
109
+ ```
110
+
111
+ ## Global
112
+
113
+ Setting the global property to true attaches the context menu to the document.
114
+
115
+ ```vue
116
+ <template>
117
+ <div class="text-center">
118
+ <p class="mb-0 text-sm">Right-click anywhere on this page to view the global ContextMenu.</p>
119
+ <ContextMenu global :model="items" />
120
+ </div>
121
+ </template>
122
+
123
+ <script setup>
124
+ import { ref } from 'vue';
125
+ import ChartLine from '@primeicons/vue/chart-line';
126
+ import Clipboard from '@primeicons/vue/clipboard';
127
+ import Copy from '@primeicons/vue/copy';
128
+ import ExternalLink from '@primeicons/vue/external-link';
129
+ import Folder from '@primeicons/vue/folder';
130
+ import Home from '@primeicons/vue/home';
131
+ import Print from '@primeicons/vue/print';
132
+ import QuestionCircle from '@primeicons/vue/question-circle';
133
+ import Refresh from '@primeicons/vue/refresh';
134
+ import SearchMinus from '@primeicons/vue/search-minus';
135
+ import SearchPlus from '@primeicons/vue/search-plus';
136
+
137
+ const items = ref([
138
+ { label: 'Back', icon: Home },
139
+ { label: 'Reload', icon: Refresh },
140
+ { separator: true },
141
+ { label: 'Copy', icon: Copy },
142
+ { label: 'Paste', icon: Clipboard },
143
+ { separator: true },
144
+ {
145
+ label: 'View',
146
+ icon: Folder,
147
+ items: [
148
+ { label: 'Zoom In', icon: SearchPlus },
149
+ { label: 'Zoom Out', icon: SearchMinus },
150
+ { label: 'Page Source', icon: ChartLine }
151
+ ]
152
+ },
153
+ { separator: true },
154
+ { label: 'Open Link', icon: ExternalLink },
155
+ { label: 'Print', icon: Print },
156
+ { label: 'Inspect', icon: QuestionCircle }
157
+ ]);
158
+ <\/script>
159
+ ```
160
+
161
+ ## Template
162
+
163
+ ContextMenu offers item customization with the item template that receives the menuitem instance from the model as a parameter.
164
+
165
+ ```vue
166
+ <template>
167
+ <div class="flex md:justify-center">
168
+ <ul class="m-0 list-none border border-surface-200 dark:border-surface-700 rounded-sm p-3 flex flex-col gap-2 w-full md:w-120">
169
+ <li
170
+ v-for="product in products"
171
+ :key="product.id"
172
+ :class="['p-2 hover:bg-surface-100 dark:hover:bg-surface-800 rounded-sm border border-transparent transition-all transition-duration-200', { 'border-primary': selectedId === product.id }]"
173
+ @contextmenu="onRightClick($event, product.id)"
174
+ >
175
+ <div class="flex flex-wrap p-2 items-center gap-4">
176
+ <img class="w-16 shrink-0 rounded-sm" :src="'https://primefaces.org/cdn/primevue/images/product/' + product.image" :alt="product.name" />
177
+ <div class="flex-1 flex flex-col gap-1">
178
+ <span class="font-bold text-sm">{{ product.name }}</span>
179
+ <div class="flex items-center gap-2">
180
+ <TagIcon class="text-sm" />
181
+ <span class="text-sm">{{ product.category }}</span>
182
+ </div>
183
+ </div>
184
+ <span class="font-bold ml-8 text-sm">\${{ product.price }}</span>
185
+ </div>
186
+ </li>
187
+ </ul>
188
+ <ContextMenu ref="menu" :model="items" @hide="selectedId = null">
189
+ <template #item="{ item, icon, props }">
190
+ <a v-ripple class="flex items-center px-3 py-2 cursor-pointer" v-bind="props.action">
191
+ <component :is="icon" />
192
+ <span class="text-sm ms-2">{{ item.label }}</span>
193
+ <Badge v-if="item.badge" class="ms-auto" :value="item.badge" />
194
+ <span v-if="item.shortcut" class="ms-auto border border-surface rounded-sm bg-emphasis text-muted-color text-xs p-1">{{ item.shortcut }}</span>
195
+ <AngleRight v-if="item.items" class="ms-auto rotate-90 lg:rotate-0" />
196
+ </a>
197
+ </template>
198
+ </ContextMenu>
199
+ </div>
200
+ </template>
201
+
202
+ <script setup>
203
+ import { ref, onMounted } from 'vue';
204
+ import { ProductService } from '@/service/ProductService'
205
+ import AngleRight from '@primeicons/vue/angle-right';
206
+ import Instagram from '@primeicons/vue/instagram';
207
+ import ShareAlt from '@primeicons/vue/share-alt';
208
+ import ShoppingCart from '@primeicons/vue/shopping-cart';
209
+ import Star from '@primeicons/vue/star';
210
+ import TagIcon from '@primeicons/vue/tag';
211
+ import Whatsapp from '@primeicons/vue/whatsapp';
212
+
213
+ const menu = ref();
214
+ const items = ref([
215
+ {
216
+ label: 'Favorite',
217
+ icon: Star,
218
+ shortcut: '⌘+D'
219
+ },
220
+ {
221
+ label: 'Add',
222
+ icon: ShoppingCart,
223
+ shortcut: '⌘+A'
224
+ },
225
+ {
226
+ separator: true
227
+ },
228
+ {
229
+ label: 'Share',
230
+ icon: ShareAlt,
231
+ items: [
232
+ {
233
+ label: 'Whatsapp',
234
+ icon: Whatsapp,
235
+ badge: 2
236
+ },
237
+ {
238
+ label: 'Instagram',
239
+ icon: Instagram,
240
+ badge: 3
241
+ }
242
+ ]
243
+ }
244
+ ]);
245
+
246
+ const products = ref(null);
247
+ const selectedId = ref(null);
248
+
249
+ onMounted(() => {
250
+ ProductService.getProductsSmall().then((data) => (products.value = data));
251
+ });
252
+
253
+ const onRightClick = (event, id) => {
254
+ selectedId.value = id;
255
+ menu.value.show(event);
256
+ };
257
+
258
+ <\/script>
259
+ ```
260
+
261
+ ## Command
262
+
263
+ The function to invoke when an item is clicked is defined using the command property.
264
+
265
+ ```vue
266
+ <template>
267
+ <Toast />
268
+ <div class="flex sm:justify-center">
269
+ <ul class="m-0 list-none border border-surface rounded-sm p-4 flex flex-col gap-2 w-full sm:w-96">
270
+ <li
271
+ v-for="user in users"
272
+ :key="user.id"
273
+ :class="['p-2 hover:bg-emphasis rounded-sm border border-transparent transition-all duration-200 flex items-center justify-content-between', { 'border-primary!': selectedUser?.id === user.id }]"
274
+ @contextmenu="onRightClick($event, user)"
275
+ >
276
+ <div class="flex flex-1 items-center gap-2">
277
+ <img :alt="user.name" :src="\`https://primefaces.org/cdn/primevue/images/avatar/\${user.image}\`" class="w-8 h-8" />
278
+ <span class="font-bold text-sm">{{ user.name }}</span>
279
+ </div>
280
+ <Tag :value="user.role" :severity="getBadge(user)" />
281
+ </li>
282
+ </ul>
283
+ <ContextMenu ref="menu" :model="items" @hide="selectedUser = null" />
284
+ </div>
285
+ </template>
286
+
287
+ <script setup>
288
+ import { ref } from 'vue';
289
+ import UserPlus from '@primeicons/vue/user-plus';
290
+ import Users from '@primeicons/vue/users';
291
+ import { useToast } from "primevue/usetoast";
292
+
293
+ const toast = useToast();
294
+ const selectedUser = ref();
295
+ const menu = ref();
296
+ const users = ref([
297
+ { id: 0, name: 'Amy Elsner', image: 'amyelsner.png', role: 'Admin' },
298
+ { id: 1, name: 'Anna Fali', image: 'annafali.png', role: 'Member' },
299
+ { id: 2, name: 'Asiya Javayant', image: 'asiyajavayant.png', role: 'Member' },
300
+ { id: 3, name: 'Bernardo Dominic', image: 'bernardodominic.png', role: 'Guest' },
301
+ { id: 4, name: 'Elwin Sharvill', image: 'elwinsharvill.png', role: 'Member' }
302
+ ]);
303
+ const items = ref([
304
+ {
305
+ label: 'Roles',
306
+ icon: Users,
307
+ items: [
308
+ {
309
+ label: 'Admin',
310
+ command: () => {
311
+ selectedUser.value.role = 'Admin';
312
+ }
313
+ },
314
+ {
315
+ label: 'Member',
316
+ command: () => {
317
+ selectedUser.value.role = 'Member';
318
+ }
319
+ },
320
+ {
321
+ label: 'Guest',
322
+ command: () => {
323
+ selectedUser.value.role = 'Guest';
324
+ }
325
+ }
326
+ ]
327
+ },
328
+ {
329
+ label: 'Invite',
330
+ icon: UserPlus,
331
+ command: () => {
332
+ toast.add({ severity: 'success', summary: 'Success', detail: 'Invitation sent!', life: 3000 });
333
+ }
334
+ }
335
+ ]);
336
+
337
+ const onRightClick = (event, user) => {
338
+ selectedUser.value = user;
339
+ menu.value.show(event);
340
+ };
341
+
342
+ const getBadge = (user) => {
343
+ if (user.role === 'Member') return 'info';
344
+ else if (user.role === 'Guest') return 'warn';
345
+ else return null;
346
+ }
347
+ <\/script>
348
+ ```
349
+
350
+ ## Router
351
+
352
+ Menu items support navigation via router-link, programmatic routing using commands, or external URLs.
353
+
354
+ ```vue
355
+ <template>
356
+ <div class="flex justify-center">
357
+ <span class="inline-flex items-center justify-center border-2 border-primary rounded-sm w-16 h-16" @contextmenu="onRightClick" aria-haspopup="true">
358
+ <svg width="35" height="40" viewBox="0 0 35 40" fill="none" xmlns="http://www.w3.org/2000/svg">
359
+ <path
360
+ d="M25.87 18.05L23.16 17.45L25.27 20.46V29.78L32.49 23.76V13.53L29.18 14.73L25.87 18.04V18.05ZM25.27 35.49L29.18 31.58V27.67L25.27 30.98V35.49ZM20.16 17.14H20.03H20.17H20.16ZM30.1 5.19L34.89 4.81L33.08 12.33L24.1 15.67L30.08 5.2L30.1 5.19ZM5.72 14.74L2.41 13.54V23.77L9.63 29.79V20.47L11.74 17.46L9.03 18.06L5.72 14.75V14.74ZM9.63 30.98L5.72 27.67V31.58L9.63 35.49V30.98ZM4.8 5.2L10.78 15.67L1.81 12.33L0 4.81L4.79 5.19L4.8 5.2ZM24.37 21.05V34.59L22.56 37.29L20.46 39.4H14.44L12.34 37.29L10.53 34.59V21.05L12.42 18.23L17.45 26.8L22.48 18.23L24.37 21.05ZM22.85 0L22.57 0.69L17.45 13.08L12.33 0.69L12.05 0H22.85Z"
361
+ fill="var(--p-primary-color)"
362
+ />
363
+ <path
364
+ d="M30.69 4.21L24.37 4.81L22.57 0.69L22.86 0H26.48L30.69 4.21ZM23.75 5.67L22.66 3.08L18.05 14.24V17.14H19.7H20.03H20.16H20.2L24.1 15.7L30.11 5.19L23.75 5.67ZM4.21002 4.21L10.53 4.81L12.33 0.69L12.05 0H8.43002L4.22002 4.21H4.21002ZM21.9 17.4L20.6 18.2H14.3L13 17.4L12.4 18.2L12.42 18.23L17.45 26.8L22.48 18.23L22.5 18.2L21.9 17.4ZM4.79002 5.19L10.8 15.7L14.7 17.14H14.74H15.2H16.85V14.24L12.24 3.09L11.15 5.68L4.79002 5.2V5.19Z"
365
+ fill="var(--p-text-color)"
366
+ />
367
+ </svg>
368
+ </span>
369
+ <ContextMenu ref="routemenu" :model="items">
370
+ <template #item="{ item, icon, props }">
371
+ <router-link v-if="item.route" v-slot="{ href, navigate }" :to="item.route" custom>
372
+ <a v-ripple :href="href" v-bind="props.action" @click="navigate">
373
+ <component :is="icon" />
374
+ <span class="text-sm ml-2">{{ item.label }}</span>
375
+ </a>
376
+ </router-link>
377
+ <a v-else v-ripple :href="item.url" :target="item.target" v-bind="props.action">
378
+ <component :is="icon" />
379
+ <span class="text-sm ml-2">{{ item.label }}</span>
380
+ </a>
381
+ </template>
382
+ </ContextMenu>
383
+ </div>
384
+ </template>
385
+
386
+ <script setup>
387
+ import { ref } from 'vue';
388
+ import { useRouter } from 'vue-router';
389
+ import Home from '@primeicons/vue/home';
390
+ import Link from '@primeicons/vue/link';
391
+ import Palette from '@primeicons/vue/palette';
392
+
393
+ const router = useRouter();
394
+
395
+ const routemenu = ref();
396
+ const items = ref([
397
+ {
398
+ label: 'Router Link',
399
+ icon: Palette,
400
+ route: '/theming/unstyled'
401
+ },
402
+ {
403
+ label: 'Programmatic',
404
+ icon: Link,
405
+ command: () => {
406
+ router.push('/introduction');
407
+ }
408
+ },
409
+ {
410
+ label: 'External',
411
+ icon: Home,
412
+ url: 'https://vuejs.org/'
413
+ }
414
+ ]);
415
+
416
+ const onRightClick = (event) => {
417
+ routemenu.value.show(event);
418
+ };
419
+ <\/script>
420
+ ```
421
+
422
+ ## Table
423
+
424
+ DataTable has built-in support for ContextMenu, see the ContextMenu demo for an example.
425
+
426
+ ## Accessibility
427
+
428
+ Screen Reader ContextMenu component uses the menubar role with aria-orientation set to "vertical" and the value to describe the menu can either be provided with aria-labelledby or aria-label props. Each list item has a presentation role whereas anchor elements have a menuitem role with aria-label referring to the label of the item and aria-disabled defined if the item is disabled. A submenu within a ContextMenu uses the menu role with an aria-labelledby defined as the id of the submenu root menuitem label. In addition, menuitems that open a submenu have aria-haspopup , aria-expanded and aria-controls to define the relation between the item and the submenu. Keyboard Support Key Function tab When focus is in the menu, closes the context menu and moves focus to the next focusable element in the page sequence. enter If menuitem has a submenu, toggles the visibility of the submenu otherwise activates the menuitem and closes all open overlays. space If menuitem has a submenu, toggles the visibility of the submenu otherwise activates the menuitem and closes all open overlays. escape Closes the context menu. down arrow If focus is not inside the menu and menu is open, add focus to the first item. If an item is already focused, moves focus to the next menuitem within the submenu. up arrow If focus is not inside the menu and menu is open, add focus to the last item. If an item is already focused, moves focus to the next menuitem within the submenu. right arrow Opens a submenu if there is one available and moves focus to the first item. left arrow Closes a submenu and moves focus to the root item of the closed submenu. home Moves focus to the first menuitem within the submenu. end Moves focus to the last menuitem within the submenu.
429
+
430
+ ## Context Menu API
431
+
432
+ ### Props
433
+
434
+ | Name |Type |Default |Description |
435
+ | --- | --- | --- | --- |
436
+ | model | MenuItem[] | - | An array of menuitems. |
437
+ | breakpoint | string | 960px | The breakpoint to define the maximum width boundary. |
438
+ | global | boolean | false | Attaches the menu to document instead of a particular item. |
439
+ | appendTo | HTMLElement \| HintedString<"body" \| "self"> | body | A valid query selector or an HTMLElement to specify where the overlay gets attached. |
440
+ | autoZIndex | boolean | true | Whether to automatically manage layering. |
441
+ | baseZIndex | number | 0 | Base zIndex value to use in layering. |
442
+ | tabindex | string \| number | - | Index of the element in tabbing order. |
443
+ | ariaLabel | string | - | Defines a string value that labels an interactive element. |
444
+ | ariaLabelledby | string | - | Identifier of the underlying menu element. |
445
+ | dt | any | - | It generates scoped CSS variables using design tokens for the component. |
446
+ | pt | PassThrough<ContextMenuPassThroughOptions> | - | Used to pass attributes to DOM elements inside the component. |
447
+ | ptOptions | any | - | Used to configure passthrough(pt) options of the component. |
448
+ | unstyled | boolean | false | When enabled, it removes component related styles in the core. |
449
+
450
+ ### Pass Through Options
451
+
452
+ | Name |Type |Description |
453
+ | --- | --- | --- |
454
+ | root | ContextMenuPassThroughOptionType | Used to pass attributes to the root's DOM element. |
455
+ | rootList | ContextMenuPassThroughOptionType | Used to pass attributes to the root list's DOM element. |
456
+ | item | ContextMenuPassThroughOptionType | Used to pass attributes to the item's DOM element. |
457
+ | itemContent | ContextMenuPassThroughOptionType | Used to pass attributes to the item content's DOM element. |
458
+ | itemLink | ContextMenuPassThroughOptionType | Used to pass attributes to the item link's DOM element. |
459
+ | itemIcon | ContextMenuPassThroughOptionType | Used to pass attributes to the item icon's DOM element. |
460
+ | itemLabel | ContextMenuPassThroughOptionType | Used to pass attributes to the item label's DOM element. |
461
+ | submenuIcon | ContextMenuPassThroughOptionType | Used to pass attributes to the submenu icon's DOM element. |
462
+ | separator | ContextMenuPassThroughOptionType | Used to pass attributes to the separator's DOM element. |
463
+ | submenu | ContextMenuPassThroughOptionType | Used to pass attributes to the submenu's DOM element. |
464
+ | hooks | any | Used to manage all lifecycle hooks. |
465
+ | transition | ContextMenuPassThroughTransitionType | Used to control Vue Transition API. |
466
+
467
+ ### Theming
468
+
469
+ ### CSS Classes
470
+
471
+ | Class |Description |
472
+ | --- | --- |
473
+ | p-contextmenu | Class name of the root element |
474
+ | p-contextmenu-root-list | Class name of the root list element |
475
+ | p-contextmenu-item | Class name of the item element |
476
+ | p-contextmenu-item-content | Class name of the item content element |
477
+ | p-contextmenu-item-link | Class name of the item link element |
478
+ | p-contextmenu-item-icon | Class name of the item icon element |
479
+ | p-contextmenu-item-label | Class name of the item label element |
480
+ | p-contextmenu-submenu-icon | Class name of the submenu icon element |
481
+ | p-contextmenu-submenu | Class name of the submenu element |
482
+ | p-contextmenu-separator | Class name of the separator element |
483
+
484
+ ### Design Tokens
485
+
486
+ | Token |CSS Variable |Description |
487
+ | --- | --- | --- |
488
+ | contextmenu.background | --p-contextmenu-background | Background of root |
489
+ | contextmenu.border.color | --p-contextmenu-border-color | Border color of root |
490
+ | contextmenu.color | --p-contextmenu-color | Color of root |
491
+ | contextmenu.border.radius | --p-contextmenu-border-radius | Border radius of root |
492
+ | contextmenu.shadow | --p-contextmenu-shadow | Shadow of root |
493
+ | contextmenu.transition.duration | --p-contextmenu-transition-duration | Transition duration of root |
494
+ | contextmenu.list.padding | --p-contextmenu-list-padding | Padding of list |
495
+ | contextmenu.list.gap | --p-contextmenu-list-gap | Gap of list |
496
+ | contextmenu.item.focus.background | --p-contextmenu-item-focus-background | Focus background of item |
497
+ | contextmenu.item.active.background | --p-contextmenu-item-active-background | Active background of item |
498
+ | contextmenu.item.color | --p-contextmenu-item-color | Color of item |
499
+ | contextmenu.item.focus.color | --p-contextmenu-item-focus-color | Focus color of item |
500
+ | contextmenu.item.active.color | --p-contextmenu-item-active-color | Active color of item |
501
+ | contextmenu.item.padding | --p-contextmenu-item-padding | Padding of item |
502
+ | contextmenu.item.border.radius | --p-contextmenu-item-border-radius | Border radius of item |
503
+ | contextmenu.item.gap | --p-contextmenu-item-gap | Gap of item |
504
+ | contextmenu.item.icon.color | --p-contextmenu-item-icon-color | Icon color of item |
505
+ | contextmenu.item.icon.focus.color | --p-contextmenu-item-icon-focus-color | Icon focus color of item |
506
+ | contextmenu.item.icon.active.color | --p-contextmenu-item-icon-active-color | Icon active color of item |
507
+ | contextmenu.item.icon.size | --p-contextmenu-item-icon-size | Icon size of item |
508
+ | contextmenu.item.label.font.weight | --p-contextmenu-item-label-font-weight | Font weight of item label |
509
+ | contextmenu.item.label.font.size | --p-contextmenu-item-label-font-size | Font size of item label |
510
+ | contextmenu.submenu.mobile.indent | --p-contextmenu-submenu-mobile-indent | Mobile indent of submenu |
511
+ | contextmenu.submenu.label.padding | --p-contextmenu-submenu-label-padding | Padding of submenu label |
512
+ | contextmenu.submenu.label.font.weight | --p-contextmenu-submenu-label-font-weight | Font weight of submenu label |
513
+ | contextmenu.submenu.label.font.size | --p-contextmenu-submenu-label-font-size | Font size of submenu label |
514
+ | contextmenu.submenu.label.background | --p-contextmenu-submenu-label-background | Background of submenu label |
515
+ | contextmenu.submenu.label.color | --p-contextmenu-submenu-label-color | Color of submenu label |
516
+ | contextmenu.submenu.icon.size | --p-contextmenu-submenu-icon-size | Size of submenu icon |
517
+ | contextmenu.submenu.icon.color | --p-contextmenu-submenu-icon-color | Color of submenu icon |
518
+ | contextmenu.submenu.icon.focus.color | --p-contextmenu-submenu-icon-focus-color | Focus color of submenu icon |
519
+ | contextmenu.submenu.icon.active.color | --p-contextmenu-submenu-icon-active-color | Active color of submenu icon |
520
+ | contextmenu.separator.border.color | --p-contextmenu-separator-border-color | Border color of separator |
521
+
522
+ ## Menu Item API