In your React-Javascript project, you can easily add menus to the sidebar by modifying the MENUITEMS array in the Sidebar.jsx (Root: src\pages\layout\layoutpages\Sidebar.jsx) file. The sidebar will dynamically display the menus based on the contents of this array.
Open the Sidebar.jsx (Root: src\pages\layout\layoutpages\Sidebar.jsx) file in your React-Javascript project. This file contains the MENUITEMS array that defines the menus to be displayed in the sidebar.
Inside the MENUITEMS array, you can add your menu items using the following format:
{
menutitle: "Your Menu Title",
Items:[
title: 'Your Component Title',
selected: false,
icon: 'icon-name',
type: 'link', // or 'sub', 'mega-menu', 'external', 'empty'
path: '/path-to-route', // Specify the route path for link type
dirchange: false, change the direction from right to left .
active: false,
badge: 'badge-class', // (optional) Add a badge to the menu item
badgetxt: 'Badge Text', // (optional) Text to display in the badge
]
}
Inside the MENUITEMS array, you can add your menu items using the following format:
{
menutitle: "Your Menu Title",
title: 'Your Component Title',
selected: false,
icon: 'icon-name',
type: 'link', // or 'sub', 'mega-menu', 'external', 'empty'
active: false,
dirchange: false, change the direction from right to left .
badge: 'badge-class', // (optional) Add a badge to the menu item
badgetxt: 'Badge Text', // (optional) Text to display in the badge
children: [
// (optional) Define child items for sub-menu or mega-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 Sidebar.jsx (Root: src\pages\layout\layoutpages\Sidebar.jsx) file.
The sidebar will now automatically display the added menu items based on the modifications you made in the MENUITEMS array.