Import
-import Menu from 'primevue/menu';
+import TieredMenu from 'primevue/menu';
MenuModel
- Menu uses the common MenuModel API to define the items, visit MenuModel API for details.
+ TieredMenu uses the common MenuModel API to define the items, visit MenuModel API for details.
Getting Started
- Menu requires a collection of menuitems as its model.
+ TieredMenu requires a collection of menuitems as its model.
-<Menu :model="items" />
+<TieredMenu :model="items" />
export default {
- data() {
- return {
- items: [
- {
- label: 'Update',
- icon: 'pi pi-refresh',
- command: () => {
- this.$toast.add({severity:'success', summary:'Updated', detail:'Data Updated', life: 3000});
- }
- },
- {
- label: 'Delete',
- icon: 'pi pi-times',
- command: () => {
- this.$toast.add({ severity: 'warn', summary: 'Delete', detail: 'Data Deleted', life: 3000});
- }
- },
- {
- label: 'Vue Website',
- icon: 'pi pi-external-link',
- url: 'https://vuejs.org/'
- },
- {
- label: 'Router',
- icon: 'pi pi-upload',
- to: '/fileupload'
+ data() {
+ return {
+ items: [
+ {
+ label:'File',
+ icon:'pi pi-fw pi-file',
+ items:[
+ {
+ label:'New',
+ icon:'pi pi-fw pi-plus',
+ items:[
+ {
+ label:'Bookmark',
+ icon:'pi pi-fw pi-bookmark'
+ },
+ {
+ label:'Video',
+ icon:'pi pi-fw pi-video'
+ },
+
+ ]
+ },
+ {
+ label:'Delete',
+ icon:'pi pi-fw pi-trash'
+ },
+ {
+ separator:true
+ },
+ {
+ label:'Export',
+ icon:'pi pi-fw pi-external-link'
+ }
+ ]
+ },
+ {
+ label:'Edit',
+ icon:'pi pi-fw pi-pencil',
+ items:[
+ {
+ label:'Left',
+ icon:'pi pi-fw pi-align-left'
+ },
+ {
+ label:'Right',
+ icon:'pi pi-fw pi-align-right'
+ },
+ {
+ label:'Center',
+ icon:'pi pi-fw pi-align-center'
+ },
+ {
+ label:'Justify',
+ icon:'pi pi-fw pi-align-justify'
+ },
+
+ ]
+ },
+ {
+ label:'Users',
+ icon:'pi pi-fw pi-user',
+ items:[
+ {
+ label:'New',
+ icon:'pi pi-fw pi-user-plus',
+
+ },
+ {
+ label:'Delete',
+ icon:'pi pi-fw pi-user-minus',
+
+ },
+ {
+ label:'Search',
+ icon:'pi pi-fw pi-users',
+ items:[
+ {
+ label:'Filter',
+ icon:'pi pi-fw pi-filter',
+ items:[
+ {
+ label:'Print',
+ icon:'pi pi-fw pi-print'
+ }
+ ]
+ },
+ {
+ icon:'pi pi-fw pi-bars',
+ label:'List'
+ }
+ ]
+ }
+ ]
+ },
+ {
+ label:'Events',
+ icon:'pi pi-fw pi-calendar',
+ items:[
+ {
+ label:'Edit',
+ icon:'pi pi-fw pi-pencil',
+ items:[
+ {
+ label:'Save',
+ icon:'pi pi-fw pi-calendar-plus'
+ },
+ {
+ label:'Delete',
+ icon:'pi pi-fw pi-calendar-minus'
+ },
+
+ ]
+ },
+ {
+ label:'Archieve',
+ icon:'pi pi-fw pi-calendar-times',
+ items:[
+ {
+ label:'Remove',
+ icon:'pi pi-fw pi-calendar-minus'
+ }
+ ]
+ }
+ ]
+ },
+ {
+ separator:true
+ },
+ {
+ label:'Quit',
+ icon:'pi pi-fw pi-power-off'
}
- ]
- }
- }
+ ]
+ }
+ }
}
-
-
- SubMenus
- Menu supports one level of nesting via subitems of an item.
-
-const items: [
- {
- label: 'Options',
- items: [{label: 'New', icon: 'pi pi-fw pi-plus', command:() => {} },
- {label: 'Delete', icon: 'pi pi-fw pi-trash', url: 'http://primetek.com.tr'}]
- },
- {
- label: 'Account',
- items: [{label: 'Options', icon: 'pi pi-fw pi-cog', to: '/options'},
- {label: 'Sign Out', icon: 'pi pi-fw pi-power-off', to: '/logout'} ]
- }
-];
Popup Mode
- Menu is inline by default whereas popup mode is supported by enabling popup property and calling toggle method with an event of the target.
+ TieredMenu is inline by default whereas popup mode is supported by enabling popup property and calling toggle method with an event of the target.
<Button type="button" label="Toggle" @click="toggle" />
-<Menu ref="menu" :model="items" :popup="true" />
+<TieredMenu ref="menu" :model="items" :popup="true" />
@@ -172,7 +260,7 @@ toggle(event) {
- p-menu |
+ p-tieredmenu |
Container element. |
@@ -190,6 +278,10 @@ toggle(event) {
p-menuitem-icon |
Icon of a menuitem. |
+
+
+ p-submenu-icon |
+ Arrow icon of a submenu. |
@@ -200,17 +292,17 @@ toggle(event) {