@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.
- package/LICENSE.md +45 -21
- package/README.md +48 -250
- package/data/components.json +47269 -0
- package/data/llms/components/accordion.md +629 -0
- package/data/llms/components/animateonscroll.md +165 -0
- package/data/llms/components/autocomplete.md +995 -0
- package/data/llms/components/avatar.md +264 -0
- package/data/llms/components/badge.md +200 -0
- package/data/llms/components/blockui.md +99 -0
- package/data/llms/components/breadcrumb.md +269 -0
- package/data/llms/components/button.md +902 -0
- package/data/llms/components/card.md +209 -0
- package/data/llms/components/carousel.md +506 -0
- package/data/llms/components/cascadeselect.md +1207 -0
- package/data/llms/components/chart.md +1022 -0
- package/data/llms/components/checkbox.md +401 -0
- package/data/llms/components/chip.md +206 -0
- package/data/llms/components/colorpicker.md +213 -0
- package/data/llms/components/commandmenu.md +660 -0
- package/data/llms/components/compare.md +407 -0
- package/data/llms/components/confirmdialog.md +343 -0
- package/data/llms/components/confirmpopup.md +252 -0
- package/data/llms/components/contextmenu.md +522 -0
- package/data/llms/components/datatable.md +5266 -0
- package/data/llms/components/dataview.md +569 -0
- package/data/llms/components/datepicker.md +964 -0
- package/data/llms/components/deferredcontent.md +96 -0
- package/data/llms/components/dialog.md +702 -0
- package/data/llms/components/divider.md +152 -0
- package/data/llms/components/dock.md +488 -0
- package/data/llms/components/drawer.md +469 -0
- package/data/llms/components/dynamicdialog.md +214 -0
- package/data/llms/components/editor.md +205 -0
- package/data/llms/components/fieldset.md +253 -0
- package/data/llms/components/fileupload.md +459 -0
- package/data/llms/components/floatlabel.md +144 -0
- package/data/llms/components/fluid.md +104 -0
- package/data/llms/components/focustrap.md +59 -0
- package/data/llms/components/forms.md +344 -0
- package/data/llms/components/galleria.md +1119 -0
- package/data/llms/components/gallery.md +1003 -0
- package/data/llms/components/iconfield.md +283 -0
- package/data/llms/components/iftalabel.md +96 -0
- package/data/llms/components/image.md +179 -0
- package/data/llms/components/imagecompare.md +108 -0
- package/data/llms/components/inplace.md +183 -0
- package/data/llms/components/inputcolor.md +869 -0
- package/data/llms/components/inputgroup.md +419 -0
- package/data/llms/components/inputmask.md +345 -0
- package/data/llms/components/inputnumber.md +551 -0
- package/data/llms/components/inputotp.md +345 -0
- package/data/llms/components/inputpassword.md +738 -0
- package/data/llms/components/inputtags.md +432 -0
- package/data/llms/components/inputtext.md +569 -0
- package/data/llms/components/installation.md +1 -0
- package/data/llms/components/keyfilter.md +116 -0
- package/data/llms/components/knob.md +318 -0
- package/data/llms/components/label.md +151 -0
- package/data/llms/components/laravel.md +53 -0
- package/data/llms/components/listbox.md +636 -0
- package/data/llms/components/mask.md +203 -0
- package/data/llms/components/mcp.md +39 -0
- package/data/llms/components/megamenu.md +563 -0
- package/data/llms/components/menu.md +651 -0
- package/data/llms/components/menubar.md +446 -0
- package/data/llms/components/message.md +497 -0
- package/data/llms/components/metergroup.md +281 -0
- package/data/llms/components/multiselect.md +752 -0
- package/data/llms/components/orderlist.md +224 -0
- package/data/llms/components/organizationchart.md +418 -0
- package/data/llms/components/paginator.md +221 -0
- package/data/llms/components/panel.md +321 -0
- package/data/llms/components/panelmenu.md +703 -0
- package/data/llms/components/password.md +657 -0
- package/data/llms/components/picklist.md +286 -0
- package/data/llms/components/popover.md +145 -0
- package/data/llms/components/progressbar.md +242 -0
- package/data/llms/components/progressspinner.md +104 -0
- package/data/llms/components/radiobutton.md +427 -0
- package/data/llms/components/rating.md +312 -0
- package/data/llms/components/ripple.md +91 -0
- package/data/llms/components/scrollarea.md +700 -0
- package/data/llms/components/scrollpanel.md +131 -0
- package/data/llms/components/scrolltop.md +87 -0
- package/data/llms/components/select.md +1251 -0
- package/data/llms/components/selectbutton.md +268 -0
- package/data/llms/components/sidebar.md +2232 -0
- package/data/llms/components/skeleton.md +302 -0
- package/data/llms/components/slider.md +416 -0
- package/data/llms/components/speeddial.md +402 -0
- package/data/llms/components/splitbutton.md +840 -0
- package/data/llms/components/splitter.md +447 -0
- package/data/llms/components/stepper.md +551 -0
- package/data/llms/components/styleclass.md +226 -0
- package/data/llms/components/tabs.md +609 -0
- package/data/llms/components/tag.md +178 -0
- package/data/llms/components/terminal.md +123 -0
- package/data/llms/components/textarea.md +519 -0
- package/data/llms/components/tieredmenu.md +578 -0
- package/data/llms/components/timeline.md +494 -0
- package/data/llms/components/toast.md +472 -0
- package/data/llms/components/togglebutton.md +276 -0
- package/data/llms/components/toggleswitch.md +271 -0
- package/data/llms/components/toolbar.md +140 -0
- package/data/llms/components/tooltip.md +160 -0
- package/data/llms/components/tree.md +1076 -0
- package/data/llms/components/treeselect.md +660 -0
- package/data/llms/components/treetable.md +2493 -0
- package/data/llms/components/virtualscroller.md +265 -0
- package/data/llms/guides/autoimport.md +28 -0
- package/data/llms/guides/cdn.md +72 -0
- package/data/llms/guides/configuration.md +158 -0
- package/data/llms/guides/customicons.md +67 -0
- package/data/llms/guides/guides/accessibility.md +27 -0
- package/data/llms/guides/guides/animations.md +119 -0
- package/data/llms/guides/guides/rtl.md +7 -0
- package/data/llms/guides/icons.md +136 -0
- package/data/llms/guides/installation.md +3 -0
- package/data/llms/guides/laravel.md +66 -0
- package/data/llms/guides/llms.md +15 -0
- package/data/llms/guides/mcp.md +104 -0
- package/data/llms/guides/migration/v4.md +15 -0
- package/data/llms/guides/migration/v5.md +15 -0
- package/data/llms/guides/nuxt.md +141 -0
- package/data/llms/guides/passthrough.md +137 -0
- package/data/llms/guides/primeclt.md +43 -0
- package/data/llms/guides/tailwind.md +151 -0
- package/data/llms/guides/theming/styled.md +497 -0
- package/data/llms/guides/theming/unstyled.md +57 -0
- package/data/llms/guides/uikit.md +3 -0
- package/data/llms/guides/vite.md +90 -0
- package/data/llms/llms-full.txt +54465 -0
- package/data/llms/llms.txt +132 -0
- package/data/llms/pages/accessibility.md +27 -0
- package/data/llms/pages/animations.md +119 -0
- package/data/llms/pages/autoimport.md +28 -0
- package/data/llms/pages/cdn.md +72 -0
- package/data/llms/pages/configuration.md +158 -0
- package/data/llms/pages/contribution.md +31 -0
- package/data/llms/pages/customicons.md +67 -0
- package/data/llms/pages/designer.md +79 -0
- package/data/llms/pages/dynamicimports.md +7 -0
- package/data/llms/pages/forms.md +63 -0
- package/data/llms/pages/guides/accessibility.md +27 -0
- package/data/llms/pages/guides/animations.md +119 -0
- package/data/llms/pages/guides/rtl.md +7 -0
- package/data/llms/pages/icons.md +136 -0
- package/data/llms/pages/installation.md +3 -0
- package/data/llms/pages/introduction.md +23 -0
- package/data/llms/pages/laravel.md +66 -0
- package/data/llms/pages/llms.md +15 -0
- package/data/llms/pages/mcp.md +104 -0
- package/data/llms/pages/migration/v4.md +15 -0
- package/data/llms/pages/migration/v5.md +15 -0
- package/data/llms/pages/nuxt.md +141 -0
- package/data/llms/pages/passthrough.md +137 -0
- package/data/llms/pages/primeclt.md +43 -0
- package/data/llms/pages/rtl.md +7 -0
- package/data/llms/pages/setup.md +3 -0
- package/data/llms/pages/styled.md +497 -0
- package/data/llms/pages/tailwind.md +151 -0
- package/data/llms/pages/theming/styled.md +497 -0
- package/data/llms/pages/theming/unstyled.md +57 -0
- package/data/llms/pages/uikit.md +3 -0
- package/data/llms/pages/unstyled.md +57 -0
- package/data/llms/pages/v4.md +15 -0
- package/data/llms/pages/v5.md +15 -0
- package/data/llms/pages/vite.md +90 -0
- package/data/manifest.json +11117 -0
- package/data/mcp-data.json +55940 -0
- package/dist/index.d.ts +17 -1
- package/dist/index.js +66066 -72541
- package/package.json +10 -12
|
@@ -0,0 +1,651 @@
|
|
|
1
|
+
# Menu
|
|
2
|
+
|
|
3
|
+
Menu is a navigation / command component that supports dynamic and static positioning.
|
|
4
|
+
|
|
5
|
+
## Basic
|
|
6
|
+
|
|
7
|
+
Items are grouped with the items property where each group displays a label header, while a flat separator entry divides the sections.
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<template>
|
|
11
|
+
<div class="flex justify-center">
|
|
12
|
+
<Menu ref="menu" :model="items" popup class="w-40" />
|
|
13
|
+
<Button variant="outlined" severity="secondary" @click="toggle">Account</Button>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup>
|
|
18
|
+
import { ref } from 'vue';
|
|
19
|
+
|
|
20
|
+
const menu = ref();
|
|
21
|
+
const items = ref([
|
|
22
|
+
{
|
|
23
|
+
label: 'My Account',
|
|
24
|
+
items: [{ label: 'Profile' }, { label: 'Billing' }, { label: 'Settings' }]
|
|
25
|
+
},
|
|
26
|
+
{ separator: true },
|
|
27
|
+
{
|
|
28
|
+
label: 'Security',
|
|
29
|
+
items: [{ label: 'Change Password' }, { label: 'Two-Factor Auth' }]
|
|
30
|
+
},
|
|
31
|
+
{ separator: true },
|
|
32
|
+
{ label: 'Invite Members' },
|
|
33
|
+
{ label: 'Support' },
|
|
34
|
+
{ separator: true },
|
|
35
|
+
{ label: 'Sign out' }
|
|
36
|
+
]);
|
|
37
|
+
|
|
38
|
+
const toggle = (event) => {
|
|
39
|
+
menu.value.toggle(event);
|
|
40
|
+
};
|
|
41
|
+
<\/script>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Group
|
|
45
|
+
|
|
46
|
+
Items are organized into labeled groups separated by a separator . Checkbox and radio selections are driven from the model by toggling an item's icon through its command .
|
|
47
|
+
|
|
48
|
+
```vue
|
|
49
|
+
<template>
|
|
50
|
+
<div class="flex justify-center">
|
|
51
|
+
<Menu :model="items" class="w-60" />
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script setup>
|
|
56
|
+
import Blank from '@primeicons/vue/blank';
|
|
57
|
+
import Check from '@primeicons/vue/check';
|
|
58
|
+
import Dot from '@primeicons/vue/dot';
|
|
59
|
+
import { computed, ref } from 'vue';
|
|
60
|
+
|
|
61
|
+
const notifications = ref(true);
|
|
62
|
+
const sound = ref(false);
|
|
63
|
+
const marketing = ref(false);
|
|
64
|
+
const autoUpdate = ref(true);
|
|
65
|
+
const theme = ref('light');
|
|
66
|
+
const language = ref('en');
|
|
67
|
+
|
|
68
|
+
const items = computed(() => [
|
|
69
|
+
{
|
|
70
|
+
label: 'Notifications',
|
|
71
|
+
items: [
|
|
72
|
+
{
|
|
73
|
+
label: 'Enable notifications',
|
|
74
|
+
icon: this.notifications ? Check : Blank,
|
|
75
|
+
command: () => (this.notifications = !this.notifications)
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
label: 'Play sound',
|
|
79
|
+
icon: this.sound ? Check : Blank,
|
|
80
|
+
command: () => (this.sound = !this.sound)
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
label: 'Marketing emails',
|
|
84
|
+
icon: this.marketing ? Check : Blank,
|
|
85
|
+
command: () => (this.marketing = !this.marketing)
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{ separator: true },
|
|
90
|
+
{
|
|
91
|
+
label: 'System',
|
|
92
|
+
items: [
|
|
93
|
+
{
|
|
94
|
+
label: 'Auto-update apps',
|
|
95
|
+
icon: this.autoUpdate ? Check : Blank,
|
|
96
|
+
command: () => (this.autoUpdate = !this.autoUpdate)
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
{ separator: true },
|
|
101
|
+
{
|
|
102
|
+
label: 'Appearance',
|
|
103
|
+
items: [
|
|
104
|
+
{
|
|
105
|
+
label: 'Light',
|
|
106
|
+
icon: this.theme === 'light' ? Dot : Blank,
|
|
107
|
+
command: () => (this.theme = 'light')
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
label: 'Dark',
|
|
111
|
+
icon: this.theme === 'dark' ? Dot : Blank,
|
|
112
|
+
command: () => (this.theme = 'dark')
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
label: 'System',
|
|
116
|
+
icon: this.theme === 'system' ? Dot : Blank,
|
|
117
|
+
command: () => (this.theme = 'system')
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
{ separator: true },
|
|
122
|
+
{
|
|
123
|
+
label: 'Language',
|
|
124
|
+
items: [
|
|
125
|
+
{
|
|
126
|
+
label: 'English',
|
|
127
|
+
icon: this.language === 'en' ? Dot : Blank,
|
|
128
|
+
command: () => (this.language = 'en')
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
label: 'Türkçe',
|
|
132
|
+
icon: this.language === 'tr' ? Dot : Blank,
|
|
133
|
+
command: () => (this.language = 'tr')
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
label: 'Deutsch',
|
|
137
|
+
icon: this.language === 'de' ? Dot : Blank,
|
|
138
|
+
command: () => (this.language = 'de')
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
]);
|
|
143
|
+
<\/script>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Toggleable
|
|
147
|
+
|
|
148
|
+
Nested submenus are toggleable by default. Use toggleable to override the default per item (e.g. force a top-level group to be toggleable, or keep a nested group always open) and expandedKeys to control open/closed state.
|
|
149
|
+
|
|
150
|
+
```vue
|
|
151
|
+
<template>
|
|
152
|
+
<div class="flex justify-center">
|
|
153
|
+
<Menu :model="items" class="w-44" />
|
|
154
|
+
</div>
|
|
155
|
+
</template>
|
|
156
|
+
|
|
157
|
+
<script setup>
|
|
158
|
+
import Cloud from '@primeicons/vue/cloud';
|
|
159
|
+
import Copy from '@primeicons/vue/copy';
|
|
160
|
+
import Download from '@primeicons/vue/download';
|
|
161
|
+
import Facebook from '@primeicons/vue/facebook';
|
|
162
|
+
import File from '@primeicons/vue/file';
|
|
163
|
+
import FileEdit from '@primeicons/vue/file-edit';
|
|
164
|
+
import FileExport from '@primeicons/vue/file-export';
|
|
165
|
+
import Globe from '@primeicons/vue/globe';
|
|
166
|
+
import Link from '@primeicons/vue/link';
|
|
167
|
+
import Linkedin from '@primeicons/vue/linkedin';
|
|
168
|
+
import Pencil from '@primeicons/vue/pencil';
|
|
169
|
+
import Send from '@primeicons/vue/send';
|
|
170
|
+
import ShareAlt from '@primeicons/vue/share-alt';
|
|
171
|
+
import Twitter from '@primeicons/vue/twitter';
|
|
172
|
+
import { ref } from 'vue';
|
|
173
|
+
|
|
174
|
+
const items = ref([
|
|
175
|
+
{
|
|
176
|
+
label: 'Document',
|
|
177
|
+
items: [
|
|
178
|
+
{ label: 'New file', icon: File },
|
|
179
|
+
{ label: 'Open recent', icon: FileEdit },
|
|
180
|
+
{ label: 'Duplicate', icon: Copy },
|
|
181
|
+
{
|
|
182
|
+
label: 'Import',
|
|
183
|
+
icon: Download,
|
|
184
|
+
items: [
|
|
185
|
+
{ label: 'From file', icon: File },
|
|
186
|
+
{ label: 'From cloud', icon: Cloud },
|
|
187
|
+
{ label: 'From URL', icon: Globe }
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
label: 'Export',
|
|
192
|
+
icon: FileExport,
|
|
193
|
+
items: [
|
|
194
|
+
{ label: 'PDF' },
|
|
195
|
+
{ label: 'Word' },
|
|
196
|
+
{ label: 'Markdown' },
|
|
197
|
+
{ label: 'HTML' },
|
|
198
|
+
{
|
|
199
|
+
label: 'More',
|
|
200
|
+
items: [{ label: 'EPUB' }, { label: 'RTF' }, { label: 'LaTeX' }, { label: 'Plain Text' }]
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
label: 'Share',
|
|
206
|
+
icon: ShareAlt,
|
|
207
|
+
items: [
|
|
208
|
+
{ label: 'Send via email', icon: Send },
|
|
209
|
+
{ label: 'Copy link', icon: Link },
|
|
210
|
+
{ separator: true },
|
|
211
|
+
{
|
|
212
|
+
label: 'Social',
|
|
213
|
+
toggleable: false,
|
|
214
|
+
items: [
|
|
215
|
+
{ label: 'Twitter', icon: Twitter },
|
|
216
|
+
{ label: 'Facebook', icon: Facebook },
|
|
217
|
+
{ label: 'LinkedIn', icon: Linkedin }
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
{ label: 'Rename', icon: Pencil }
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
]);
|
|
226
|
+
<\/script>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Popup
|
|
230
|
+
|
|
231
|
+
Popup mode is enabled by setting the popup property to true and calling the toggle method to display the menu relative to its target.
|
|
232
|
+
|
|
233
|
+
```vue
|
|
234
|
+
<template>
|
|
235
|
+
<div class="flex justify-center">
|
|
236
|
+
<Menu ref="menu" :model="items" popup />
|
|
237
|
+
<Button type="button" severity="secondary" variant="outlined" iconOnly aria-label="Apps" @click="toggle">
|
|
238
|
+
<Bars />
|
|
239
|
+
</Button>
|
|
240
|
+
</div>
|
|
241
|
+
</template>
|
|
242
|
+
|
|
243
|
+
<script setup>
|
|
244
|
+
import Bars from '@primeicons/vue/bars';
|
|
245
|
+
import Copy from '@primeicons/vue/copy';
|
|
246
|
+
import Download from '@primeicons/vue/download';
|
|
247
|
+
import File from '@primeicons/vue/file';
|
|
248
|
+
import FileEdit from '@primeicons/vue/file-edit';
|
|
249
|
+
import FileExport from '@primeicons/vue/file-export';
|
|
250
|
+
import Pencil from '@primeicons/vue/pencil';
|
|
251
|
+
import ShareAlt from '@primeicons/vue/share-alt';
|
|
252
|
+
import { ref } from 'vue';
|
|
253
|
+
|
|
254
|
+
const menu = ref();
|
|
255
|
+
const items = ref([
|
|
256
|
+
{
|
|
257
|
+
label: 'Document',
|
|
258
|
+
items: [
|
|
259
|
+
{ label: 'New file', icon: File },
|
|
260
|
+
{ label: 'Open recent', icon: FileEdit },
|
|
261
|
+
{ label: 'Duplicate', icon: Copy },
|
|
262
|
+
{ label: 'Import', icon: Download },
|
|
263
|
+
{ label: 'Export', icon: FileExport },
|
|
264
|
+
{ label: 'Share', icon: ShareAlt },
|
|
265
|
+
{ label: 'Rename', icon: Pencil }
|
|
266
|
+
]
|
|
267
|
+
}
|
|
268
|
+
]);
|
|
269
|
+
|
|
270
|
+
const toggle = (event) => {
|
|
271
|
+
menu.value.toggle(event);
|
|
272
|
+
};
|
|
273
|
+
<\/script>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Template
|
|
277
|
+
|
|
278
|
+
Menu offers item customization with the item template that receives the menuitem instance from the model as a parameter. The submenu label has its own submenulabel template, additional slots named start and end are provided to embed content before or after the menu.
|
|
279
|
+
|
|
280
|
+
```vue
|
|
281
|
+
<template>
|
|
282
|
+
<div class="flex justify-center">
|
|
283
|
+
<Menu :model="items" class="w-full md:w-60">
|
|
284
|
+
<template #start>
|
|
285
|
+
<span class="inline-flex items-center gap-1 px-1.5 py-1.5">
|
|
286
|
+
<svg width="35" height="40" viewBox="0 0 35 40" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-8">
|
|
287
|
+
<path
|
|
288
|
+
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"
|
|
289
|
+
fill="var(--p-primary-color)"
|
|
290
|
+
/>
|
|
291
|
+
<path
|
|
292
|
+
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"
|
|
293
|
+
fill="var(--p-text-color)"
|
|
294
|
+
/>
|
|
295
|
+
</svg>
|
|
296
|
+
<span class="text-lg font-semibold">PRIME<span class="text-primary">APP</span></span>
|
|
297
|
+
</span>
|
|
298
|
+
</template>
|
|
299
|
+
<template #submenulabel="{ item }">
|
|
300
|
+
<span class="text-primary font-bold text-sm">{{ item.label }}</span>
|
|
301
|
+
</template>
|
|
302
|
+
<template #item="{ item, icon, label, props }">
|
|
303
|
+
<a v-ripple class="flex items-center px-2.5 py-1.5 cursor-pointer" :class="item.linkClass" v-bind="props.action">
|
|
304
|
+
<component :is="icon" />
|
|
305
|
+
<span class="ms-2 text-sm">{{ label }}</span>
|
|
306
|
+
<Badge v-if="item.badge" class="ms-auto" :value="item.badge" />
|
|
307
|
+
<span v-if="item.shortcut" class="ms-auto border border-surface rounded-sm bg-emphasis text-muted-color text-xs px-1 py-0.5">{{ item.shortcut }}</span>
|
|
308
|
+
</a>
|
|
309
|
+
</template>
|
|
310
|
+
<template #end>
|
|
311
|
+
<button v-ripple class="relative overflow-hidden w-full border-0 bg-transparent flex items-start p-1.5 pl-3.5 hover:bg-surface-100 dark:hover:bg-surface-800 rounded-none cursor-pointer transition-colors duration-200">
|
|
312
|
+
<Avatar image="https://primefaces.org/cdn/primevue/images/avatar/amyelsner.png" class="mr-2" shape="circle" />
|
|
313
|
+
<span class="inline-flex flex-col items-start">
|
|
314
|
+
<span class="text-sm font-bold">Amy Elsner</span>
|
|
315
|
+
<span class="text-xs">Admin</span>
|
|
316
|
+
</span>
|
|
317
|
+
</button>
|
|
318
|
+
</template>
|
|
319
|
+
</Menu>
|
|
320
|
+
</div>
|
|
321
|
+
</template>
|
|
322
|
+
|
|
323
|
+
<script setup>
|
|
324
|
+
import Cog from '@primeicons/vue/cog';
|
|
325
|
+
import Inbox from '@primeicons/vue/inbox';
|
|
326
|
+
import Plus from '@primeicons/vue/plus';
|
|
327
|
+
import Search from '@primeicons/vue/search';
|
|
328
|
+
import SignOut from '@primeicons/vue/sign-out';
|
|
329
|
+
import { ref } from "vue";
|
|
330
|
+
|
|
331
|
+
const items = ref([
|
|
332
|
+
{
|
|
333
|
+
separator: true
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
label: 'Documents',
|
|
337
|
+
items: [
|
|
338
|
+
{
|
|
339
|
+
label: 'New',
|
|
340
|
+
icon: Plus,
|
|
341
|
+
shortcut: '⌘+N'
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
label: 'Search',
|
|
345
|
+
icon: Search,
|
|
346
|
+
shortcut: '⌘+S'
|
|
347
|
+
}
|
|
348
|
+
]
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
label: 'Profile',
|
|
352
|
+
items: [
|
|
353
|
+
{
|
|
354
|
+
label: 'Settings',
|
|
355
|
+
icon: Cog,
|
|
356
|
+
shortcut: '⌘+O'
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
label: 'Messages',
|
|
360
|
+
icon: Inbox,
|
|
361
|
+
badge: 2
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
label: 'Logout',
|
|
365
|
+
icon: SignOut,
|
|
366
|
+
shortcut: '⌘+Q',
|
|
367
|
+
linkClass: 'text-red-500! dark:text-red-400!'
|
|
368
|
+
}
|
|
369
|
+
]
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
separator: true
|
|
373
|
+
}
|
|
374
|
+
]);
|
|
375
|
+
<\/script>
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
## Command
|
|
379
|
+
|
|
380
|
+
The function to invoke when an item is clicked is defined using the command property.
|
|
381
|
+
|
|
382
|
+
```vue
|
|
383
|
+
<template>
|
|
384
|
+
<div class="flex justify-center">
|
|
385
|
+
<Menu :model="items" />
|
|
386
|
+
<Toast />
|
|
387
|
+
</div>
|
|
388
|
+
</template>
|
|
389
|
+
|
|
390
|
+
<script setup>
|
|
391
|
+
import Plus from '@primeicons/vue/plus';
|
|
392
|
+
import Search from '@primeicons/vue/search';
|
|
393
|
+
import { ref } from "vue";
|
|
394
|
+
import { useToast } from "primevue/usetoast";
|
|
395
|
+
|
|
396
|
+
const toast = useToast();
|
|
397
|
+
|
|
398
|
+
const items = ref([
|
|
399
|
+
{
|
|
400
|
+
label: 'New',
|
|
401
|
+
icon: Plus,
|
|
402
|
+
command: () => {
|
|
403
|
+
toast.add({ severity: 'success', summary: 'Success', detail: 'File created', life: 3000 });
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
label: 'Search',
|
|
408
|
+
icon: Search,
|
|
409
|
+
command: () => {
|
|
410
|
+
toast.add({ severity: 'warn', summary: 'Search Completed', detail: 'No results found', life: 3000 });
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
]);
|
|
414
|
+
<\/script>
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
## Router
|
|
418
|
+
|
|
419
|
+
Menu items support navigation via router-link, programmatic routing using commands, or external URLs.
|
|
420
|
+
|
|
421
|
+
```vue
|
|
422
|
+
<template>
|
|
423
|
+
<div class="flex justify-center">
|
|
424
|
+
<Menu :model="items">
|
|
425
|
+
<template #item="{ item, icon, label, props }">
|
|
426
|
+
<router-link v-if="item.route" v-slot="{ href, navigate }" :to="item.route" custom>
|
|
427
|
+
<a v-ripple :href="href" v-bind="props.action" @click="navigate">
|
|
428
|
+
<component :is="icon" />
|
|
429
|
+
<span class="text-sm ml-2">{{ label }}</span>
|
|
430
|
+
</a>
|
|
431
|
+
</router-link>
|
|
432
|
+
<a v-else v-ripple :href="item.url" :target="item.target" v-bind="props.action">
|
|
433
|
+
<component :is="icon" />
|
|
434
|
+
<span class="text-sm ml-2">{{ label }}</span>
|
|
435
|
+
</a>
|
|
436
|
+
</template>
|
|
437
|
+
</Menu>
|
|
438
|
+
</div>
|
|
439
|
+
</template>
|
|
440
|
+
|
|
441
|
+
<script setup>
|
|
442
|
+
import Home from '@primeicons/vue/home';
|
|
443
|
+
import Link from '@primeicons/vue/link';
|
|
444
|
+
import Palette from '@primeicons/vue/palette';
|
|
445
|
+
import { ref } from 'vue';
|
|
446
|
+
import { useRouter } from 'vue-router';
|
|
447
|
+
|
|
448
|
+
const router = useRouter();
|
|
449
|
+
|
|
450
|
+
const items = ref([
|
|
451
|
+
{
|
|
452
|
+
label: 'Navigate',
|
|
453
|
+
items: [
|
|
454
|
+
{ label: 'Router Link', icon: Palette, route: '/theming' },
|
|
455
|
+
{
|
|
456
|
+
label: 'Programmatic',
|
|
457
|
+
icon: Link,
|
|
458
|
+
command: () => {
|
|
459
|
+
router.push('/installation');
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
{ label: 'External', icon: Home, url: 'https://vuejs.org/', target: '_blank' }
|
|
463
|
+
]
|
|
464
|
+
}
|
|
465
|
+
]);
|
|
466
|
+
<\/script>
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
## Controlled
|
|
470
|
+
|
|
471
|
+
Menu state can be controlled programmatically with the expandedKeys property that defines the keys of the toggleable submenus that are expanded. This property is an object whose key matches an item's key field and value is a boolean. Note that expandedKeys also supports two-way binding with the v-model directive.
|
|
472
|
+
|
|
473
|
+
```vue
|
|
474
|
+
<template>
|
|
475
|
+
<div>
|
|
476
|
+
<div class="flex flex-wrap gap-2 mb-6">
|
|
477
|
+
<Button type="button" severity="secondary" variant="outlined" size="small" @click="expandAll">
|
|
478
|
+
<Plus />
|
|
479
|
+
Expand All
|
|
480
|
+
</Button>
|
|
481
|
+
<Button type="button" severity="secondary" variant="outlined" size="small" @click="collapseAll">
|
|
482
|
+
<Minus />
|
|
483
|
+
Collapse All
|
|
484
|
+
</Button>
|
|
485
|
+
</div>
|
|
486
|
+
<Menu v-model:expandedKeys="expandedKeys" :model="items" />
|
|
487
|
+
</div>
|
|
488
|
+
</template>
|
|
489
|
+
|
|
490
|
+
<script setup>
|
|
491
|
+
import Briefcase from '@primeicons/vue/briefcase';
|
|
492
|
+
import Calendar from '@primeicons/vue/calendar';
|
|
493
|
+
import ChartBar from '@primeicons/vue/chart-bar';
|
|
494
|
+
import CheckCircle from '@primeicons/vue/check-circle';
|
|
495
|
+
import File from '@primeicons/vue/file';
|
|
496
|
+
import Folder from '@primeicons/vue/folder';
|
|
497
|
+
import Home from '@primeicons/vue/home';
|
|
498
|
+
import Minus from '@primeicons/vue/minus';
|
|
499
|
+
import Plus from '@primeicons/vue/plus';
|
|
500
|
+
import { ref } from 'vue';
|
|
501
|
+
|
|
502
|
+
const expandedKeys = ref({ reports: true });
|
|
503
|
+
const items = ref([
|
|
504
|
+
{ key: 'dashboard', label: 'Dashboard', icon: Home },
|
|
505
|
+
{ separator: true },
|
|
506
|
+
{
|
|
507
|
+
key: 'workspace',
|
|
508
|
+
label: 'Workspace',
|
|
509
|
+
items: [
|
|
510
|
+
{
|
|
511
|
+
key: 'projects',
|
|
512
|
+
label: 'Projects',
|
|
513
|
+
icon: Folder,
|
|
514
|
+
items: [
|
|
515
|
+
{ key: 'projects-active', label: 'Active', icon: Briefcase },
|
|
516
|
+
{ key: 'projects-completed', label: 'Completed', icon: CheckCircle }
|
|
517
|
+
]
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
key: 'reports',
|
|
521
|
+
label: 'Reports',
|
|
522
|
+
icon: File,
|
|
523
|
+
items: [
|
|
524
|
+
{ key: 'reports-monthly', label: 'Monthly', icon: Calendar },
|
|
525
|
+
{ key: 'reports-yearly', label: 'Yearly', icon: ChartBar }
|
|
526
|
+
]
|
|
527
|
+
}
|
|
528
|
+
]
|
|
529
|
+
}
|
|
530
|
+
]);
|
|
531
|
+
|
|
532
|
+
const expandNodes = (nodes, keys) => {
|
|
533
|
+
for (const item of nodes || []) {
|
|
534
|
+
if (item.items && item.key) {
|
|
535
|
+
keys[item.key] = true;
|
|
536
|
+
expandNodes(item.items, keys);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
const expandAll = () => {
|
|
542
|
+
const keys = {};
|
|
543
|
+
|
|
544
|
+
expandNodes(items.value, keys);
|
|
545
|
+
expandedKeys.value = keys;
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
const collapseAll = () => {
|
|
549
|
+
expandedKeys.value = {};
|
|
550
|
+
};
|
|
551
|
+
<\/script>
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
## Accessibility
|
|
555
|
+
|
|
556
|
+
Screen Reader Menu component uses the menu role 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 Menu uses the group role with an aria-labelledby defined as the id of the submenu root menuitem label. In popup mode, the component implicitly manages the aria-expanded , aria-haspopup and aria-controls attributes of the target element to define the relation between the target and the popup. Keyboard Support Key Function tab Add focus to the first item if focus moves in to the menu. If the focus is already within the menu, focus moves to the next focusable item in the page tab sequence. shift + tab Add focus to the last item if focus moves in to the menu. If the focus is already within the menu, focus moves to the previous focusable item in the page tab sequence. enter Activates the focused menuitem. If menu is in overlay mode, popup gets closes and focus moves to target. space Activates the focused menuitem. If menu is in overlay mode, popup gets closes and focus moves to target. escape If menu is in overlay mode, popup gets closes and focus moves to target. down arrow Moves focus to the next menuitem. up arrow Moves focus to the previous menuitem. home Moves focus to the first menuitem. end Moves focus to the last menuitem.
|
|
557
|
+
|
|
558
|
+
## Menu API
|
|
559
|
+
|
|
560
|
+
### Props
|
|
561
|
+
|
|
562
|
+
| Name |Type |Default |Description |
|
|
563
|
+
| --- | --- | --- | --- |
|
|
564
|
+
| model | MenuItem[] | - | An array of menuitems. |
|
|
565
|
+
| expandedKeys | MenuExpandedKeys | - | When provided, switches the component to controlled mode; each key is the DOM id of a toggleable submenu header and the value its expansion flag. Pair with `@update:expandedKeys` or `v-model:expandedKeys` . |
|
|
566
|
+
| popup | boolean | false | Defines if menu would displayed as a popup. |
|
|
567
|
+
| appendTo | HTMLElement \| HintedString<"body" \| "self"> | body | A valid query selector or an HTMLElement to specify where the overlay gets attached. |
|
|
568
|
+
| autoZIndex | boolean | true | Whether to automatically manage layering. |
|
|
569
|
+
| baseZIndex | number | 0 | Base zIndex value to use in layering. |
|
|
570
|
+
| tabindex | string \| number | - | Index of the element in tabbing order. |
|
|
571
|
+
| ariaLabel | string | - | Defines a string value that labels an interactive element. |
|
|
572
|
+
| ariaLabelledby | string | - | Identifier of the underlying input element. |
|
|
573
|
+
| dt | any | - | It generates scoped CSS variables using design tokens for the component. |
|
|
574
|
+
| pt | PassThrough<MenuPassThroughOptions> | - | Used to pass attributes to DOM elements inside the component. |
|
|
575
|
+
| ptOptions | any | - | Used to configure passthrough(pt) options of the component. |
|
|
576
|
+
| unstyled | boolean | false | When enabled, it removes component related styles in the core. |
|
|
577
|
+
|
|
578
|
+
### Pass Through Options
|
|
579
|
+
|
|
580
|
+
| Name |Type |Description |
|
|
581
|
+
| --- | --- | --- |
|
|
582
|
+
| root | MenuPassThroughOptionType | Used to pass attributes to the root's DOM element. |
|
|
583
|
+
| list | MenuPassThroughOptionType | Used to pass attributes to the list's DOM element. |
|
|
584
|
+
| submenuLabel | MenuPassThroughOptionType | Used to pass attributes to the submenu label's DOM element (non-toggleable group headers). |
|
|
585
|
+
| submenuList | MenuPassThroughOptionType | Used to pass attributes to the nested submenu list's DOM element. |
|
|
586
|
+
| item | MenuPassThroughOptionType | Used to pass attributes to the item's DOM element. |
|
|
587
|
+
| itemContent | MenuPassThroughOptionType | Used to pass attributes to the item content's DOM element. |
|
|
588
|
+
| itemLink | MenuPassThroughOptionType | Used to pass attributes to the item link's DOM element. |
|
|
589
|
+
| itemIcon | MenuPassThroughOptionType | Used to pass attributes to the item icon's DOM element. |
|
|
590
|
+
| itemLabel | MenuPassThroughOptionType | Used to pass attributes to the item label's DOM element. |
|
|
591
|
+
| itemSubmenuIcon | MenuPassThroughOptionType | Used to pass attributes to the item submenu toggle icon's DOM element (toggleable items). |
|
|
592
|
+
| separator | MenuPassThroughOptionType | Used to pass attributes to the separator's DOM element. |
|
|
593
|
+
| start | MenuPassThroughOptionType | Used to pass attributes to the start of the component. |
|
|
594
|
+
| end | MenuPassThroughOptionType | Used to pass attributes to the end of the component. |
|
|
595
|
+
| hooks | any | Used to manage all lifecycle hooks. |
|
|
596
|
+
| transition | MenuPassThroughTransitionType | Used to control Vue Transition API. |
|
|
597
|
+
|
|
598
|
+
### Theming
|
|
599
|
+
|
|
600
|
+
### CSS Classes
|
|
601
|
+
|
|
602
|
+
| Class |Description |
|
|
603
|
+
| --- | --- |
|
|
604
|
+
| p-menu | Class name of the root element |
|
|
605
|
+
| p-menu-start | Class name of the start element |
|
|
606
|
+
| p-menu-list | Class name of the list element |
|
|
607
|
+
| p-menu-submenu-label | Class name of the submenu label element (non-toggleable group headers). |
|
|
608
|
+
| p-menu-submenu-list | Class name of the nested submenu list element. |
|
|
609
|
+
| p-menu-separator | Class name of the separator element |
|
|
610
|
+
| p-menu-end | Class name of the end element |
|
|
611
|
+
| p-menu-item | Class name of the item element |
|
|
612
|
+
| p-menu-item-content | Class name of the item content element |
|
|
613
|
+
| p-menu-item-link | Class name of the item link element |
|
|
614
|
+
| p-menu-item-icon | Class name of the item icon element |
|
|
615
|
+
| p-menu-item-label | Class name of the item label element |
|
|
616
|
+
| p-menu-item-submenu-icon | Class name of the item submenu toggle icon element (toggleable items). |
|
|
617
|
+
|
|
618
|
+
### Design Tokens
|
|
619
|
+
|
|
620
|
+
| Token |CSS Variable |Description |
|
|
621
|
+
| --- | --- | --- |
|
|
622
|
+
| menu.background | --p-menu-background | Background of root |
|
|
623
|
+
| menu.border.color | --p-menu-border-color | Border color of root |
|
|
624
|
+
| menu.color | --p-menu-color | Color of root |
|
|
625
|
+
| menu.border.radius | --p-menu-border-radius | Border radius of root |
|
|
626
|
+
| menu.shadow | --p-menu-shadow | Shadow of root |
|
|
627
|
+
| menu.transition.duration | --p-menu-transition-duration | Transition duration of root |
|
|
628
|
+
| menu.list.padding | --p-menu-list-padding | Padding of list |
|
|
629
|
+
| menu.list.gap | --p-menu-list-gap | Gap of list |
|
|
630
|
+
| menu.item.focus.background | --p-menu-item-focus-background | Focus background of item |
|
|
631
|
+
| menu.item.color | --p-menu-item-color | Color of item |
|
|
632
|
+
| menu.item.focus.color | --p-menu-item-focus-color | Focus color of item |
|
|
633
|
+
| menu.item.padding | --p-menu-item-padding | Padding of item |
|
|
634
|
+
| menu.item.border.radius | --p-menu-item-border-radius | Border radius of item |
|
|
635
|
+
| menu.item.gap | --p-menu-item-gap | Gap of item |
|
|
636
|
+
| menu.item.icon.color | --p-menu-item-icon-color | Icon color of item |
|
|
637
|
+
| menu.item.icon.focus.color | --p-menu-item-icon-focus-color | Icon focus color of item |
|
|
638
|
+
| menu.item.icon.size | --p-menu-item-icon-size | Icon size of item |
|
|
639
|
+
| menu.item.label.font.weight | --p-menu-item-label-font-weight | Font weight of item label |
|
|
640
|
+
| menu.item.label.font.size | --p-menu-item-label-font-size | Font size of item label |
|
|
641
|
+
| menu.submenu.label.padding | --p-menu-submenu-label-padding | Padding of submenu label |
|
|
642
|
+
| menu.submenu.label.font.weight | --p-menu-submenu-label-font-weight | Font weight of submenu label |
|
|
643
|
+
| menu.submenu.label.font.size | --p-menu-submenu-label-font-size | Font size of submenu label |
|
|
644
|
+
| menu.submenu.label.background | --p-menu-submenu-label-background | Background of submenu label |
|
|
645
|
+
| menu.submenu.label.color | --p-menu-submenu-label-color | Color of submenu label |
|
|
646
|
+
| menu.submenu.icon.size | --p-menu-submenu-icon-size | Size of submenu icon |
|
|
647
|
+
| menu.submenu.icon.color | --p-menu-submenu-icon-color | Color of submenu icon |
|
|
648
|
+
| menu.submenu.icon.focus.color | --p-menu-submenu-icon-focus-color | Focus color of submenu icon |
|
|
649
|
+
| menu.separator.border.color | --p-menu-separator-border-color | Border color of separator |
|
|
650
|
+
|
|
651
|
+
## Menu Item API
|