In your Svelte project, you can easily add menus to the sidebar by modifying the MenuData array in the nav.js (src/lib/components/layout-components/sidebar/nav.js) file. The sidebar will dynamically display the menus based on the contents of this array.
Open the nav.js (src/lib/components/layout-components/sidebar/nav.js) file in your Svelte project. This file contains the menuData array that defines the menus to be displayed in the sidebar.
Inside the menuData array, you can add your menu items using the following format:
{
menutitle: "Your Menu Title",
Items:[
title: 'Your Component Title',
icon: 'icon-name',
selected: false,
type: 'link',
path: '/path-to-route', // Specify the route path for link type
active: false,
dirchange:false,
badge: 'badge-class', // (optional) Add a badge to the menu item
badgeColor: 'Badge Text', // (optional) Text to display in the badge
]
},
Inside the menuData array, you can add your menu items using the following format:
{
menutitle: "Your Menu Title",
Items:[
title: 'Your Component Title',
icon: 'icon-name',
selected: false,
type: 'sub',
path: '/path-to-route', // Specify the route path for link type
active: false,
dirchange:false,
badge: 'badge-class', // (optional) Add a badge to the menu item
badgeColor: 'Badge Text', // (optional) Text to display in the badge
children: [
// (optional) Define child items for sub-menu type
{
path: '/child-path',
title: 'Child Menu Title',
type: 'link',
selected: false,
},
// Add more child items if needed
],
]
},
After adding your menu items, save the changes made to the nav.js (src/lib/components/layout-components/sidebar/nav.js) file.
The sidebar will now automatically display the added menu items based on the modifications you made in the menuData array.