SideMenu Guide

How to Add Menus to Sidebar

In your React-Javascript project, you can easily add menus to the sidebar by modifying the MenuItems array in the sidemenu.jsx (src\common\sidebar\sidemenu\sidemenu.jsx) file. The sidebar will dynamically display the menus based on the contents of this array.

Steps:
1 .Open sidemenu.jsx File:

Open the sidemenu.jsx (src\components\common\sidebar\sidemenu\sidemenu.jsx) file in your React-Javascript project. This file contains the MenuItems array that defines the menus to be displayed in the sidebar.

To add the parent Menu Items:

Inside the MenuItems array, you can add your menu items using the following format:

{
	path: '/path-to-route', // Specify the route path for link type
	icon: 'icon-name',
	type: 'link', // or 'sub', 'mega-menu', 'external', 'empty'
	selected: false,
	active: false,
	title: 'Your Component Title',
  },
To add the children Menu Items:

Inside the MenuItems array, you can add your menu items using the following format:

{
	icon: 'icon-name',
	type: 'link', // or 'sub', 'mega-menu', 'external', 'empty'
	Name: "",
	active: false,
	selected: false,
	badge: 'badge-class', // (optional) Add a badge to the menu item
	badgetxt: 'Badge Text', // (optional) Text to display in the badge
	class: "",
	title:'Your Component Title',
	children: [
	// (optional) Define child items for sub-menu or mega-menu type
	  {
		path: '/child-path',
		title: 'Child Menu Title',
		type: "link",
		active: false,
		selected: false,
	  },
	  // Add more child items if needed
	]
}
  • title: The display name of the component.
  • selected: Set to true if this menu is currently selected.
  • icon: The icon to display next to the menu.
  • type: Specify the type of the menu item (link, sub, mega-menu, external, empty).
  • path: Specify the route path for link type menu.
  • active: Set to true to mark this menu as active.
  • badge (optional): CSS class for the badge.
  • badgetxt (optional): Text to display in the badge.
  • children: Define an array of child menu items for sub-menu or mega-menu type.
3 . Save the Changes:

After adding your menu items, save the changes made to the sidemenu.jsx (src\common\sidebar\sidemenu\sidemenu.jsx) file.

4 . View Sidebar Changes:

The sidebar will now automatically display the added menu items based on the modifications you made in the MenuItems array.

By following these steps, you can easily customize and add menus to the sidebar of your React-Javascript project. The menus will be dynamically generated based on the content of the MenuItems array in the sidemenu.jsx file.